mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-30 11:04:25 +00:00
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>
This commit is contained in:
parent
7f61919144
commit
365dd4eaaf
1 changed files with 11 additions and 0 deletions
|
@ -1642,6 +1642,8 @@ sub process {
|
||||||
|
|
||||||
my $non_utf8_charset = 0;
|
my $non_utf8_charset = 0;
|
||||||
|
|
||||||
|
my $last_blank_line = 0;
|
||||||
|
|
||||||
our @report = ();
|
our @report = ();
|
||||||
our $cnt_lines = 0;
|
our $cnt_lines = 0;
|
||||||
our $cnt_error = 0;
|
our $cnt_error = 0;
|
||||||
|
@ -2308,6 +2310,15 @@ sub process {
|
||||||
"Please use a blank line after function/struct/union/enum declarations\n" . $hereprev);
|
"Please use a blank line after function/struct/union/enum declarations\n" . $hereprev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# check for multiple consecutive blank lines
|
||||||
|
if ($prevline =~ /^[\+ ]\s*$/ &&
|
||||||
|
$line =~ /^\+\s*$/ &&
|
||||||
|
$last_blank_line != ($linenr - 1)) {
|
||||||
|
CHK("LINE_SPACING",
|
||||||
|
"Please don't use multiple blank lines\n" . $hereprev);
|
||||||
|
$last_blank_line = $linenr;
|
||||||
|
}
|
||||||
|
|
||||||
# check for missing blank lines after declarations
|
# check for missing blank lines after declarations
|
||||||
if ($sline =~ /^\+\s+\S/ && #Not at char 1
|
if ($sline =~ /^\+\s+\S/ && #Not at char 1
|
||||||
# actual declarations
|
# actual declarations
|
||||||
|
|
Loading…
Add table
Reference in a new issue