Skip to contentSkip to conversation

checkpatch: fix false positive for COMMIT_LOG_LONG_LINE with URLs

PATCH In review Aditya Srivastava 2 participants 7 messages Dec 16, 2020 – Dec 17, 2020 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: fix false positive for COMMIT_LOG_LONG_LINE with URLs

Currently checkpatch warns for long line in commit messages even for URL lines.

An evaluation over v4.13..v5.8 showed that out of ~11000 warnings for this class, around 790 are due to the line containing link.

E.g. running checkpatch on commit 3cde818cd02b ("ASoC: topology:
Consolidate how dtexts and dvalues are freed") reports this warning:

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line)
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-January/144761.html

Avoid giving users warning for character limit, instead suggest them to prefix the URLs with "Link:"

---
 scripts/checkpatch.pl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +8 -2
index abd5a3d2e913..23da1f50fe6a 100755
@@ -3032,8 +3032,14 @@ sub process {
 		      $line =~ /^\s*(?:Fixes:|Link:|$signature_tags)/i ||
 					# A Fixes: or Link: line or signature tag line
 		      $commit_log_possible_stack_dump)) {
-			WARN("COMMIT_LOG_LONG_LINE",
-			     "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
+			if ($line =~ /(?:http|https|ftp):\/\//) {
+				WARN("COMMIT_LOG_LONG_LINE",
+				     "Consider prefixing the URL with 'Link:'\n" . $herecurr);
+			}
+			else {
+				WARN("COMMIT_LOG_LONG_LINE",
+				     "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
+			}
 			$commit_log_long_line = 1;
 		}
 
Signature · 6 lines
2.17.1

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
#1 lore raw
Quoted 7 lines · Aditya Srivastava

Currently checkpatch warns for long line in commit messages even for URL lines.

An evaluation over v4.13..v5.8 showed that out of ~11000 warnings for this class, around 790 are due to the line containing link.

Quoted 9 lines

E.g. running checkpatch on commit 3cde818cd02b ("ASoC: topology:
Consolidate how dtexts and dvalues are freed") reports this warning:

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line)
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-January/144761.html

Avoid giving users warning for character limit, instead suggest them to prefix the URLs with "Link:"

Looks good to me. This might be also a good one for a fix option.

Lukas

Quoted 27 lines
---
 scripts/checkpatch.pl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +8 -3
index abd5a3d2e913..23da1f50fe6a 100755
@@ -3032,8 +3032,14 @@ sub process {
                      $line =~ /^\s*(?:Fixes:|Link:|$signature_tags)/i ||
                                        # A Fixes: or Link: line or signature tag line
                      $commit_log_possible_stack_dump)) {
-                       WARN("COMMIT_LOG_LONG_LINE",
-                            "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
+                       if ($line =~ /(?:http|https|ftp):\/\//) {
+                               WARN("COMMIT_LOG_LONG_LINE",
+                                    "Consider prefixing the URL with 'Link:'\n" . $herecurr);
+                       }
+                       else {
+                               WARN("COMMIT_LOG_LONG_LINE",
+                                    "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
+                       }
                        $commit_log_long_line = 1;
                }
 
--
Quoted 2 lines

2.17.1

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

author
#2 lore raw
Quoted 11 lines · Lukas Bulwahn
Quoted 10 lines · Aditya Srivastava

Currently checkpatch warns for long line in commit messages even for URL lines.

An evaluation over v4.13..v5.8 showed that out of ~11000 warnings for this class, around 790 are due to the line containing link.

E.g. running checkpatch on commit 3cde818cd02b ("ASoC: topology:
Consolidate how dtexts and dvalues are freed") reports this warning:

Quoted 9 lines
Quoted 6 lines

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line)
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-January/144761.html

Avoid giving users warning for character limit, instead suggest them to prefix the URLs with "Link:"

Looks good to me. This might be also a good one for a fix option.

I agree. Should I add the fix in this patch itself?

Thanks
Aditya

Quoted 28 lines

Lukas

Quoted 26 lines
---
 scripts/checkpatch.pl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +8 -2
index abd5a3d2e913..23da1f50fe6a 100755
@@ -3032,8 +3032,14 @@ sub process {
                      $line =~ /^\s*(?:Fixes:|Link:|$signature_tags)/i ||
                                        # A Fixes: or Link: line or signature tag line
                      $commit_log_possible_stack_dump)) {
-                       WARN("COMMIT_LOG_LONG_LINE",
-                            "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
+                       if ($line =~ /(?:http|https|ftp):\/\//) {
+                               WARN("COMMIT_LOG_LONG_LINE",
+                                    "Consider prefixing the URL with 'Link:'\n" . $herecurr);
+                       }
+                       else {
+                               WARN("COMMIT_LOG_LONG_LINE",
+                                    "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
+                       }
                        $commit_log_long_line = 1;
                }
 
Quoted 3 lines
Quoted 3 lines

--
2.17.1

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

#3 lore raw
Quoted 16 lines · Aditya
Quoted 14 lines · Lukas Bulwahn
Quoted 13 lines · Aditya Srivastava

Currently checkpatch warns for long line in commit messages even for URL lines.

An evaluation over v4.13..v5.8 showed that out of ~11000 warnings for this class, around 790 are due to the line containing link.

E.g. running checkpatch on commit 3cde818cd02b ("ASoC: topology:
Consolidate how dtexts and dvalues are freed") reports this warning:

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line)
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-January/144761.html

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Avoid giving users warning for character limit, instead suggest them to prefix the URLs with "Link:"

Looks good to me. This might be also a good one for a fix option.

I agree. Should I add the fix in this patch itself?

No, make two patches and send them as a patch series to the mailing list.

Lukas

Quoted 31 lines

Thanks
Aditya

Quoted 28 lines

Lukas

Quoted 26 lines
---
 scripts/checkpatch.pl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +8 -2
index abd5a3d2e913..23da1f50fe6a 100755
@@ -3032,8 +3032,14 @@ sub process {
                      $line =~ /^\s*(?:Fixes:|Link:|$signature_tags)/i ||
                                        # A Fixes: or Link: line or signature tag line
                      $commit_log_possible_stack_dump)) {
-                       WARN("COMMIT_LOG_LONG_LINE",
-                            "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
+                       if ($line =~ /(?:http|https|ftp):\/\//) {
+                               WARN("COMMIT_LOG_LONG_LINE",
+                                    "Consider prefixing the URL with 'Link:'\n" . $herecurr);
+                       }
+                       else {
+                               WARN("COMMIT_LOG_LONG_LINE",
+                                    "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
+                       }
                        $commit_log_long_line = 1;
                }
 
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

--
2.17.1

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

author
#4 lore raw
Quoted 21 lines · Lukas Bulwahn
Quoted 20 lines · Aditya
Quoted 18 lines · Lukas Bulwahn
Quoted 16 lines · Aditya Srivastava

Currently checkpatch warns for long line in commit messages even for URL lines.

An evaluation over v4.13..v5.8 showed that out of ~11000 warnings for this class, around 790 are due to the line containing link.

E.g. running checkpatch on commit 3cde818cd02b ("ASoC: topology:
Consolidate how dtexts and dvalues are freed") reports this warning:

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line)
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-January/144761.html

Avoid giving users warning for character limit, instead suggest them to prefix the URLs with "Link:"

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Looks good to me. This might be also a good one for a fix option.

I agree. Should I add the fix in this patch itself?

No, make two patches and send them as a patch series to the mailing list.

Hi Lukas
So, I generated a list of lines, which are URLs and reported by COMMIT_LOG_LONG_LINE here:
https://github.com/AdityaSrivast/kernel-tasks/blob/master/Task6/links/long_line_links.txt

These occur in different forms:

1) A large part of these occur as \s*(http|https).

2) These also occur as [1]: https, [2]: https, etc

3) BugLink: https:// (e.g.: BugLink:
http://lkml.kernel.org/r/[email protected])

4) References: https:// (e.g.: References:
http://mid.mail-archive.com/[email protected])

5) Link to v1: (E.g.: Link to v1:
https://patchwork.freedesktop.org/patch/msgid/[email protected])

6) Datasheet (e.g. Datasheet:http://www.winbond.com/resource-files/w25n01gv%20revl%20050918%20unsecured.pdf)

7) URL enclosed within brackets (E.g.:
(https://syzkaller.appspot.com/bug?id=ad7e0351fbc90535558514a71cd3edc11681997a).)

8) Link within sentences (E.g.: suite can be found at
https://github.com/Cyan4973/xxHash/blob/cf46e0c/xxhsum.c#L664)

etc.

Among these I guess we can fix occurrences like 1st by prefixing with "Link:". But I am not sure about the rest.

What do you think?

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

author
#5 lore raw
Quoted 59 lines · Aditya
Quoted 21 lines · Lukas Bulwahn
Quoted 20 lines · Aditya
Quoted 18 lines · Lukas Bulwahn
Quoted 16 lines · Aditya Srivastava

Currently checkpatch warns for long line in commit messages even for URL lines.

An evaluation over v4.13..v5.8 showed that out of ~11000 warnings for this class, around 790 are due to the line containing link.

E.g. running checkpatch on commit 3cde818cd02b ("ASoC: topology:
Consolidate how dtexts and dvalues are freed") reports this warning:

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line)
https://mailman.alsa-project.org/pipermail/alsa-devel/2019-January/144761.html

Avoid giving users warning for character limit, instead suggest them to prefix the URLs with "Link:"

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Looks good to me. This might be also a good one for a fix option.

I agree. Should I add the fix in this patch itself?

No, make two patches and send them as a patch series to the mailing list.

Hi Lukas
So, I generated a list of lines, which are URLs and reported by COMMIT_LOG_LONG_LINE here:
https://github.com/AdityaSrivast/kernel-tasks/blob/master/Task6/links/long_line_links.txt

These occur in different forms:

1) A large part of these occur as \s*(http|https).

2) These also occur as [1]: https, [2]: https, etc

