Re: [PATCH] checkpatch: add --fix option for OPEN_BRACE issues

From: Dwaipayan Ray
Date: Wed Nov 18 2020 - 15:53:14 EST


> > > The difference here is that you are dealing with a $stat context and
> > > the existing --fix entries are just for single line fixes.
> > >
> >
> > Hi,
> > Ya I understand that. Though I am dealing with $stat content,
> > I am also directly accessing $rawlines here.
> > So I think that should have the proper patch line format, starting
> > with + or - or so.
> >
> > So in this case if the error is triggered, checking for /^+/ should be done
> > becase it would be wrong to fix the others with /^[- ]/
> >
> > Is there something else that I am not getting here?
>
> $stat does not include lines that are skipped if the lines start with -
>
> Patch context may be:
>
> line content
>
> 1 func(...
> 2 - original arguments);
> 3 + changed);
>
> where $stat does not include the 'original arguments' changed line
>
> func(...,
> changed);
>
> but the $rawlines[] entries are consecutive.
>
> Anyway, this needs to be handled very carefully if handled at all.
>
> I think it's easier to avoid handling these cases and let the
> patch submitter fix it manually if appropriate.
>

Thanks. I get your point now. It seems it's much more complex than
I thought it to be. I will avoid working on this one then.

Thanks & Regards,
Dwaipayan.