lkml.org 
[lkml]   [2020]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] checkpatch: Fix "Missing a blank line after declarations" test on patches
From
Date
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



\
 
 \ /
  Last update: 2020-12-10 19:18    [W:0.427 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site