summaryrefslogtreecommitdiff
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:57:21 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:57:21 -0700
commit7461a98690fe9c31f5f25369cbfc95bc19838923 (patch)
treee2ca476e892447fbca65e8994fe280e321c0f294 /scripts/checkpatch.pl
parentacdce035166c30759ef0c0eadd9f639dc5de3259 (diff)
checkpatch: warn on subject line not followed by blank line
Fixed case when no warning generated for long subject line that is wrapped to more than one line, and all lines are less than line limit. New warning message added: "non-blank line after summary line" Now there are two warnings possible for the subject line, the original line over limit and the new one. Depending on the error(s) any combination of the two warnings are possible. Commit text requirements now: 1) Must be less than 75 characters 2) Must be followed by blank line. Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl18
1 files changed, 17 insertions, 1 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 395e4818b5f8..9734862a2e8a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -14,6 +14,7 @@ use Term::ANSIColor qw(:constants);
use constant BEFORE_SHORTTEXT => 0;
use constant IN_SHORTTEXT => 1;
use constant AFTER_SHORTTEXT => 2;
+use constant CHECK_NEXT_SHORTTEXT => 3;
use constant SHORTTEXT_LIMIT => 75;
my $P = $0;
@@ -1982,6 +1983,8 @@ sub process {
my $prevrawline="";
my $stashline="";
my $stashrawline="";
+ my $subjectline="";
+ my $sublinenr="";
my $length;
my $indent;
@@ -2243,8 +2246,21 @@ sub process {
SHORTTEXT_LIMIT .
" characters\n" . $herecurr);
}
- } elsif ($line=~/^Subject: \[[^\]]*\] (.*)/) {
+ } elsif ($shorttext == CHECK_NEXT_SHORTTEXT) {
$shorttext = IN_SHORTTEXT;
+# Check for Subject line followed by a blank line.
+ if (length($line) != 0) {
+ WARN("NONBLANK_AFTER_SUMMARY",
+ "non-blank line after summary " .
+ "line\n" . $sublinenr . $here .
+ "\n" . $subjectline . "\n" .
+ $line . "\n");
+ }
+ } elsif ($line=~/^Subject: \[[^\]]*\] (.*)/) {
+ $shorttext = CHECK_NEXT_SHORTTEXT;
+ $subjectline = $line;
+ $sublinenr = "#$linenr & ";
+# Check for Subject line less than line limit
if (length($1) > SHORTTEXT_LIMIT) {
WARN("LONG_SUMMARY_LINE",
"summary line over " .