[Koha-devel] koha code cleaning bug?

Marc Chantreux marc.chantreux at biblibre.com
Mon Sep 29 12:17:40 CEST 2008


hello all, 

the code that ends this email comes from zebra_rebuild.pl. It can be rewritten as: 

for('',qw( lock register shadow tab key )) {
    next if -d;
    $created_dir_or_file++;
    system("mkdir -p $authorityserverdir");
    print "Info: created $authorityserverdir/$_";
} 

That is not a bug but it is currently written makes the things harder to read
and maintain and it discourages to provide a patch to improve the code(imho). I
would like to provide a patch to clean this code.

This code is not the only one and so i wonder if the koha communauty wants to
have this kind of patch. I also wonder how to do this because of the "fill
a bug first" policy. It can be possible to create a "code cleaning" bug that
will stay unfixed and our patches can be related to this one.

regards, 

    unless (-d "$authorityserverdir") {
        system("mkdir -p $authorityserverdir");
        print "Info: created $authorityserverdir\n";
        $created_dir_or_file++;
    }
    unless (-d "$authorityserverdir/lock") {
        mkdir "$authorityserverdir/lock";
        print "Info: created $authorityserverdir/lock\n";
        $created_dir_or_file++;
    }
    unless (-d "$authorityserverdir/register") {
        mkdir "$authorityserverdir/register";
        print "Info: created $authorityserverdir/register\n";
        $created_dir_or_file++;
    }
    unless (-d "$authorityserverdir/shadow") {
        mkdir "$authorityserverdir/shadow";
        print "Info: created $authorityserverdir/shadow\n";
        $created_dir_or_file++;
    }
    unless (-d "$authorityserverdir/tab") {
        mkdir "$authorityserverdir/tab";
        print "Info: created $authorityserverdir/tab\n";
        $created_dir_or_file++;
    }
    unless (-d "$authorityserverdir/key") {
        mkdir "$authorityserverdir/key";
        print "Info: created $authorityserverdir/key\n";
        $created_dir_or_file++;
... 

-- 
Marc Chantreux
http://www.biblibre.com
Expert en Logiciels Libres pour l'info-doc



More information about the Koha-devel mailing list