[Koha-devel] koha code cleaning bug?

Galen Charlton galen.charlton at liblime.com
Mon Sep 29 17:03:19 CEST 2008


Hi,

On Mon, Sep 29, 2008 at 9:42 AM, Marc Chantreux
<marc.chantreux at biblibre.com> wrote:
> do you think that:
>
> for my $var ( list_generator ) {
>    $var =~ /useless/;
>    $var =~ s/old/new/;
>    next unless -d $var;
>    mkdir $_;
> }
>
> is more readable than:
>
> for ( list_generator ) {
>    /useless/;
>    s/old/new/;
>    next unless -d;
>    mkdir $_;
> }

I do. :)

> I think that be confortable with $_ (without abusing it) is a part of
> the perl programmer skills set. If you don't, you'll never use such
> usefull fonctions like grep and map.

I agree that a Perl programmer ought to know how to use $_.  However,
IMO the project needs to accept contributions from both expert and
novice Perl programmers, and too much use of "punctuation" variables
outside of the while (<FILE>) idiom reduces clarity.

> perl 5.10 makes $_ lexical and add the (_) prototype. It would be sad to
> not use it imho.

Which is fine, but we still need to support 5.8.

> can this practice discuted with all developpers and added in the coding
> style?

We can discuss it sure, but I'm with Conway and PBP on this one.

>> 1. If you're doing this sort of stylistic change, please consider
>> writing test cases.
>
> you're right but i'm not fluent with it. Any doc about that (in the wiki
> or whatever?)

http://wiki.koha.org/doku.php?id=en:development:unit_testing

>> 3. If you fix a problem in one place, consider fixing it in all places.
>
> all places in the file, right? doing it in every files of koha is a long
> job.

At least in the same file of course, but as time permits, it is better
to completely fix a problem wherever it occurs.

>> A generic code-cleaning bug is too vague; I suggest opening a bug for
>> each cleanup, to remain open until all instances of that cleanup have
>> been completed.
>
> i though about it but it will open a large range of bugs. the only one
> bug was just a proposal to limit the polution in bugs.koha.org.

I've no problem having a large number of bugs.  Somebody glancing at
the bugs database for something to do might tackle a well defined
cleanup project; a generic "let's get Koha to completely pass
perlcritic -brutal", while it might establish a overall goal, does not
encourage action unless somebody is *very* industrious.

Regards,

Galen
-- 
Galen Charlton
VP, Research & Development, LibLime
galen.charlton at liblime.com
p: 1-888-564-2457 x709
skype: gmcharlt



More information about the Koha-devel mailing list