[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1533244821-31004-1-git-send-email-michal.zylowski@intel.com>
Date: Thu, 2 Aug 2018 23:20:21 +0200
From: Michal Zylowski <michal.zylowski@...el.com>
To: joe@...ches.com, apw@...onical.com
Cc: michal.zylowski@...el.com, linux-kernel@...r.kernel.org
Subject: [PATCH] checkpatch: Check for space after "else" keyword
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@...el.com>
---
scripts/checkpatch.pl | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index e16d671..2e3f41e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4479,6 +4479,7 @@ sub process {
#need space before brace following if, while, etc
if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
+ $line =~ /else\{/ ||
$line =~ /do\{/) {
if (ERROR("SPACING",
"space required before the open brace '{'\n" . $herecurr) &&
--
2.7.4
Powered by blists - more mailing lists