aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <[email protected]>2018-08-21 21:58:01 -0700
committerLinus Torvalds <[email protected]>2018-08-22 10:52:48 -0700
commit490b292c834c5e72057f4315ef915692cbd6defd (patch)
tree2496c8136da8dcb065f3825722cbac3a15ac4bfe /scripts
parent60f890105547f7a48ea1d67c5ae69966c7245b23 (diff)
checkpatch: warn when a patch doesn't have a description
Potential patches should have a commit description. Emit a warning when there isn't one. [[email protected]: s/else if/elsif/] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Joe Perches <[email protected]> Suggested-by: Prakruthi Deepak Heragu <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b5eade941f4a..25adf9811a2c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2253,6 +2253,7 @@ sub process {
my $in_header_lines = $file ? 0 : 1;
my $in_commit_log = 0; #Scanning lines before patch
my $has_commit_log = 0; #Encountered lines before patch
+ my $commit_log_lines = 0; #Number of commit log lines
my $commit_log_possible_stack_dump = 0;
my $commit_log_long_line = 0;
my $commit_log_has_diff = 0;
@@ -2510,6 +2511,18 @@ sub process {
$cnt_lines++ if ($realcnt != 0);
+# Verify the existence of a commit log if appropriate
+# 2 is used because a $signature is counted in $commit_log_lines
+ if ($in_commit_log) {
+ if ($line !~ /^\s*$/) {
+ $commit_log_lines++; #could be a $signature
+ }
+ } elsif ($has_commit_log && $commit_log_lines < 2) {
+ WARN("COMMIT_MESSAGE",
+ "Missing commit description - Add an appropriate one\n");
+ $commit_log_lines = 2; #warn only once
+ }
+
# Check if the commit log has what seems like a diff which can confuse patch
if ($in_commit_log && !$commit_log_has_diff &&
(($line =~ m@^\s+diff\b.*a/[\w/]+@ &&