All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Edwin van Vliet <edwin@minian.org>
Cc: apw@canonical.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts/checkpatch.pl: added test for repeated lines
Date: Sun, 10 Jul 2011 15:35:28 -0700	[thread overview]
Message-ID: <1310337328.2446.8.camel@Joe-Laptop> (raw)
In-Reply-To: <4E1A0A2F.6050800@minian.org>

On Sun, 2011-07-10 at 22:23 +0200, Edwin van Vliet wrote:
> On 10-7-2011 20:49, Joe Perches wrote:
> > On Sun, 2011-07-10 at 20:18 +0200, Edwin van Vliet wrote:
> >> Repeated lines may indicate a bug or code that needs clarification. If the
> >> repeated line is intentional, an extra comment may be helpful for reviewers
> >> since the repeated pattern is likely to draw attention.
> > []
> >> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > []
> >> @@ -1479,6 +1479,11 @@ sub process {
> >> +# check for repeated lines which may indicate bugs or lack of clarity
> >> +		if ($rawline eq $prevrawline) {
> >> +			WARN("repeated line\n" . $herecurr);
> >> +		}
> >> +
> > Interest concept, but I think it needs to check for
> > comment lines and blank lines and such.
> > Also, there are uses of appropriate multiple close braces
> > on consecutive lines like:
> > 	switch (foo) {
> > 	case bar: {
> > 		etc...
> > 	}
> > 	}
[]
> You might be correct about empty lines and comment lines, but there are
> actually very few reasons to have a repeated line.
[]
> Repeated lines draw (my) attention, and are likely to confuse.

I don't disagree, I just think your patch needs to handle
some obvious exceptions.

> Do you reckon this test would lead to programmers trying to "fool" the
> test and actually insert extra tabs to work around it?

No.

> If the final goal of the checkpatch.pl script is for the entire kernel
> source code to not generate any warnings at all,

It's not.

> I understand your concerns and agree this might need a little testing

and expanding and improving.

[]
> Sure, double #endif's and closing brackets will cause a warning, quite a
> number of false positives are inevitable.

Not if your patch handles them appropriately.
Maybe use both CHK and WARN.

> But it will hopefully help to
> prevent or spot errors too, and it might lead to better documentation of
> certain routines as well.

True.  But don't expect me to ack or add a sign-off to
a patch that has obvious defects or doesn't do the
thing it purports to do well.

cheers, Joe


      reply	other threads:[~2011-07-10 22:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-10 18:18 [PATCH] scripts/checkpatch.pl: added test for repeated lines Edwin van Vliet
2011-07-10 18:49 ` Joe Perches
2011-07-10 20:23   ` Edwin van Vliet
2011-07-10 22:35     ` Joe Perches [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=1310337328.2446.8.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=edwin@minian.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.