From: Michal Zylowski <michal.zylowski@intel.com>
To: joe@perches.com, apw@canonical.com
Cc: linux-kernel@vger.kernel.org, michal.zylowski@intel.com
Subject: [PATCH v2] checkpatch: Check for space after "else" keyword
Date: Sun, 5 Aug 2018 22:42:20 +0200 [thread overview]
Message-ID: <1533501740-451-1-git-send-email-michal.zylowski@intel.com> (raw)
Current checkpatch implementation permits notation like:
} else{
in kernel code.
It looks like oversight and inconsistency in checkpatch rules (e.g.
instruction like 'do' is tested).
Add regex for checking space after 'else' keyword and trigger error if
space is not present.
Signed-off-by: Michal Zylowski <michal.zylowski@intel.com>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 447857f..81617b8 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4483,7 +4483,7 @@ sub process {
#need space before brace following if, while, etc
if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
- $line =~ /do\{/) {
+ $line =~ /\b(?:else|do)\{/) {
if (ERROR("SPACING",
"space required before the open brace '{'\n" . $herecurr) &&
$fix) {
--
2.7.4
next reply other threads:[~2018-08-05 20:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-05 20:42 Michal Zylowski [this message]
2018-08-05 23:57 ` Joe Perches
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=1533501740-451-1-git-send-email-michal.zylowski@intel.com \
--to=michal.zylowski@intel.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
all inboxes | Powered by JetHome®