Thread (21 messages) flat view 21 messages, 3 authors, 2012-11-21

Re: [PATCH v2] checkpatch: add double empty line check

From: Joe Perches <joe@perches.com>
Date: 2012-11-20 23:41:16
Also in: lkml

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:
quoted
+# 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help