Skip to contentSkip to conversation

checkpatch: disable commit log length check warning for signature tag

PATCH Superseded Nachiket Naganure 3 participants 6 messages Jul 27, 2020 – Jul 28, 2020 Checkpatch

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: disable commit log length check warning for signature tag

Disable commit log length check in case of signature tag. If the commit log line has valid signature tags such as "Reported-and-tested-by" with more than 75 characters, suppress the long length warning.

For instance in commit ac854131d984 ("USB: core: Fix misleading driver bug report"), the corresponding patch contains a "Reported by" tag line which exceeds 75 chars. And there is no valid way to shorten the length.

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)
scripts/checkpatch.pl +2 -0
index 197436b20288..46237e9e0550 100755
@@ -2806,6 +2806,8 @@ sub process {
 					# filename then :
 		      $line =~ /^\s*(?:Fixes:|Link:)/i ||
 					# A Fixes: or Link: line
+		      $line =~ /$signature_tags/ ||
+					# Check for signature_tags
 		      $commit_log_possible_stack_dump)) {
 			WARN("COMMIT_LOG_LONG_LINE",
 			     "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 18 lines · Nachiket Naganure

Disable commit log length check in case of signature tag. If the commit log line has valid signature tags such as "Reported-and-tested-by" with more than 75 characters, suppress the long length warning.

For instance in commit ac854131d984 ("USB: core: Fix misleading driver bug report"), the corresponding patch contains a "Reported by" tag line which exceeds 75 chars. And there is no valid way to shorten the length.

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)
scripts/checkpatch.pl +0 -0
index 197436b20288..46237e9e0550 100755

scripts/checkpatch.pl sub process { · line 2813

Quoted 8 lines
scripts/checkpatch.pl +2 -0
@@ -2806,6 +2806,8 @@ sub process {
 					# filename then :
 		      $line =~ /^\s*(?:Fixes:|Link:)/i ||
 					# A Fixes: or Link: line
+		      $line =~ /$signature_tags/ ||
+					# Check for signature_tags
 		      $commit_log_possible_stack_dump)) {
 			WARN("COMMIT_LOG_LONG_LINE",
 			     "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);

OK, but the test should be:

		      $line =~ /^\s*$signature_tags/ ||

so the line has to start with a signature and
it won't match on signature tags in the middle
of other content on the same line.

#2 lore raw
Quoted 30 lines · Joe Perches
Quoted 18 lines · Nachiket Naganure

Disable commit log length check in case of signature tag. If the commit log line has valid signature tags such as "Reported-and-tested-by" with more than 75 characters, suppress the long length warning.

For instance in commit ac854131d984 ("USB: core: Fix misleading driver bug report"), the corresponding patch contains a "Reported by" tag line which exceeds 75 chars. And there is no valid way to shorten the length.

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)
scripts/checkpatch.pl +0 -0
index 197436b20288..46237e9e0550 100755

scripts/checkpatch.pl sub process { · line 2813

Quoted 8 lines
scripts/checkpatch.pl +2 -0
@@ -2806,6 +2806,8 @@ sub process {
 					# filename then :
 		      $line =~ /^\s*(?:Fixes:|Link:)/i ||
 					# A Fixes: or Link: line
+		      $line =~ /$signature_tags/ ||
+					# Check for signature_tags
 		      $commit_log_possible_stack_dump)) {
 			WARN("COMMIT_LOG_LONG_LINE",
 			     "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);

OK, but the test should be:

Quoted 7 lines
		      $line =~ /^\s*$signature_tags/ ||

so the line has to start with a signature and
it won't match on signature tags in the middle
of other content on the same line.

But the suggested won't work in case of merged signatures. Such as "Reported-and-tested-by: [email protected]"

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#3 lore raw
Quoted 33 lines · Nachiket Naganure
Quoted 32 lines · Joe Perches
Quoted 18 lines · Nachiket Naganure

Disable commit log length check in case of signature tag. If the commit log line has valid signature tags such as "Reported-and-tested-by" with more than 75 characters, suppress the long length warning.

For instance in commit ac854131d984 ("USB: core: Fix misleading driver bug report"), the corresponding patch contains a "Reported by" tag line which exceeds 75 chars. And there is no valid way to shorten the length.

---
 scripts/checkpatch.pl | 2 ++
 1 file changed, 2 insertions(+)
scripts/checkpatch.pl +0 -0
index 197436b20288..46237e9e0550 100755

scripts/checkpatch.pl sub process { · line 2813

Quoted 8 lines
scripts/checkpatch.pl +2 -0
@@ -2806,6 +2806,8 @@ sub process {
 					# filename then :
 		      $line =~ /^\s*(?:Fixes:|Link:)/i ||
 					# A Fixes: or Link: line
+		      $line =~ /$signature_tags/ ||
+					# Check for signature_tags
 		      $commit_log_possible_stack_dump)) {
 			WARN("COMMIT_LOG_LONG_LINE",
 			     "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);

OK, but the test should be:

		      $line =~ /^\s*$signature_tags/ ||
Quoted 8 lines
Quoted 5 lines

so the line has to start with a signature and
it won't match on signature tags in the middle
of other content on the same line.

But the suggested won't work in case of merged signatures. Such as "Reported-and-tested-by: [email protected]"

But Joe's remark is valid; we do not want to match on signature tags in the middle. These cases are probably mentioning signature tags as part of a sentence or some explanation.

Nachiket, think about a proper solution for this issue.

The evaluation data from running checkpatch.pl on previous commits will provide you some guidance on which heuristics might work and which not.

Lukas

maintainer
#4 lore raw
Quoted 3 lines · Lukas Bulwahn
Quoted 2 lines · Nachiket Naganure
Quoted 1 line · Joe Perches

On Mon, 2020-07-27 at 11:24 +0530, Nachiket Naganure wrote:

[]

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

OK, but the test should be:

		      $line =~ /^\s*$signature_tags/ ||

so the line has to start with a signature and
it won't match on signature tags in the middle
of other content on the same line.

Quoted 8 lines
Quoted 3 lines

But the suggested won't work in case of merged signatures. Such as "Reported-and-tested-by: [email protected]"

But Joe's remark is valid; we do not want to match on signature tags in the middle. These cases are probably mentioning signature tags as part of a sentence or some explanation.

Nachiket, think about a proper solution for this issue.

Mostly the problem doesn't occur very often and likely isn't worth much effort.

Combinations aren't common in git logs and arbitrary combinatorial logic isn't trivial.

For the last million commits, only ~3000 have any combination and almost all of those are Reported-and-tested-by:

Likely that could be added to $signature_tags and the problem just ignored.

I'd still exempt signature lines from line length limits.

$ git log -1000000 --no-merges --format=email | \
  grep -P "^[\w_-]+-by:" | cut -f1 -d":" | \
  sort | uniq -c | sort -rn | cat -n | grep -i and
     7	   2159 Reported-and-tested-by
    11	    255 Reported-and-Tested-by
    12	    203 Reviewed-and-tested-by
    13	    132 Reviewed-and-Tested-by
    22	     68 Reported-and-bisected-by
    31	     44 Acked-and-tested-by
    40	     21 Tested-and-Acked-by
    41	     20 Tested-and-acked-by
    42	     20 Reported-bisected-and-tested-by
    49	     17 Suggested-and-Acked-by
    50	     16 Tested-and-reported-by
    51	     16 Acked-and-Tested-by
    52	     15 Suggested-and-Tested-by
    53	     15 Suggested-and-acked-by
    56	     14 Tested-and-reviewed-by
    58	     13 Tested-and-Reviewed-by
    61	     12 Reported-and-acked-by
    62	     11 Reported-and-debugged-by
    65	     10 Reported-and-Acked-by
    73	      8 Suggested-and-reviewed-by
    76	      8 Reported-and-suggested-by
    77	      8 Reported-and-analyzed-by
    79	      8 Bisected-and-tested-by
    81	      7 Requested-and-tested-by
    82	      7 Reported-and-reviewed-by
    91	      6 Bisected-and-reported-by
   104	      4 Tested-and-Reported-by
   111	      4 Requested-and-Tested-by
   125	      3 Reported-by-and-Tested-by
   127	      3 Reported-And-Tested-by
   128	      3 Reported-and-requested-by
   155	      2 Suggested-and-tested-by
   166	      2 Reported-tested-and-acked-by
   169	      2 Reported-and-Suggested-by
   170	      2 Reported-and-by
   201	      2 Debugged-and-tested-by
   232	      1 Tested-by-and-Reviewed-by
   234	      1 Tested-And-Reviewed-by
   235	      1 Tested-and-requested-by
   236	      1 Tested-and-bugfixed-by
   245	      1 Suggested-and-Reviewed-by
   265	      1 Signed-off-and-morning-tea-spilled-by
   284	      1 Reviewed-and-wanted-by
   285	      1 Reviewed-and-discussed-by
   286	      1 Reviewed-and-Acked-by
   287	      1 Reviewed-and-acked-by
   294	      1 Requested-and-debugged-by
   295	      1 Requested-and-Acked-by
   296	      1 Requested-and-acked-by
   301	      1 Reportedy-and-tested-by
   303	      1 Reported-tested-and-fixed-by
   304	      1 Reported-tested-and-bisected-by
   305	      1 Reported-Reviewed-and-Acked-by
   306	      1 Reported-requested-and-tested-by
   312	      1 Reported-by-and-tested-by
   313	      1 Reported-Bistected-and-Tested-by
   316	      1 Reported-and_tested-by
   317	      1 Reported-and-Tested-and-Reviewed-by
   318	      1 Reported-and-tested-and-reviewed-by
   319	      1 Reported-and-test-by
   320	      1 Reported-and-root-caused-by
   321	      1 Reported-and-Reviwed-by
   322	      1 Reported-and-reviwed-by
   323	      1 Reported-and-Reviewed-by
   324	      1 Reported-and-Reviewed-and-Tested-by
   325	      1 Reported-and-isolated-by
   326	      1 Reported-and-introduced-by
   327	      1 Reported-and-Inspired-by
   328	      1 Reported-and-helped-by
   329	      1 Reported-and-fixed-by
   330	      1 Reported-and-diagnosed-by
   331	      1 Reported-and-Debugged-by
   332	      1 Reported--and-debugged-by
   333	      1 Reported-and-compile-tested-by
   334	      1 Reported-and-Bisected-by
   335	      1 Reported-and-Bisected-and-Tested-by
   336	      1 Reported-and-bisected_and_tested-by
   337	      1 Reported-and-bisected-and-tested-by
   338	      1 Reported-and-argued-for-by
   339	      1 Reported-analyzed-and-tested-by
   340	      1 Reported-Acked-and-Tested-by
   343	      1 Report-and-tested-by
   344	      1 Reporeted-and-tested-by
   345	      1 Repored-and-bisected-by
   355	      1 Pointed-out-and-tested-by
   377	      1 Original-Idea-and-Signed-off-by
   383	      1 Noticed-and-Acked-by
   396	      1 Modified-and-reviewed-by
   434	      1 Fix-creation-mandated-by
   451	      1 Discovered-and-analyzed-by
   452	      1 Diagnosed-and-Reported-by
   456	      1 Demanded-by
   460	      1 Debugged-and-analyzed-by
   461	      1 Debugged-and-acked-by
   462	      1 Cut-and-paste-bug-by
   475	      1 Catched-by-and-rightfully-ranted-at-by
   484	      1 Bitten-by-and-tested-by
   485	      1 Bisected-reported-and-tested-by
   486	      1 Bisected-and-requested-by
   487	      1 Bisected-and-Reported-by
   488	      1 Bisected-and-acked-by
   489	      1 Binary file (standard input) matches
   505	      1 Analyzed-and-acked-by
   509	      1 Also-reported-and-tested-by
   525	      1 Acked-by-and-tested-by
   527	      1 Acked-and-reviewed-by
   528	      1 Acked-and-mourned-by
   529	      1 Acked-and-documention-added-by
   530	      1 Acked-and-appreciated-by
#5 lore raw
Quoted 141 lines · Joe Perches
Quoted 3 lines · Lukas Bulwahn
Quoted 2 lines · Nachiket Naganure
Quoted 1 line · Joe Perches

On Mon, 2020-07-27 at 11:24 +0530, Nachiket Naganure wrote:

[]

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

OK, but the test should be:

		      $line =~ /^\s*$signature_tags/ ||

so the line has to start with a signature and
it won't match on signature tags in the middle
of other content on the same line.

Quoted 8 lines
Quoted 3 lines

But the suggested won't work in case of merged signatures. Such as "Reported-and-tested-by: [email protected]"

But Joe's remark is valid; we do not want to match on signature tags in the middle. These cases are probably mentioning signature tags as part of a sentence or some explanation.

Nachiket, think about a proper solution for this issue.

Mostly the problem doesn't occur very often and likely isn't worth much effort.

Combinations aren't common in git logs and arbitrary combinatorial logic isn't trivial.

For the last million commits, only ~3000 have any combination and almost all of those are Reported-and-tested-by:

Likely that could be added to $signature_tags and the problem just ignored.

I'd still exempt signature lines from line length limits.

$ git log -1000000 --no-merges --format=email | \
  grep -P "^[\w_-]+-by:" | cut -f1 -d":" | \
  sort | uniq -c | sort -rn | cat -n | grep -i and
     7	   2159 Reported-and-tested-by
    11	    255 Reported-and-Tested-by
    12	    203 Reviewed-and-tested-by
    13	    132 Reviewed-and-Tested-by
    22	     68 Reported-and-bisected-by
    31	     44 Acked-and-tested-by
    40	     21 Tested-and-Acked-by
    41	     20 Tested-and-acked-by
    42	     20 Reported-bisected-and-tested-by
    49	     17 Suggested-and-Acked-by
    50	     16 Tested-and-reported-by
    51	     16 Acked-and-Tested-by
    52	     15 Suggested-and-Tested-by
    53	     15 Suggested-and-acked-by
    56	     14 Tested-and-reviewed-by
    58	     13 Tested-and-Reviewed-by
    61	     12 Reported-and-acked-by
    62	     11 Reported-and-debugged-by
    65	     10 Reported-and-Acked-by
    73	      8 Suggested-and-reviewed-by
    76	      8 Reported-and-suggested-by
    77	      8 Reported-and-analyzed-by
    79	      8 Bisected-and-tested-by
    81	      7 Requested-and-tested-by
    82	      7 Reported-and-reviewed-by
    91	      6 Bisected-and-reported-by
   104	      4 Tested-and-Reported-by
   111	      4 Requested-and-Tested-by
   125	      3 Reported-by-and-Tested-by
   127	      3 Reported-And-Tested-by
   128	      3 Reported-and-requested-by
   155	      2 Suggested-and-tested-by
   166	      2 Reported-tested-and-acked-by
   169	      2 Reported-and-Suggested-by
   170	      2 Reported-and-by
   201	      2 Debugged-and-tested-by
   232	      1 Tested-by-and-Reviewed-by
   234	      1 Tested-And-Reviewed-by
   235	      1 Tested-and-requested-by
   236	      1 Tested-and-bugfixed-by
   245	      1 Suggested-and-Reviewed-by
   265	      1 Signed-off-and-morning-tea-spilled-by
   284	      1 Reviewed-and-wanted-by
   285	      1 Reviewed-and-discussed-by
   286	      1 Reviewed-and-Acked-by
   287	      1 Reviewed-and-acked-by
   294	      1 Requested-and-debugged-by
   295	      1 Requested-and-Acked-by
   296	      1 Requested-and-acked-by
   301	      1 Reportedy-and-tested-by
   303	      1 Reported-tested-and-fixed-by
   304	      1 Reported-tested-and-bisected-by
   305	      1 Reported-Reviewed-and-Acked-by
   306	      1 Reported-requested-and-tested-by
   312	      1 Reported-by-and-tested-by
   313	      1 Reported-Bistected-and-Tested-by
   316	      1 Reported-and_tested-by
   317	      1 Reported-and-Tested-and-Reviewed-by
   318	      1 Reported-and-tested-and-reviewed-by
   319	      1 Reported-and-test-by
   320	      1 Reported-and-root-caused-by
   321	      1 Reported-and-Reviwed-by
   322	      1 Reported-and-reviwed-by
   323	      1 Reported-and-Reviewed-by
   324	      1 Reported-and-Reviewed-and-Tested-by
   325	      1 Reported-and-isolated-by
   326	      1 Reported-and-introduced-by
   327	      1 Reported-and-Inspired-by
   328	      1 Reported-and-helped-by
   329	      1 Reported-and-fixed-by
   330	      1 Reported-and-diagnosed-by
   331	      1 Reported-and-Debugged-by
   332	      1 Reported--and-debugged-by
   333	      1 Reported-and-compile-tested-by
   334	      1 Reported-and-Bisected-by
   335	      1 Reported-and-Bisected-and-Tested-by
   336	      1 Reported-and-bisected_and_tested-by
   337	      1 Reported-and-bisected-and-tested-by
   338	      1 Reported-and-argued-for-by
   339	      1 Reported-analyzed-and-tested-by
   340	      1 Reported-Acked-and-Tested-by
   343	      1 Report-and-tested-by
   344	      1 Reporeted-and-tested-by
   345	      1 Repored-and-bisected-by
   355	      1 Pointed-out-and-tested-by
   377	      1 Original-Idea-and-Signed-off-by
   383	      1 Noticed-and-Acked-by
   396	      1 Modified-and-reviewed-by
   434	      1 Fix-creation-mandated-by
   451	      1 Discovered-and-analyzed-by
   452	      1 Diagnosed-and-Reported-by
   456	      1 Demanded-by
   460	      1 Debugged-and-analyzed-by
   461	      1 Debugged-and-acked-by
   462	      1 Cut-and-paste-bug-by
   475	      1 Catched-by-and-rightfully-ranted-at-by
   484	      1 Bitten-by-and-tested-by
   485	      1 Bisected-reported-and-tested-by
   486	      1 Bisected-and-requested-by
   487	      1 Bisected-and-Reported-by
   488	      1 Bisected-and-acked-by
Quoted 9 lines
   489	      1 Binary file (standard input) matches
   505	      1 Analyzed-and-acked-by
   509	      1 Also-reported-and-tested-by
   525	      1 Acked-by-and-tested-by
   527	      1 Acked-and-reviewed-by
   528	      1 Acked-and-mourned-by
   529	      1 Acked-and-documention-added-by
   530	      1 Acked-and-appreciated-by

Thank you for the analysis. I think, I will send a new patch for the modification that Joe suggested for now. Looking at the commits there are tags(Bisected-,Discovered-,etc) which are not stored in the $signature_tags. So I will keep the combination problem aside for now.