[Koha-devel] Fixing perltidy in ktd

David Cook dcook at prosentient.com.au
Mon Feb 13 00:31:57 CET 2023


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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20230213/5499dbf6/attachment.htm>


More information about the Koha-devel mailing list