I believe we use the default perltidy settings ( 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
ByWater Solutions ( http://bywatersolutions.com )
Meadville Public Library ( http://www.meadvillelibrary.org )
Crawford County Federated Library System ( http://www.ccfls.org )


On Sun, Feb 12, 2023 at 6:32 PM David Cook <dcook@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

 

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. 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@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/