public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@canonical.com>
To: Joe Perches <joe@perches.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] checkpatch: remove false warning for commit reference
Date: Mon, 24 Oct 2016 19:46:23 +0100	[thread overview]
Message-ID: <20161024184623.rfhlx337xvynydcr@brain> (raw)
In-Reply-To: <1477334385.1984.9.camel@perches.com>

On Mon, Oct 24, 2016 at 11:39:45AM -0700, Joe Perches wrote:
> On Mon, 2016-10-24 at 19:22 +0200, Heinrich Schuchardt wrote:
> > On 10/23/2016 10:37 PM, Joe Perches wrote:
> > > On Sun, 2016-10-23 at 09:34 +0200, Heinrich Schuchardt wrote:
> > > > Checkpatch warns of an incorrect commit reference style
> > > > for any hexadecimal number of 12 digits and more.
> > > > 
> > > > Numbers of 12 digits are not necessarily commit ids.
> > > > 
> > > > For an example provoking the problem see
> > > > https://patchwork.kernel.org/patch/9170897/
> > > > 
> > > > Checkpatch should only warn if the number refers to an
> > > > existing commit.
> > > 
> > > That seems sensible.
> > > 
> > > > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> > > > ---
> > > >  scripts/checkpatch.pl | 5 ++++-
> > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > 
> > > []
> > > > @@ -848,6 +848,7 @@ sub git_commit_info {
> > > >  #		    echo "commit $(cut -c 1-12,41-)"
> > > >  #		done
> > > >  	} elsif ($lines[0] =~ /^fatal: ambiguous argument '$commit': unknown revision or path not in the working tree\./) {
> > > > +		$id = undef;
> > > 
> > > OK
> > > 
> > > >  	} else {
> > > >  		$id = substr($lines[0], 0, 12);
> > > >  		$desc = substr($lines[0], 41);
> > > > @@ -2577,7 +2578,9 @@ sub process {
> > > >  			($id, $description) = git_commit_info($orig_commit,
> > > >  							      $id, $orig_desc);
> > > >  
> > > > -			if ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens) {
> > > > +			if ($id && ($short || $long || $space || $case
> > > > +				|| ($orig_desc ne $description)
> > > > +				|| !$hasparens)) {
> > > 
> > > I'd prefer
> > > 			if (defined($id) &&
> > 
> > For $id = 0 or $id = "" this would make a difference.
> > Surely I can update the patch like this to make the test more readable.
> > 
> > > 			   ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
> > > 
> > > and not wrap the tests.
> > 
> > Putting defined($id) on a line of its own is fine.
> > 
> > Not wrapping the tests will produce a line of over 80 characters and
> > give a warning in scripts/checkpatch.pl.
> > 
> > The script should respect the standards it imposes on others.
> 
> Nope.
> 
> I never bother using checkpatch on checkpatch.
> perl is unreadable enough with having to wrap long and
> complex regexes on 80 columns.

More specifically checkpatch is primarily checking C language construction
to keep the style of the Linux kernel consistent.  The rules were never
really intended to apply to perl or other languages.  We have long leant
towards longer lines in checkpatch for some kind of readability, as much
as you can have in "systactic sugar overload" language.

-apw

  reply	other threads:[~2016-10-24 18:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-11  1:26 [BUG] False positive in scripts/checkpatch.pl Heinrich Schuchardt
2016-10-23  7:34 ` [PATCH 1/1] checkpatch: remove false warning for commit reference Heinrich Schuchardt
2016-10-23 20:37   ` Joe Perches
2016-10-24 17:22     ` Heinrich Schuchardt
2016-10-24 18:39       ` Joe Perches
2016-10-24 18:46         ` Andy Whitcroft [this message]
2016-10-24 20:17           ` [PATCH] checkpatch: Don't check .pl files, improve absolute path commit log test Joe Perches
2017-06-07 18:40     ` [PATCH 1/1 v2] checkpatch: remove false warning for commit reference Heinrich Schuchardt
2017-06-07 18:56       ` Joe Perches

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=20161024184623.rfhlx337xvynydcr@brain \
    --to=apw@canonical.com \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xypron.glpk@gmx.de \
    /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