linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] checkpatch: add dedicated checker for 'Fixes:' tag
@ 2020-04-27 14:53 Wang YanQing
  2020-04-27 16:50 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2020-04-27 14:53 UTC (permalink / raw)
  To: joe
  Cc: linux-kernel, kernel-janitors, Alexei Starovoitov,
	Andy Whitcroft, Markus.Elfring

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 this patch adds dedicated checker to fix these issues.

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

 v1-v2:
 1: Reword commit log (Markus Elfring).
 2: Allow more than 12 characters of SHA-1 id (Markus Elfring).
 3: Update the error message according to reflect the second update.
 4: Add missing (?:...).

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 23a001a..d74683a 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 at least 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 v2] checkpatch: add dedicated checker for 'Fixes:' tag
  2020-04-27 14:53 [PATCH v2] checkpatch: add dedicated checker for 'Fixes:' tag Wang YanQing
@ 2020-04-27 16:50 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2020-04-27 16:50 UTC (permalink / raw)
  To: Wang YanQing, Joe Perches
  Cc: linux-kernel, kernel-janitors, Alexei Starovoitov, Andy Whitcroft

> According to submitting-patches.rst, …

I find that the reference to this document can trigger further considerations
also for this evolving change description.


> "
> Do not split the tag across multiple
> lines, tags are exempt from the "wrap at 75 columns" rule in order to simplify
> parsing scripts
> "

Can it be nicer to use typographic quotation characters together with ellipses?


> And the current 'Fixes:' checker in "# Check for git id commit length and
> improperly formed commit descriptions" doesn't check for invalid commit id

Should this “link” refer to a known check name?


> length, so this patch adds dedicated checker to fix these issues.

Would you care to transform this information into an imperative wording?


…
> +++ b/scripts/checkpatch.pl
> @@ -2820,7 +2820,7 @@ sub process {
> -		      $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
> +		      $line !~ /^\s*fixes:\s*(?:[0-9a-f]{6,40})\s*(?:.*)/i))) {

I guess that the clarification around the relevance of word boundaries
will become also more interesting.

Will it become relevant to check if a provided change identification
can actually be resolved to the desired commit?


> @@ -2979,6 +2979,13 @@ sub process {
> +				ERROR("FIXES_TAG",
> +					"please use the 'Fixes:' tag with at least the first 12 characters of the SHA-1 ID, and the one line summary(no across multiple lines)\n" . $herecurr);

* How do you think about to start this message with the word “Please”?

* Is the text “summary(no across” still questionable?

* Will there be a need to explicitly describe the data format
  for the summary specification also at this place?

Regards,
Markus

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 14:53 [PATCH v2] checkpatch: add dedicated checker for 'Fixes:' tag Wang YanQing
2020-04-27 16:50 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).