[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da8bc9f50f8e19de9937a65ad82c3367e70959bb.camel@perches.com>
Date: Thu, 15 Dec 2022 10:00:09 -0800
From: Joe Perches <joe@...ches.com>
To: Kai Wasserbäch <kai@....carbon-project.org>,
linux-kernel@...r.kernel.org
Cc: Thorsten Leemhuis <linux@...mhuis.info>,
Andrew Morton <akpm@...ux-foundation.org>,
Andy Whitcroft <apw@...onical.com>,
Dwaipayan Ray <dwaipayanray1@...il.com>,
Lukas Bulwahn <lukas.bulwahn@...il.com>
Subject: Re: [PATCH 2/3] checkpatch: warn when Reported-by: is not followed
by Link:
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
Powered by blists - more mailing lists