public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/4] get_maintainer script cleanups
Date: Mon, 26 May 2014 18:06:05 -0700	[thread overview]
Message-ID: <20140526180605.1507c79a@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <1401152449.519.41.camel@joe-AO725>

On Mon, 26 May 2014 18:00:49 -0700
Joe Perches <joe@perches.com> 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™ 

      parent reply	other threads:[~2014-05-27  1:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 20:33 [PATCH 0/4] get_maintainer script cleanups Stephen Hemminger
2014-05-26 20:33 ` [PATCH 1/4] get_maintainer: use three argument open Stephen Hemminger
2014-05-26 20:33 ` [PATCH 2/4] get_maintainer: remove quoting on hash label Stephen Hemminger
2014-05-26 20:33 ` [PATCH 3/4] get_maintainer: use array for defining available version control Stephen Hemminger
2014-05-26 20:33 ` [PATCH 4/4] get_maintainer: use anonymous function instead of eval Stephen Hemminger
2014-05-27  1:00 ` [PATCH 0/4] get_maintainer script cleanups Joe Perches
2014-05-27  1:03   ` Joe Perches
2014-05-27  1:09     ` Stephen Hemminger
2014-05-27  1:22     ` [PATCH 5/4] get_maintainer: shut up perl critic Stephen Hemminger
2014-05-27  1:32       ` Joe Perches
2014-05-27 17:00         ` Stephen Hemminger
2014-05-27  1:06   ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140526180605.1507c79a@nehalam.linuxnetplumber.net \
    --to=stephen@networkplumber.org \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox