Messages in this thread | | | Subject | Re: [PATCH] checkpatch: Fix "Missing a blank line after declarations" test on patches | From | Joe Perches <> | Date | Thu, 10 Dec 2020 10:13:40 -0800 |
| |
On Thu, 2020-12-10 at 18:52 +0100, Christophe JAILLET wrote: > "Missing a blank line after declarations" is not triggered on patches.
That's not true. It does work on any patch that does a new function addition. There are some patch context complications here when lines are added and removed such that '+' add, '-' delete, and ' ' context testing isn't always obvious.
So, the code was intentionally limited to just new functions.
If there are simple ways to avoid false positives, great, but I believe it's not trivial.
> Tweak the regex to match such cases.
Please send multiple patch examples of different forms where it does not work.
> This patch is mostly a PoC. I don't know enough about checkpatch.pl to be > sure that the fix is the right thing to do. > At least, it works for me :)
Always a starting point...
> > The [\+ ] is taken from the test just above. > > I also wonder if there is a missing ^ in the last test: > (($prevline =~ /[\+ ](\s+)\S/) && $sline =~ /^[\+ ]$1\S/)) > ^ > |___ here
| |