From: Aditya Srivastava <yashsri421@gmail.com>
To: joe@perches.com
Cc: yashsri421@gmail.com, lukas.bulwahn@gmail.com,
linux-kernel@vger.kernel.org,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: [PATCH v3] Currently checkpatch warns us if there is no 'Signed-off-by' line for the patch.
Date: Mon, 30 Nov 2020 14:40:42 +0530 [thread overview]
Message-ID: <20201130091042.14987-1-yashsri421@gmail.com> (raw)
In-Reply-To: <21acc492ab37acc42390abffb61aed370a22118.camel@perches.com>
E.g., running checkpatch on commit 9ac060a708e0 ("leaking_addresses:
Completely remove --version flag") reports this error:
ERROR: Missing Signed-off-by: line(s)
Provide a fix by adding a Signed-off-by line corresponding to the author
of the patch before the patch separator line.
Also, avoid this fix with the Non-standard signature warning, as the
missing sign off is most likely because of typo.
E.g. for commit 8cde5d5f7361 ("bus: ti-sysc: Detect omap4 type timers
for quirk") we get missing sign off as well as bad sign off warnings for:
Siganed-off-by: Tony Lindgren <tony@atomide.com>
Here it is probably best to fix the typo with BAD_SIGN_OFF warning and
avoid adding an additional signoff.
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Aditya Srivastava <yashsri421@gmail.com>
---
applies over next-20201120 and my last changes at:https://lore.kernel.org/linux-kernel-mentees/db1195235752685fc85fb52ecb1b1af3f35b5394.camel@perches.com/T/#u
Changes in v2:
Add space after 'if'
Add check for $patch_separator_linenr to be greater than 0
Changes in v3:
Give MISSING_SIGN_OFF warning irrespective of the value of $non_standard_signature, add check with fix option instead
Modify commit message accordingly
scripts/checkpatch.pl | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4a026926139f..3abf34bb9b00 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2462,6 +2462,8 @@ sub process {
my $last_blank_line = 0;
my $last_coalesced_string_linenr = -1;
+ my $patch_separator_linenr = 0;
+ my $non_standard_signature = 0;
our @report = ();
our $cnt_lines = 0;
@@ -2813,6 +2815,10 @@ sub process {
if ($line =~ /^---$/) {
$has_patch_separator = 1;
$in_commit_log = 0;
+ # to add missing signed-off-by line before diff(s)
+ if ($patch_separator_linenr == 0) {
+ $patch_separator_linenr = $linenr;
+ }
}
# Check if MAINTAINERS is being updated. If so, there's probably no need to
@@ -2842,6 +2848,7 @@ sub process {
$fixed[$fixlinenr] =~ s/$sign_off/$suggested_signature/;
}
}
+ $non_standard_signature = 1;
}
if (defined $space_before && $space_before ne "") {
if (WARN("BAD_SIGN_OFF",
@@ -7188,8 +7195,11 @@ sub process {
}
if ($is_patch && $has_commit_log && $chk_signoff) {
if ($signoff == 0) {
- ERROR("MISSING_SIGN_OFF",
- "Missing Signed-off-by: line(s)\n");
+ if (ERROR("MISSING_SIGN_OFF",
+ "Missing Signed-off-by: line(s)\n") &&
+ $fix && !$non_standard_signature && $patch_separator_linenr > 0) {
+ fix_insert_line($patch_separator_linenr - 1, "Signed-off-by: $author");
+ }
} elsif ($authorsignoff != 1) {
# authorsignoff values:
# 0 -> missing sign off
--
2.17.1
next parent reply other threads:[~2020-11-30 9:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <21acc492ab37acc42390abffb61aed370a22118.camel@perches.com>
2020-11-30 9:10 ` Aditya Srivastava [this message]
2020-11-30 9:15 ` [PATCH v3] checkpatch: add fix option for MISSING_SIGN_OFF Aditya Srivastava
2020-11-30 9:45 ` Aditya
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=20201130091042.14987-1-yashsri421@gmail.com \
--to=yashsri421@gmail.com \
--cc=joe@perches.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®