All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aditya Srivastava <yashsri421@gmail.com>
To: lukas.bulwahn@gmail.com
Cc: linux-kernel-mentees@lists.linuxfoundation.org, yashsri421@gmail.com
Subject: [Linux-kernel-mentees] [PATCH] checkpatch: add fix and improve warning msg for Non-standard signature
Date: Sat, 21 Nov 2020 01:28:51 +0530	[thread overview]
Message-ID: <20201120195851.23679-1-yashsri421@gmail.com> (raw)
In-Reply-To: <da375716-721c-e4d8-27a9-f8d576741d65@gmail.com>

Checkpatch.pl warns on non-standard signature styles.

E.g., running checkpatch on commit 513f7f747e1c ("parisc: Fix vmap
memory leak in ioremap()/iounmap()") reports this warning:

WARNING: Non-standard signature: Noticed-by:
Noticed-by: Sven Schnelle <svens@stackframe.org>

Provide a fix by:
1) replacing the non-standard signature with its standard equivalent
2) removing the signature if it is not required

Also, improve warning messages correspondingly, providing users
suggestions to either replace or remove the signature

Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
---
 scripts/checkpatch.pl | 45 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index fdfd5ec09be6..23a21dc2c29a 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -506,6 +506,27 @@ our $signature_tags = qr{(?xi:
 	Cc:
 )};
 
+our %standard_signature_fix = (
+	"Requested-by:" => "Suggested-by:",
+	"Co-authored-by:" => "Co-developed-by:",
+	"Analyzed-by:" => "Co-developed-by:",
+	"Analysed-by:" => "Co-developed-by:",
+	"Improvements-by:" => "Co-developed-by:",
+	"Noticed-by:" => "Reported-by:",
+	"Inspired-by:" => "Suggested-by:",
+	"Verified-by:" => "Tested-by:",
+	"Okay-ished-by:" => "Acked-by:",
+	"Acked-for-MFD-by:" => "Acked-by:",
+	"Reviewed-off-by:" => "Reviewed-by:",
+	"Proposed-by:" => "Suggested-by:",
+	"Fixed-by:" => "Co-developed-by:",
+	"Pointed-out-by:" => "Suggested-by:",
+	"Pointed-at-by:" => "Suggested-by:",
+	"Suggestions-by:" => "Suggested-by:",
+	"Generated-by:" => "remove",
+	"Celebrated-by:" => "remove",
+);
+
 our @typeListMisordered = (
 	qr{char\s+(?:un)?signed},
 	qr{int\s+(?:(?:un)?signed\s+)?short\s},
@@ -2773,8 +2794,28 @@ sub process {
 			my $ucfirst_sign_off = ucfirst(lc($sign_off));
 
 			if ($sign_off !~ /$signature_tags/) {
-				WARN("BAD_SIGN_OFF",
-				     "Non-standard signature: $sign_off\n" . $herecurr);
+				my $suggested_signature = "";
+				if (exists($standard_signature_fix{$sign_off})) {
+					$suggested_signature = $standard_signature_fix{$sign_off};
+				}
+				if ($suggested_signature eq "") {
+					WARN("BAD_SIGN_OFF",
+					     "Non-standard signature: $sign_off\n" . $herecurr);
+				}
+				elsif ($suggested_signature eq "remove") {
+					if (WARN("BAD_SIGN_OFF",
+						"Non-standard signature: $sign_off. Please consider removing this signature tag.\n" . $herecurr) &&
+					$fix) {
+						fix_delete_line($fixlinenr, $rawline);
+					}
+				}
+				else {
+					if (WARN("BAD_SIGN_OFF",
+						"Non-standard signature: $sign_off. Please use '$suggested_signature' instead.\n" . $herecurr) &&
+					$fix) {
+						$fixed[$fixlinenr] =~ s/$sign_off/$suggested_signature/;
+					}
+				}
 			}
 			if (defined $space_before && $space_before ne "") {
 				if (WARN("BAD_SIGN_OFF",
-- 
2.17.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2020-11-20 19:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 14:13 [Linux-kernel-mentees] Fix for BAD_SIGN_OFF: non-standard signature Aditya
2020-11-11 20:04 ` Lukas Bulwahn
2020-11-13 14:35   ` Aditya
2020-11-13 15:00     ` Aditya
2020-11-13 15:26       ` Lukas Bulwahn
2020-11-13 18:25         ` Aditya
2020-11-17 18:03           ` Aditya
2020-11-17 17:42             ` Lukas Bulwahn
2020-11-17 20:54               ` Aditya
2020-11-18 10:12                 ` Aditya
2020-11-18 19:17                   ` Lukas Bulwahn
2020-11-19  5:53                   ` Lukas Bulwahn
2020-11-19 14:09                     ` Aditya
2020-11-20 19:58                       ` Aditya Srivastava [this message]
2020-11-20 20:03                         ` [Linux-kernel-mentees] [PATCH] checkpatch: add fix and improve warning msg for Non-standard signature Aditya
2020-11-20 20:23                           ` Lukas Bulwahn
2020-11-20 21:30                             ` Aditya
2020-11-21  4:58                               ` [Linux-kernel-mentees] [PATCH v2] " Aditya Srivastava
2020-11-21  9:52                                 ` Lukas Bulwahn
2020-11-23 12:21                                   ` [Linux-kernel-mentees] [PATCH v3] " Aditya Srivastava
2020-11-23 13:09                                     ` Lukas Bulwahn
2020-11-23 15:16                                       ` Aditya
2020-11-23 15:18                                         ` Lukas Bulwahn
  -- strict thread matches above, loose matches on Subject: below --
2020-11-24 11:16 [Linux-kernel-mentees] [PATCH] " Aditya Srivastava
2020-11-24 11:48 ` Lukas Bulwahn

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=20201120195851.23679-1-yashsri421@gmail.com \
    --to=yashsri421@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=lukas.bulwahn@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.