Skip to contentSkip to conversation

checkpatch: add dedicated checker for 'Fixes:' tag

PATCH Superseded Wang YanQing 1 participant 1 message Apr 27, 2020 Checkpatch

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: add dedicated checker for 'Fixes:' tag

According to submitting-patches.rst, 'Fixes:' tag has a little stricter condition about the one line summary:
"
Do not split the tag across multiple
lines, tags are exempt from the "wrap at 75 columns" rule in order to simplify parsing scripts
"

And the current 'Fixes:' checker in "# Check for git id commit length and improperly formed commit descriptions" doesn't check for invalid commit id length, so I think it is better to add dedicated checker for 'Fixes:' TAG.

---
 scripts/checkpatch.pl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
scripts/checkpatch.pl +8 -1
index 23a001a..fbb31bc 100755
@@ -2820,7 +2820,7 @@ sub process {
 		    ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
 		     ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
 		      $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
-		      $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
+		      $line !~ /^\s*fixes:\s*([0-9a-f]{6,40})\s*(.*)/i))) {
 			my $init_char = "c";
 			my $orig_commit = "";
 			my $short = 1;
@@ -2979,6 +2979,13 @@ sub process {
 			}
 		}
 
+		if ($in_commit_log && $line =~ /^\s*fixes:\s*([0-9a-f]{6,40})\s*(.*)/i) {
+		    if (length($1) != 12 || $2 !~ /^\(\"(.*)\"\)$/i) {
+				ERROR("FIXES_TAG",
+					"please use the 'Fixes:' tag with the first 12 characters of the SHA-1 ID, and the one line summary(no across multiple lines)\n" . $herecurr);
+			}
+		}
+
 # ignore non-hunk lines and lines being removed
 		next if (!$hunk_line || $line =~ /^-/);
 
Signature · 1 line
1.8.5.6.2.g3d8a54e.dirty