aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwaipayan Ray <[email protected]>2020-12-15 20:45:18 -0800
committerLinus Torvalds <[email protected]>2020-12-15 22:46:17 -0800
commit084a617acfa08118eafb51a6ef43e6fa4705853d (patch)
tree2ec80eeaf4630bf9fb95767982b1b694f9905286
parent70eb2275ff8e0b4cafe67176674d580c987c071d (diff)
checkpatch: add warning for lines starting with a '#' in commit log
Commit log lines starting with '#' are dropped by git as comments. Add a check to emit a warning for these lines. Also add a --fix option to insert a space before the leading '#' in such lines. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Dwaipayan Ray <[email protected]> Suggested-by: Joe Perches <[email protected]> Suggested-by: Peilin Ye <[email protected]> Tested-by: Peilin Ye <[email protected]> Acked-by: Joe Perches <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rwxr-xr-xscripts/checkpatch.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 2716b9bfc0c2..b7dde7260921 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3033,6 +3033,15 @@ sub process {
$commit_log_possible_stack_dump = 0;
}
+# Check for lines starting with a #
+ if ($in_commit_log && $line =~ /^#/) {
+ if (WARN("COMMIT_COMMENT_SYMBOL",
+ "Commit log lines starting with '#' are dropped by git as comments\n" . $herecurr) &&
+ $fix) {
+ $fixed[$fixlinenr] =~ s/^/ /;
+ }
+ }
+
# Check for git id commit length and improperly formed commit descriptions
if ($in_commit_log && !$commit_log_possible_stack_dump &&
$line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&