[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0a038f1680724bafcf8b0615533332a92a67b7cc.camel@perches.com>
Date: Sun, 05 Aug 2018 16:57:08 -0700
From: Joe Perches <joe@...ches.com>
To: Michal Zylowski <michal.zylowski@...el.com>, apw@...onical.com
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] checkpatch: Check for space after "else" keyword
On Sun, 2018-08-05 at 22:42 +0200, Michal Zylowski wrote:
> 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 | 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) {
Thanks.
btw: the fix block blow also should be updated with else
Powered by blists - more mailing lists