mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Advait Dhamorikar <advaitdhamorikar@gmail.com>
To: Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>,
	Dwaipayan Ray <dwaipayanray1@gmail.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>
Cc: linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
	anupnewsmail@gmail.com,
	Advait Dhamorikar <advaitdhamorikar@gmail.com>
Subject: [PATCH RESEND] scripts/checkpatch: Fix multiple Reported-by: false positive warning
Date: Mon,  4 Nov 2024 11:08:24 +0530	[thread overview]
Message-ID: <20241104053824.36672-1-advaitdhamorikar@gmail.com> (raw)

If multiple Reported-by: tags are used, the
checkpatch script throws a false positive warning
even when there is a Closes tag following the two
tags. This fix checks if the closes tag is present
after multiple Reported-by tags.

Here is an example of the same:
> WARNING: Reported-by: should be immediately followed by Closes: with a
> URL to the report
> #10:
> Reported-by: Kernel test bot <ppppqqqq@ymail.com>
> Reported-by: Some Person <xxxyyy@gmail.com>

> total: 0 errors, 1 warnings, 0 checks, 8 lines checked

Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
---
 scripts/checkpatch.pl | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4427572b2477..c74519f02180 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3188,10 +3188,13 @@ sub process {
 			if ($sign_off =~ /^reported(?:|-and-tested)-by:$/i) {
 				if (!defined $lines[$linenr]) {
 					WARN("BAD_REPORTED_BY_LINK",
-					     "Reported-by: should be immediately followed by Closes: with a URL to the report\n" . $herecurr . "\n");
-				} elsif ($rawlines[$linenr] !~ /^closes:\s*/i) {
+						"Reported-by: should be immediately followed by Closes: with a URL to the report\n" . $herecurr . "\n");
+				} elsif ($lines[$linenr] =~ /^reported(?:|-and-tested)-by:/i && $lines[$linenr + 1] =~ /^reported(?:|-and-tested)-by:/i) {
+       				 # Do nothing if the next line is another Reported-by:
+                }
+				elsif ($lines[$linenr]  =~ /^reported(?:|-and-tested)-by:/i && $lines[$linenr + 1] !~ /^closes:\s*/i) {
 					WARN("BAD_REPORTED_BY_LINK",
-					     "Reported-by: should be immediately followed by Closes: with a URL to the report\n" . $herecurr . $rawlines[$linenr] . "\n");
+						"Reported-by: should be immediately followed by Closes: with a URL to the report\n" . "#" . ($linenr + 1) . ":" . "\n" . $rawlines[$linenr] . "\n");
 				}
 			}
 		}
-- 
2.34.1


             reply	other threads:[~2024-11-04  5:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-04  5:38 Advait Dhamorikar [this message]
2024-11-18 19:36 ` Advait Dhamorikar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241104053824.36672-1-advaitdhamorikar@gmail.com \
    --to=advaitdhamorikar@gmail.com \
    --cc=anupnewsmail@gmail.com \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®