diff options
author | Joe Perches <joe@perches.com> | 2014-08-06 19:10:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-06 21:01:27 -0400 |
commit | 365dd4eaafa22d2c79913d5f057d636e8842c470 (patch) | |
tree | 73921bbddacb64cbb5b203cab91d55422bd23dfa /scripts/checkpatch.pl | |
parent | 7f61919144ca69ea29f29c3e60c5b7dbd2070aa6 (diff) |
checkpatch: add a multiple blank lines test
Multiple consecutive blank lines waste screen space. Emit a --strict
only message with these blank lines.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 9e4ba9fa9bc8..fad2116f51a4 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
@@ -1642,6 +1642,8 @@ sub process { | |||
1642 | 1642 | ||
1643 | my $non_utf8_charset = 0; | 1643 | my $non_utf8_charset = 0; |
1644 | 1644 | ||
1645 | my $last_blank_line = 0; | ||
1646 | |||
1645 | our @report = (); | 1647 | our @report = (); |
1646 | our $cnt_lines = 0; | 1648 | our $cnt_lines = 0; |
1647 | our $cnt_error = 0; | 1649 | our $cnt_error = 0; |
@@ -2308,6 +2310,15 @@ sub process { | |||
2308 | "Please use a blank line after function/struct/union/enum declarations\n" . $hereprev); | 2310 | "Please use a blank line after function/struct/union/enum declarations\n" . $hereprev); |
2309 | } | 2311 | } |
2310 | 2312 | ||
2313 | # check for multiple consecutive blank lines | ||
2314 | if ($prevline =~ /^[\+ ]\s*$/ && | ||
2315 | $line =~ /^\+\s*$/ && | ||
2316 | $last_blank_line != ($linenr - 1)) { | ||
2317 | CHK("LINE_SPACING", | ||
2318 | "Please don't use multiple blank lines\n" . $hereprev); | ||
2319 | $last_blank_line = $linenr; | ||
2320 | } | ||
2321 | |||
2311 | # check for missing blank lines after declarations | 2322 | # check for missing blank lines after declarations |
2312 | if ($sline =~ /^\+\s+\S/ && #Not at char 1 | 2323 | if ($sline =~ /^\+\s+\S/ && #Not at char 1 |
2313 | # actual declarations | 2324 | # actual declarations |