[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABJPP5CHofzA46FHe3eJrgjQBTcaoCkR=dc29xxK80oFZJVfoQ@mail.gmail.com>
Date: Thu, 19 Nov 2020 00:15:19 +0530
From: Dwaipayan Ray <dwaipayanray1@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: linux-kernel-mentees@...ts.linuxfoundation.org,
linux-kernel <linux-kernel@...r.kernel.org>,
Lukas Bulwahn <lukas.bulwahn@...il.com>
Subject: Re: [PATCH] checkpatch: add --fix option for OPEN_BRACE issues
On Thu, Nov 19, 2020 at 12:09 AM Joe Perches <joe@...ches.com> wrote:
>
> On Thu, 2020-11-19 at 00:03 +0530, Dwaipayan Ray wrote:
> > On Wed, Nov 18, 2020 at 11:44 PM Joe Perches <joe@...ches.com> wrote:
> > >
> > > On Wed, 2020-11-18 at 18:10 +0530, Dwaipayan Ray wrote:
> > > > Brace style misuses of the following types are now
> > > > corrected:
> > > []
> > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > []
> > > > @@ -3937,9 +3937,23 @@ sub process {
> > > > #print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n";
> > > >
> > > >
> > > > if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
> > > > - ERROR("OPEN_BRACE",
> > > > - "that open brace { should be on the previous line\n" .
> > > > - "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n");
> > > > + if (ERROR("OPEN_BRACE",
> > > > + "that open brace { should be on the previous line\n" .
> > > > + "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n") &&
> > > > + $fix) {
> > > > + my $line1 = $rawlines[$ctx_ln - 2];
> > >
> > > How are you sure that in a patch context this line always starts with /^\+/ ?
> >
> > Hi,
> > I followed it from the other fixes for OPEN_BRACE which were already
> > there. In the patch context if the lines are added then only I think the fix
> > should be triggered. Other instances should not be modified.
>
> As far as I know there are no existing uses of --fix with OPEN_BRACE.
>
I think you added it via 8d1824780f2f1 ("checkpatch: add --fix option
for a couple OPEN_BRACE misuses")
Thanks,
Dwaipayan.
Powered by blists - more mailing lists