All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: add support for title acrosses three lines in commit id description
@ 2020-05-03 12:34 ` Wang YanQing
  0 siblings, 0 replies; 6+ messages in thread
From: Wang YanQing @ 2020-05-03 12:34 UTC (permalink / raw)
  To: joe
  Cc: Andy Whitcroft, linux-kernel, Alexei Starovoitov, Matteo Croce,
	Markus.Elfring, kernel-janitors

The current GIT_COMMIT_ID will report error when the title in commit id
description acrosses three lines, take changelog of commit 87b0f983f66f
("net: mscc: ocelot: fix untagged packet drops when enslaving to vlan
aware bridge") as a example.

It make senses to support three lines title, because three lines could only
have about two lines length title, see above example, but I think we don't
need to add support for more than three lines length title, ~225 (75 * 3)
shoud be enough for any sensible title.

This patch adds support for three lines title in the commit id description,
and emit diagnostics info when the title acrosses more than three lines.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 Hi! Joe
 This is the third patch based on previous two patches.

 Thanks.
 
 scripts/checkpatch.pl | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a1e4113..e9c46d3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2899,15 +2899,27 @@ sub process {
 				$orig_desc = $1;
 				$has_parens_and_dqm = 1;
 			} elsif ($line =~ /\b$prefix\s+[0-9a-f]{5,}\s+\(".+$/i &&
-				 defined $rawlines[$linenr] &&
-				 $rawlines[$linenr] =~ /^\s*.+"\)/) {
-				$line =~ /\b$prefix\s+[0-9a-f]{5,}\s+\("(.+)$/i;
-				$orig_desc = $1;
-				$rawlines[$linenr] =~ /^\s*(.+)"\)/;
-				$orig_desc .= " " . $1;
-				$has_parens_and_dqm = 1;
-
-				if ($prefix eq "Fixes:") {
+				 defined $rawlines[$linenr]) {
+				 if ($rawlines[$linenr] =~ /^\s*.+"\)/) {
+					$line =~ /\b$prefix\s+[0-9a-f]{5,}\s+\("(.+)$/i;
+					$orig_desc = $1;
+					$rawlines[$linenr] =~ /^\s*(.+)"\)/;
+					$orig_desc .= " " . $1;
+					$has_parens_and_dqm = 1;
+				 } elsif (defined $rawlines[$linenr + 1] &&
+					  $rawlines[$linenr + 1] =~ /^\s*.+"\)/) {
+					$line =~ /\b$prefix\s+[0-9a-f]{5,}\s+\("(.+)$/i;
+					$orig_desc = $1;
+					$rawlines[$linenr] =~ /^\s*(.+)/;
+					$orig_desc .= " " . $1;
+					$rawlines[$linenr + 1] =~ /^\s*(.+)"\)/;
+					$orig_desc .= " " . $1;
+					$has_parens_and_dqm = 1;
+				 } else {
+					$diagnostics .= "Missing terminal '\")' at the end of title or the title acrosses more than 3 lines.\n";
+				 }
+
+				if ($has_parens_and_dqm && $prefix eq "Fixes:") {
 					$acrosslines = 1;
 					$diagnostics .= "The title acrosses lines.\n";
 				}
-- 
1.8.5.6.2.g3d8a54e.dirty

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

* [PATCH] checkpatch: add support for title acrosses three lines in commit id description
@ 2020-05-03 12:34 ` Wang YanQing
  0 siblings, 0 replies; 6+ messages in thread
From: Wang YanQing @ 2020-05-03 12:34 UTC (permalink / raw)
  To: joe
  Cc: Andy Whitcroft, linux-kernel, Alexei Starovoitov, Matteo Croce,
	Markus.Elfring, kernel-janitors

