From: Wang YanQing <udknight@gmail.com>
To: joe@perches.com
Cc: apw@canonical.com, alexei.starovoitov@gmail.com,
linux-kernel@vger.kernel.org
Subject: [PATCH] checkpatch: add dedicated checker for 'Fixes:' tag
Date: Mon, 27 Apr 2020 21:15:19 +0800 [thread overview]
Message-ID: <20200427131519.GA15664@udknight> (raw)
According to submitting-patches.rst, 'Fixes:' tag has a little
stricter condition about the one line summary:
"
Do not split the tag across multiple
lines, tags are exempt from the "wrap at 75 columns" rule in order to simplify
parsing scripts
"
And the current 'Fixes:' checker in "# Check for git id commit length and
improperly formed commit descriptions" doesn't check for invalid commit id
length, so I think it is better to add dedicated checker for 'Fixes:' TAG.
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
scripts/checkpatch.pl | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 23a001a..fbb31bc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2820,7 +2820,7 @@ sub process {
($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
$line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
- $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
+ $line !~ /^\s*fixes:\s*([0-9a-f]{6,40})\s*(.*)/i))) {
my $init_char = "c";
my $orig_commit = "";
my $short = 1;
@@ -2979,6 +2979,13 @@ sub process {
}
}
+ if ($in_commit_log && $line =~ /^\s*fixes:\s*([0-9a-f]{6,40})\s*(.*)/i) {
+ if (length($1) != 12 || $2 !~ /^\(\"(.*)\"\)$/i) {
+ ERROR("FIXES_TAG",
+ "please use the 'Fixes:' tag with the first 12 characters of the SHA-1 ID, and the one line summary(no across multiple lines)\n" . $herecurr);
+ }
+ }
+
# ignore non-hunk lines and lines being removed
next if (!$hunk_line || $line =~ /^-/);
--
1.8.5.6.2.g3d8a54e.dirty
next reply other threads:[~2020-04-27 13:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-27 13:15 Wang YanQing [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-04-27 14:00 [PATCH] checkpatch: add dedicated checker for 'Fixes:' tag Markus Elfring
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=20200427131519.GA15664@udknight \
--to=udknight@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.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