[PATCH 2/2] feat: checkpatch: Warn about Reported-by: not being followed by a Link:

From: Kai Wasserbäch
Date: Sun Dec 04 2022 - 06:39:28 EST


Suggested-by: Thorsten Leemhuis <linux@xxxxxxxxxxxxx>
Signed-off-by: Kai Wasserbäch <kai@xxxxxxxxxxxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a6d2ccaa3e..d957e9fddf 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3144,6 +3144,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: must be immediately followed by Link:\n" . "$here\n" . $rawline);
+ } elsif ($rawlines[$linenr] !~ /^\s*link:\s*(.*)/i) {
+ WARN("BAD_REPORTED_BY_LINK",
+ "Reported-by: must be immediately followed by Link:\n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]);
+ } elsif ($lines[$linenr] !~ /https?:\/\//i) {
+ WARN("BAD_REPORTED_BY_LINK",
+ "Link: following Reported-by: should contain an URL\n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]);
+ }
+ }
}

# Check Fixes: styles is correct
--
2.35.1