From: Joe Perches <joe@perches.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Andy Whitcroft <apw@canonical.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] checkpatch: Make sure a commit reference description uses parentheses
Date: Sun, 1 Feb 2015 20:27:41 -0800 [thread overview]
Message-ID: <eda57b236aa782795a580a0a8762013641609ca7.1422851104.git.joe@perches.com> (raw)
In-Reply-To: <cover.1422851104.git.joe@perches.com>
The preferred style for a commit reference in a commit log is:
commit <foo> ("<title line>")
A recent commit removed this check for parentheses. Add it back.
Signed-off-by: Joe Perches <joe@perches.com>
---
scripts/checkpatch.pl | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 32bd31c..3642b0d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2191,6 +2191,7 @@ sub process {
my $case = 1;
my $space = 1;
my $hasdesc = 0;
+ my $hasparens = 0;
my $id = '0123456789ab';
my $orig_desc = "commit description";
my $description = "";
@@ -2201,10 +2202,12 @@ sub process {
$case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) {
$orig_desc = $1;
+ $hasparens = 1;
} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
defined $rawlines[$linenr] &&
$rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
$orig_desc = $1;
+ $hasparens = 1;
} elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&
defined $rawlines[$linenr] &&
$rawlines[$linenr] =~ /^\s*[^"]+"\)/) {
@@ -2212,12 +2215,13 @@ sub process {
$orig_desc = $1;
$rawlines[$linenr] =~ /^\s*([^"]+)"\)/;
$orig_desc .= " " . $1;
+ $hasparens = 1;
}
($id, $description) = git_commit_info($orig_commit,
$id, $orig_desc);
- if ($short || $long || $space || $case || ($orig_desc ne $description)) {
+ if ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens) {
ERROR("GIT_COMMIT_ID",
"Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr);
}
--
2.1.2
prev parent reply other threads:[~2015-02-02 4:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-02 4:27 [PATCH 0/5] checkpatch: Miscellaneous cleanups Joe Perches
2015-02-02 4:27 ` [PATCH 1/5] checkpatch: Improve seq_print->seq_puts suggestion Joe Perches
2015-02-02 4:27 ` [PATCH 2/5] checkpatch: Improve "no space necessary after cast" test Joe Perches
2015-02-02 4:27 ` [PATCH 3/5] checkpatch: Neaten printk_ratelimited message position Joe Perches
2015-02-02 4:27 ` [PATCH 4/5] checkpatch: Add --strict test for spaces around arithmetic Joe Perches
2015-02-02 4:27 ` Joe Perches [this message]
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=eda57b236aa782795a580a0a8762013641609ca7.1422851104.git.joe@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.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;
as well as URLs for NNTP newsgroup(s).