3) BugLink: https:// (e.g.: BugLink:
http://lkml.kernel.org/r/[email protected])

4) References: https:// (e.g.: References:
http://mid.mail-archive.com/[email protected])

5) Link to v1: (E.g.: Link to v1:
https://patchwork.freedesktop.org/patch/msgid/[email protected])

6) Datasheet (e.g. Datasheet:http://www.winbond.com/resource-files/w25n01gv%20revl%20050918%20unsecured.pdf)

7) URL enclosed within brackets (E.g.:
(https://syzkaller.appspot.com/bug?id=ad7e0351fbc90535558514a71cd3edc11681997a).)

8) Link within sentences (E.g.: suite can be found at
https://github.com/Cyan4973/xxHash/blob/cf46e0c/xxhsum.c#L664)

Quoted 7 lines

etc.

Among these I guess we can fix occurrences like 1st by prefixing with "Link:". But I am not sure about the rest.

What do you think?

I think we can only fix the lines with ^\s*(http|https|ftp) and should just give warning for the others. The user can then decide how they want to fix.

Or should we give warning also for ^\s*(http|https|ftp) only?

I guess we can send this patch to Joe and see what he thinks. This might give us a better idea for the fix.

What do you think?

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

#6 lore raw
Quoted 86 lines · Aditya
Quoted 5 lines · Aditya
Quoted 4 lines · Lukas Bulwahn
Quoted 3 lines · Aditya
Quoted 1 line · Lukas Bulwahn

On Wed, Dec 16, 2020 at 1:32 PM Aditya Srivastava <

Quoted 11 lines · [email protected]> wrote:
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Currently checkpatch warns for long line in commit messages even for URL lines.

An evaluation over v4.13..v5.8 showed that out of ~11000 warnings for this class, around 790 are due to the line containing link.

E.g. running checkpatch on commit 3cde818cd02b ("ASoC: topology:
Consolidate how dtexts and dvalues are freed") reports this warning:

WARNING: Possible unwrapped commit description (prefer a maximum 75

chars per line)

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

https://mailman.alsa-project.org/pipermail/alsa-devel/2019-January/144761.html

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Avoid giving users warning for character limit, instead suggest them

to

Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

prefix the URLs with "Link:"

Looks good to me. This might be also a good one for a fix option.

I agree. Should I add the fix in this patch itself?

No, make two patches and send them as a patch series to the mailing

list.

Quoted 5 lines
Quoted 1 line

Hi Lukas
So, I generated a list of lines, which are URLs and reported by COMMIT_LOG_LONG_LINE here:

https://github.com/AdityaSrivast/kernel-tasks/blob/master/Task6/links/long_line_links.txt

Quoted 12 lines

These occur in different forms:

1) A large part of these occur as \s*(http|https).

2) These also occur as [1]: https, [2]: https, etc

3) BugLink: https:// (e.g.: BugLink:
http://lkml.kernel.org/r/[email protected])

