netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] checkpatch: add double empty line check
@ 2012-11-17 11:17 Eilon Greenstein
  2012-11-20 11:52 ` Andy Whitcroft
  0 siblings, 1 reply; 21+ messages in thread
From: Eilon Greenstein @ 2012-11-17 11:17 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: Joe Perches, David Rientjes, linux-kernel, netdev

Changes from previous attempt:
- Use CHK instead of WARN
- Issue only one warning per empty lines block

Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
 scripts/checkpatch.pl |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 21a9f5d..13d264f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3579,6 +3579,14 @@ sub process {
 			WARN("EXPORTED_WORLD_WRITABLE",
 			     "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
 		}
+
+# check for double empty lines
+		if ($line =~ /^\+\s*$/ &&
+		    ($rawlines[$linenr] =~ /^\s*$/ ||
+		     $prevline =~ /^\+?\s*$/ && $rawlines[$linenr] !~ /^\+\s*$/)) {
+			CHK("DOUBLE_EMPTY_LINE",
+			    "One empty line should be sufficient. Consider removing this one.\n" . $herecurr);
+		}
 	}
 
 	# If we have no input at all, then there is nothing to report on
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2012-11-21 15:45 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-17 11:17 [PATCH v2] checkpatch: add double empty line check Eilon Greenstein
2012-11-20 11:52 ` Andy Whitcroft
2012-11-20 14:27   ` Eilon Greenstein
2012-11-20 14:43     ` Andy Whitcroft
2012-11-20 15:07       ` Eilon Greenstein
2012-11-20 15:44         ` Andy Whitcroft
2012-11-20 16:06           ` Eilon Greenstein
2012-11-20 16:14             ` Andy Whitcroft
2012-11-20 16:22               ` Eilon Greenstein
2012-11-20 16:36                 ` Andy Whitcroft
2012-11-20 16:36               ` Andy Whitcroft
2012-11-20 19:10                 ` Eilon Greenstein
2012-11-20 19:32                   ` Andy Whitcroft
2012-11-20 20:11                     ` Andy Whitcroft
2012-11-20 20:26                       ` Eilon Greenstein
2012-11-20 21:58   ` Joe Perches
2012-11-20 23:19     ` Andy Whitcroft
2012-11-20 23:41       ` Joe Perches
2012-11-21  9:42         ` Eilon Greenstein
2012-11-21 15:01           ` Joe Perches
2012-11-21 15:45             ` Eilon Greenstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).