The current GIT_COMMIT_ID will report error when the title in commit id
description acrosses three lines, take changelog of commit 87b0f983f66f
("net: mscc: ocelot: fix untagged packet drops when enslaving to vlan
aware bridge") as a example.

It make senses to support three lines title, because three lines could only
have about two lines length title, see above example, but I think we don't
need to add support for more than three lines length title, ~225 (75 * 3)
shoud be enough for any sensible title.

This patch adds support for three lines title in the commit id description,
and emit diagnostics info when the title acrosses more than three lines.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 Hi! Joe
 This is the third patch based on previous two patches.

 Thanks.
 
 scripts/checkpatch.pl | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a1e4113..e9c46d3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2899,15 +2899,27 @@ sub process {
 				$orig_desc = $1;
 				$has_parens_and_dqm = 1;
 			} elsif ($line =~ /\b$prefix\s+[0-9a-f]{5,}\s+\(".+$/i &&
-				 defined $rawlines[$linenr] &&
-				 $rawlines[$linenr] =~ /^\s*.+"\)/) {
-				$line =~ /\b$prefix\s+[0-9a-f]{5,}\s+\("(.+)$/i;
-				$orig_desc = $1;
-				$rawlines[$linenr] =~ /^\s*(.+)"\)/;
-				$orig_desc .= " " . $1;
-				$has_parens_and_dqm = 1;
-
-				if ($prefix eq "Fixes:") {
+				 defined $rawlines[$linenr]) {
+				 if ($rawlines[$linenr] =~ /^\s*.+"\)/) {
+					$line =~ /\b$prefix\s+[0-9a-f]{5,}\s+\("(.+)$/i;
+					$orig_desc = $1;
+					$rawlines[$linenr] =~ /^\s*(.+)"\)/;
+					$orig_desc .= " " . $1;
+					$has_parens_and_dqm = 1;
+				 } elsif (defined $rawlines[$linenr + 1] &&
+					  $rawlines[$linenr + 1] =~ /^\s*.+"\)/) {
+					$line =~ /\b$prefix\s+[0-9a-f]{5,}\s+\("(.+)$/i;
+					$orig_desc = $1;
+					$rawlines[$linenr] =~ /^\s*(.+)/;
+					$orig_desc .= " " . $1;
+					$rawlines[$linenr + 1] =~ /^\s*(.+)"\)/;
+					$orig_desc .= " " . $1;
+					$has_parens_and_dqm = 1;
+				 } else {
+					$diagnostics .= "Missing terminal '\")' at the end of title or the title acrosses more than 3 lines.\n";
+				 }
+
+				if ($has_parens_and_dqm && $prefix eq "Fixes:") {
 					$acrosslines = 1;
 					$diagnostics .= "The title acrosses lines.\n";
 				}
-- 
1.8.5.6.2.g3d8a54e.dirty

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

* Re: [PATCH] checkpatch: add support for title acrosses three lines in commit id description
  2020-05-03 12:34 ` Wang YanQing
@ 2020-05-03 13:03   ` Markus Elfring
  -1 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-05-03 13:03 UTC (permalink / raw)
  To: Wang YanQing, Joe Perches, Andy Whitcroft, kernel-janitors
  Cc: linux-kernel, Alexei Starovoitov, Matteo Croce

> The current GIT_COMMIT_ID will report error when the title in commit id
> description acrosses three lines, …

I suggest to improve the commit message (and subsequent Perl code)
also according to the usage of the text “acrosses”.


> This patch adds support for three lines title in the commit id description,
> and emit diagnostics info when the title acrosses more than three lines.

Please split this paragraph into two imperative wordings.

Regards,
Markus

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

* Re: [PATCH] checkpatch: add support for title acrosses three lines in commit id description
@ 2020-05-03 13:03   ` Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-05-03 13:03 UTC (permalink / raw)
  To: Wang YanQing, Joe Perches, Andy Whitcroft, kernel-janitors
  Cc: linux-kernel, Alexei Starovoitov, Matteo Croce

> The current GIT_COMMIT_ID will report error when the title in commit id
> description acrosses three lines, …

I suggest to improve the commit message (and subsequent Perl code)
also according to the usage of the text “acrosses”.


> This patch adds support for three lines title in the commit id description,
> and emit diagnostics info when the title acrosses more than three lines.

Please split this paragraph into two imperative wordings.

Regards,
Markus

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

* Re: [PATCH] checkpatch: add support for title acrosses three lines in commit id description
  2020-05-03 12:34 ` Wang YanQing
@ 2020-05-03 15:46   ` Joe Perches
  -1 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2020-05-03 15:46 UTC (permalink / raw)
  To: Wang YanQing
  Cc: Andy Whitcroft, linux-kernel, Alexei Starovoitov, Matteo Croce,
	Markus.Elfring, kernel-janitors

On Sun, 2020-05-03 at 20:34 +0800, Wang YanQing wrote:
> The current GIT_COMMIT_ID will report error when the title in commit id
> description acrosses three lines, take changelog of commit 87b0f983f66f
> ("net: mscc: ocelot: fix untagged packet drops when enslaving to vlan
> aware bridge") as a example.

I think it's a diminishing returns problem.

What percentage of commits in the last 10000
has this issue?



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

* Re: [PATCH] checkpatch: add support for title acrosses three lines in commit id description
@ 2020-05-03 15:46   ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2020-05-03 15:46 UTC (permalink / raw)
  To: Wang YanQing
  Cc: Andy Whitcroft, linux-kernel, Alexei Starovoitov, Matteo Croce,
	Markus.Elfring, kernel-janitors

On Sun, 2020-05-03 at 20:34 +0800, Wang YanQing wrote:
> The current GIT_COMMIT_ID will report error when the title in commit id
> description acrosses three lines, take changelog of commit 87b0f983f66f
> ("net: mscc: ocelot: fix untagged packet drops when enslaving to vlan
> aware bridge") as a example.

I think it's a diminishing returns problem.

What percentage of commits in the last 10000
has this issue?

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

end of thread, other threads:[~2020-05-03 15:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-03 12:34 [PATCH] checkpatch: add support for title acrosses three lines in commit id description Wang YanQing
2020-05-03 12:34 ` Wang YanQing
2020-05-03 13:03 ` Markus Elfring
2020-05-03 13:03   ` Markus Elfring
2020-05-03 15:46 ` Joe Perches
2020-05-03 15:46   ` Joe Perches

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.