From: Joe Perches <joe@perches.com>
To: Aditya Srivastava <yashsri421@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com
Subject: Re: [PATCH v2] checkpatch: add fix option for ASSIGNMENT_CONTINUATIONS
Date: Tue, 17 Nov 2020 07:58:20 -0800 [thread overview]
Message-ID: <756a22eddf82cbbdcdfe5bef1735154d123cd081.camel@perches.com> (raw)
In-Reply-To: <20201117105237.757-1-yashsri421@gmail.com>
On Tue, 2020-11-17 at 16:22 +0530, Aditya Srivastava wrote:
> Currently, checkpatch warns us if an assignment operator is placed
> at the start of a line and not at the end of previous line.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3542,8 +3542,14 @@ sub process {
>
>
> # check for assignments on the start of a line
> if ($sline =~ /^\+\s+($Assignment)[^=]/) {
> - CHK("ASSIGNMENT_CONTINUATIONS",
> - "Assignment operator '$1' should be on the previous line\n" . $hereprev);
> + my $operator = $1;
> + if (CHK("ASSIGNMENT_CONTINUATIONS",
> + "Assignment operator '$1' should be on the previous line\n" . $hereprev) &&
> + $fix && $prevrawline =~ /^\+/) {
> + # add assignment operator to the previous line, remove from current line
> + $fixed[$fixlinenr - 1] .= " $operator";
> + $fixed[$fixlinenr] =~ s/$operator\s*//;
As $operator could be a division, I believe it needs to be quoted.
prev parent reply other threads:[~2020-11-17 15:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-17 10:52 [PATCH v2] checkpatch: add fix option for ASSIGNMENT_CONTINUATIONS Aditya Srivastava
2020-11-17 15:58 ` 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=756a22eddf82cbbdcdfe5bef1735154d123cd081.camel@perches.com \
--to=joe@perches.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=yashsri421@gmail.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