checkpatch: improve signature check on empty description
PATCH 1/1 checkpatch: improve signature check on empty description
Existing check assumed there could be a single Signed-off-by line which should be ignored when checking for an empty commit message. Other lines with identifiers "Reported-by:", "Acked-by:", or anything invented by the person who constructed the commit were counted as a body of the commit message.
Improve the check for an empty body of the commit message by not counting any lines that begin with a $signature or similar formatted line of a keyword followed by a colon.
Signed-off-by Scott Branden <[email protected]>
--- scripts/checkpatch.pl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
scripts/checkpatch.pl +4 -5
@@ -2901,15 +2901,14 @@ 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 + if ($line !~ /^\s*($|[a-zA-Z0-9_-]+:)/) { + $commit_log_lines++; } - } elsif ($has_commit_log && $commit_log_lines < 2) { + } elsif ($has_commit_log && $commit_log_lines < 1) { WARN("COMMIT_MESSAGE", "Missing commit description - Add an appropriate one\n"); - $commit_log_lines = 2; #warn only once + $commit_log_lines = 1; #warn only once } # Check if the commit log has what seems like a diff which can confuse patch
Signature · 1 line
2.40.0