linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 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 v2] checkpatch: add fix and improve warning msg for Non-standard signature
Date: Sat, 21 Nov 2020 10:28:27 +0530	[thread overview]
Message-ID: <20201121045827.12175-1-yashsri421@gmail.com> (raw)
In-Reply-To: <4230063e-48b5-8b0c-c92c-fc3e16b5ddb4@gmail.com>

Checkpatch.pl warns on non-standard signature styles.

This warning usually occurs because of incorrect use of signature tags,
e.g. tags such as 'Co-authored-by', which although seem correct, is not
a standard signature. Its standard equivalent is 'Co-developed-by'.

An evaluation over v4.13..v5.8 found 'Co-authored-by' tag used 43 times

Similarly, 'Requested-by'(used 48 times) has its equivalent as
'Suggested-by', and so on.

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>
---
changes in v2: replace commit specific example with brief evaluation

 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-21  4:58 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                       ` [Linux-kernel-mentees] [PATCH] checkpatch: add fix and improve warning msg for Non-standard signature Aditya Srivastava
2020-11-20 20:03                         ` Aditya
2020-11-20 20:23                           ` Lukas Bulwahn
2020-11-20 21:30                             ` Aditya
2020-11-21  4:58                               ` Aditya Srivastava [this message]
2020-11-21  9:52                                 ` [Linux-kernel-mentees] [PATCH v2] " 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
2020-11-24 11:48 [Linux-kernel-mentees] [PATCH] " Lukas Bulwahn
2020-11-24 15:32 ` [Linux-kernel-mentees] [PATCH v2] " Aditya Srivastava
2020-11-25  6:57   ` 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=20201121045827.12175-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).