lkml.org 
[lkml]   [2022]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] checkpatch: warn when Reported-by: is not followed by Link:
From
Date
On Thu, 2022-12-15 at 15:43 +0100, Kai Wasserbäch wrote:
> Encourage patch authors to link to reports by issuing a warning, if
> a Reported-by: is not accompanied by a link to the report.

Please also expand Documentation/ as appropriate to encourage this too.

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3155,6 +3155,20 @@ sub process {
> "Co-developed-by and Signed-off-by: name/email do not match \n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]);
> }
> }
> +
> + # check if Reported-by: is followed by a Link:
> + if ($sign_off =~ /^reported-by:$/i) {
> + if (!defined $lines[$linenr]) {
> + WARN("BAD_REPORTED_BY_LINK",
> + "Reported-by: should be immediately followed by Link: to the report\n" . $herecurr . $rawlines[$linenr] . "\n");
> + } elsif ($rawlines[$linenr] !~ /^\s*link:\s*(.*)/i) {

This capture group isn't necessary and does not guarantee there is
an actual link. Also this is allowing spaces before "Link:" when
the reported-by test above does not allow spaces. Please be
consistent. My preference would be to not allow spaces.

> + WARN("BAD_REPORTED_BY_LINK",
> + "Reported-by: should be immediately followed by Link: to the report\n" . $herecurr . $rawlines[$linenr] . "\n");
> + } elsif ($lines[$linenr] !~ /https?:\/\//i) {

To make reading the match pattern easier, prefer m{} when the expected
content uses / instead of using / as a delimiter.

> + WARN("BAD_REPORTED_BY_LINK",
> + "Link: following Reported-by: should contain a URL\n" . $herecurr . $rawlines[$linenr] . "\n");
> + }
> + }
> }
>
> # Check Fixes: styles is correct

\
 
 \ /
  Last update: 2022-12-15 19:01    [W:0.070 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site