From: Joe Perches <joe@perches.com>
To: Michal Zylowski <michal.zylowski@intel.com>, apw@canonical.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] checkpatch: Check for space after "else" keyword
Date: Sun, 05 Aug 2018 16:57:08 -0700 [thread overview]
Message-ID: <0a038f1680724bafcf8b0615533332a92a67b7cc.camel@perches.com> (raw)
In-Reply-To: <1533501740-451-1-git-send-email-michal.zylowski@intel.com>
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@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) {
Thanks.
btw: the fix block blow also should be updated with else
prev parent reply other threads:[~2018-08-05 23:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-05 20:42 Michal Zylowski
2018-08-05 23:57 ` 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=0a038f1680724bafcf8b0615533332a92a67b7cc.camel@perches.com \
--to=joe@perches.com \
--cc=apw@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.zylowski@intel.com \
/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®