4) References: https:// (e.g.: References:

http://mid.mail-archive.com/[email protected]
)

Quoted 3 lines

5) Link to v1: (E.g.: Link to v1:

https://patchwork.freedesktop.org/patch/msgid/[email protected]
)

Quoted 3 lines

6) Datasheet (e.g.
Datasheet:

http://www.winbond.com/resource-files/w25n01gv%20revl%20050918%20unsecured.pdf
)

Quoted 3 lines

7) URL enclosed within brackets (E.g.:
(

https://syzkaller.appspot.com/bug?id=ad7e0351fbc90535558514a71cd3edc11681997a)
.)

Quoted 11 lines

8) Link within sentences (E.g.: suite can be found at
https://github.com/Cyan4973/xxHash/blob/cf46e0c/xxhsum.c#L664)

etc.

Among these I guess we can fix occurrences like 1st by prefixing with "Link:". But I am not sure about the rest.

What do you think?

I think we can only fix the lines with ^\s*(http|https|ftp) and should just give warning for the others. The user can then decide how they want to fix.

Quoted 8 lines

Or should we give warning also for ^\s*(http|https|ftp) only?

I guess we can send this patch to Joe and see what he thinks. This might give us a better idea for the fix.

What do you think?

Agree. If we summarize the use of hyperlinks in commit messages properly, we might also ask on the ksummit-discuss list for some feedback on "standardizing the use of hyperlinks in commit messages beyond Link-tags".

All those examples show that there are various different preferences but really no common agreed way that everyone uses.

Let us start the discussion with Joe and then see.

Lukas

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