public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: add dedicated checker for 'Fixes:' tag
@ 2020-04-27 13:15 Wang YanQing
  0 siblings, 0 replies; 2+ messages in thread
From: Wang YanQing @ 2020-04-27 13:15 UTC (permalink / raw)
  To: joe; +Cc: apw, alexei.starovoitov, linux-kernel

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.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 scripts/checkpatch.pl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 23a001a..fbb31bc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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 =~ /^-/);
 
-- 
1.8.5.6.2.g3d8a54e.dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] checkpatch: add dedicated checker for 'Fixes:' tag
@ 2020-04-27 14:00 Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2020-04-27 14:00 UTC (permalink / raw)
  To: Wang YanQing, Joe Perches
  Cc: linux-kernel, kernel-janitors, Alexei Starovoitov, Andy Whitcroft

> length, so I think it is better to add dedicated checker for 'Fixes:' TAG.

I suggest to reconsider also this wording once more.


…
> +++ b/scripts/checkpatch.pl
> @@ -2820,7 +2820,7 @@ sub process {
> +				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);

* Would you like to take another information better into account?
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=6a8b55ed4056ea5559ebe4f6a4b247f627870d4c#n177

  “…
  You should also be sure to use at least the first twelve characters …
  …”

* Is the information questionable also from the parenthesised text
  in the error message from the Perl code?

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-27 14:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27 13:15 [PATCH] checkpatch: add dedicated checker for 'Fixes:' tag Wang YanQing
  -- strict thread matches above, loose matches on Subject: below --
2020-04-27 14:00 Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox