[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201202202229.120898-1-dwaipayanray1@gmail.com>
Date: Thu, 3 Dec 2020 01:52:29 +0530
From: Dwaipayan Ray <dwaipayanray1@...il.com>
To: joe@...ches.com
Cc: linux-kernel-mentees@...ts.linuxfoundation.org,
dwaipayanray1@...il.com, linux-kernel@...r.kernel.org,
lukas.bulwahn@...il.com, Peilin Ye <yepeilin.cs@...il.com>
Subject: [PATCH v2] checkpatch: add warning for lines starting with a '#' in commit log
Commit log lines starting with a '#' can be dropped by git if
the corresponding commit message is reworded by a maintainer.
This minor error can be easily avoided if checkpatch warns
for the same.
Add a new check which emits a warning on finding lines starting
with a '#'. Also add a quick fix by adding a tab in front of
such lines.
Suggested-by: Peilin Ye <yepeilin.cs@...il.com>
Tested-by: Peilin Ye <yepeilin.cs@...il.com>
Signed-off-by: Dwaipayan Ray <dwaipayanray1@...il.com>
---
Changes in v2:
- Modify warning message and type
- Style fixes
scripts/checkpatch.pl | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e8c1ed0b1fad..eb8b13cf3f40 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2966,6 +2966,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 a '#' will be dropped by git as a comment\n" . $herecurr) &&
+ $fix) {
+ $fixed[$fixlinenr] =~ s/^#/\t#/;
+ }
+ }
+
# 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 &&
--
2.27.0
Powered by blists - more mailing lists