Message ID | 1353448728.17819.33.camel@joe-AO722 |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
On Tue, Nov 20, 2012 at 01:58:48PM -0800, Joe Perches wrote: > +# check for multiple blank lines, warn only on the second one in a block > + if ($rawline =~ /^.\s*$/ && > + $prevrawline =~ /^.\s*$/ && > + $linenr != $last_blank_linenr + 1) { > + CHK("DOUBLE_EMPTY_LINE", > + "One blank line separating blocks is generally sufficient\n" . $herecurr); > + $last_blank_linenr = $linenr; > + } > + > # check for line continuations in quoted strings with odd counts of " > if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { > WARN("LINE_CONTINUATIONS", Pretty sure that will fail with combination which have removed lines. I have a version here which I am testing with the combinations I have isolated to far ... -apw -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, 2012-11-20 at 23:19 +0000, Andy Whitcroft wrote: > On Tue, Nov 20, 2012 at 01:58:48PM -0800, Joe Perches wrote: > > > +# check for multiple blank lines, warn only on the second one in a block > > + if ($rawline =~ /^.\s*$/ && > > + $prevrawline =~ /^.\s*$/ && > > + $linenr != $last_blank_linenr + 1) { > > + CHK("DOUBLE_EMPTY_LINE", > > + "One blank line separating blocks is generally sufficient\n" . $herecurr); > > + $last_blank_linenr = $linenr; > > + } > > + > > # check for line continuations in quoted strings with odd counts of " > > if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { > > WARN("LINE_CONTINUATIONS", > > Pretty sure that will fail with combination which have removed lines. Not as far as I can tell. Deleted lines followed by inserted lines seem to work OK. This check is located after the test that ensures the current $line/$rawline is an insertion. > I have a version here which I am testing with the combinations I have > isolated to far ... Enjoy. Can you please test my proposal against those combinations too? cheers, Joe -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d2d5ba1..ed4ec9d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1382,6 +1382,7 @@ sub process { my $comment_edge = 0; my $first_line = 0; my $p1_prefix = ''; + my $last_blank_linenr = 0; my $prev_values = 'E'; @@ -3323,6 +3324,15 @@ sub process { "sizeof $1 should be sizeof($1)\n" . $herecurr); } +# check for multiple blank lines, warn only on the second one in a block + if ($rawline =~ /^.\s*$/ && + $prevrawline =~ /^.\s*$/ && + $linenr != $last_blank_linenr + 1) { + CHK("DOUBLE_EMPTY_LINE", + "One blank line separating blocks is generally sufficient\n" . $herecurr); + $last_blank_linenr = $linenr; + } + # check for line continuations in quoted strings with odd counts of " if ($rawline =~ /\\$/ && $rawline =~ tr/"/"/ % 2) { WARN("LINE_CONTINUATIONS",