[Koha-devel] Fixing perltidy in ktd

David Cook dcook at prosentient.com.au
Fri Mar 10 04:17:53 CET 2023


Hi all,

Just seeing these now...

I've been having success with "Tidy()" in vim in the latest ktd so all good.

David Cook
Senior Software Engineer
Prosentient Systems
Suite 7.03
6a Glen St
Milsons Point NSW 2061
Australia

Office: 02 9212 0899
Online: 02 8005 0595

-----Original Message-----
From: Mason James <mtj at kohaaloha.com> 
Sent: Tuesday, 14 February 2023 1:41 PM
To: Kyle Hall <kyle.m.hall at gmail.com>; David Cook <dcook at prosentient.com.au>
Cc: koha-devel at lists.koha-community.org; Tomas Cohen Arazi <tomascohen at theke.io>
Subject: Re: [Koha-devel] Fixing perltidy in ktd

hi David,
i ran perltidy -nopro on debian/scripts/koha-log4perl

the brackets and whitespace changes look 'as expected' to me...

  https://git.kohaaloha.com/?p=ktd_koha/.git;a=commit;h=c3324709c9c86e8241b7010e99e6628ac9677345
  https://git.kohaaloha.com/?p=ktd_koha/.git;a=commitdiff;h=c3324709c9c86e8241b7010e99e6628ac9677345;hp=a0fa46cb48e400e141156b42377e5a0b303fe98f


as Kyle said, we decided to use the 'default' style of perltidy this can be forced using 'perltidy -nopro', to override any .perltidyrc found in $PATH

xt/perltidyrc was added before a style was decided on, so was only a suggestion - perhaps we remove it too as its incorrect/confusing?



On 14/02/23 3:10 am, Kyle Hall wrote:
> I believe we use the default perltidy settings ( https://wiki.koha-community.org/wiki/Coding_Guidelines#PERL1:_Perltidy <https://wiki.koha-community.org/wiki/Coding_Guidelines#PERL1:_Perltidy> ). I'm not aware of KTD having an installed perltidyrc ( there is one in git in xt that's been in there since 2008 presumably unused ).
> 
> Kyle
> 
> ---
> http://www.kylehall.info <http://www.kylehall.info> ByWater Solutions 
> ( http://bywatersolutions.com <http://bywatersolutions.com> ) 
> Meadville Public Library ( http://www.meadvillelibrary.org 
> <http://www.meadvillelibrary.org> ) Crawford County Federated Library 
> System ( http://www.ccfls.org <http://www.ccfls.org> )
> 
> 
> On Sun, Feb 12, 2023 at 6:32 PM David Cook <dcook at prosentient.com.au <mailto:dcook at prosentient.com.au>> wrote:
> 
>     Hi Tomas,____
> 
>     __ __
> 
>     I saw you, Katrin, and Jonathan writing in #koha about perltidy. 
> When I’ve tried previously to perltidy in ktd using the “:Tidy” 
> command, it seemed to change the style to something incompatible with 
> https://wiki.koha-community.org/wiki/Coding_Guidelines 
> <https://wiki.koha-community.org/wiki/Coding_Guidelines>____
> 
>     __ __
> 
>     If I type “vi Koha.pm”, then “:echo $MYVIMRC”, it tells me I’m 
> using the /root/.vimrc file. I’m not overwriting that, so it’s the 
> default file that ships with ktd.____
> 
>     __ __
> 
>     I don’t have a good example off the top of my head though. ____
> 
>     __ __
> 
>     I’ve just tried perltidying debian/scripts/koha-log4perl from 
> https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32791 
> <https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32791>. 
> There are things that look weird to me but after reviewing the coding 
> guidelines, maybe I’ve been wrong all this time.____
> 
>     __ __
> 
>     For example:____
> 
>     __ __
> 
>     -                my $snippet = get_snippet({____
> 
>     -                    instance => $instance,____
> 
>     -                    component => $component,____
> 
>     -                });____
> 
>     -                if ($snippet){____
> 
>     +                my $snippet = get_snippet(____
> 
>     +                    {____
> 
>     +                        instance  => $instance,____
> 
>     +                        component => $component,____
> 
>     +                    }____
> 
>     +                );____
> 
>     __ __
> 
>     I always thought we preferred to keep the brackets on the same 
> line (like in all the JS examples on the wiki). ____
> 
>     __ __
> 
>     It looks like perltidy sometimes mangles the whitespace for 
> comments as well. I’d correctly indented a comment and then perltidy 
> stripped all the whitespace except for 2 leading spaces. ____
> 
>     __ __
> 
>     That all said… overall it probably does look better, so maybe the 
> out of the box perltidy is good enough, and if the same perltidy file 
> is applied across the board I suppose it doesn’t matter…____
> 
>     __ __
> 
>     David Cook____
> 
>     Senior Software Engineer____
> 
>     Prosentient Systems____
> 
>     Suite 7.03____
> 
>     6a Glen St____
> 
>     Milsons Point NSW 2061____
> 
>     Australia____
> 
>     __ __
> 
>     Office: 02 9212 0899____
> 
>     Online: 02 8005 0595____
> 
>     __ __
> 
>     _______________________________________________
>     Koha-devel mailing list
>     Koha-devel at lists.koha-community.org <mailto:Koha-devel at lists.koha-community.org>
>     https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel <https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel>
>     website : https://www.koha-community.org/ <https://www.koha-community.org/>
>     git : https://git.koha-community.org/ <https://git.koha-community.org/>
>     bugs : https://bugs.koha-community.org/ 
> <https://bugs.koha-community.org/>
> 
> 
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : https://www.koha-community.org/ git : 
> https://git.koha-community.org/ bugs : 
> https://bugs.koha-community.org/



More information about the Koha-devel mailing list