Re: [PATCH 0/4] get_maintainer script cleanups

From: Stephen Hemminger
Date: Mon May 26 2014 - 21:06:15 EST


On Mon, 26 May 2014 18:00:49 -0700
Joe Perches <joe@xxxxxxxxxxx> wrote:

> On Mon, 2014-05-26 at 13:33 -0700, Stephen Hemminger wrote:
> > Some simple perl hacking changes.
>
> I don't really care for these.
>
> Why do you think these are better?
>
> I think the first one breaks the code too.
>
>

$ perlcritic scripts/get_maintainer.pl
Use IO::Interactive::is_interactive() instead of -t at line 237, column 5. See page 218 of PBP. (Severity: 5)
Two-argument "open" used at line 429, column 2. See page 207 of PBP. (Severity: 5)
Expression form of "eval" at line 1410, column 17. See page 161 of PBP. (Severity: 5)
Expression form of "eval" at line 1412, column 17. See page 161 of PBP. (Severity: 5)

If you read Perl Best Practices you will see why these are issues.
The first is because the test for STDIN and ARGV is not sufficient to check for
interactive usage.

The next is because using quoted two arg open breaks if there is a space in name etc.

Lastly eval of a string leads to runtime errors versus compile time.

Yes, for a trivial program like this it really doesn't matter.
But this program is likely to grow and be copied by other developers
and I would like it to use current best practices. The same applies to
all the other parts of the kernel.

I tested each step, and they all work for meâ
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/