On Thu, 2019-02-28 at 13:15 -0500, Alexandre Ghiti wrote:
> By matching only current line starting with '+', we miss the case
> when deleting code makes consecutive blank lines appear: this patch
> then makes it possible to detect this case by also matching current
> line starting with ' ', which is an already existing blank line.
> 
> On the following example, checkpatch --subjective now complains about
> multiple blank lines:
> 
>  static long hugepage_subpool_get_pages(struct hugepage_subpool *spool,
>  {
>       long ret = delta;
> 
> -     if (!spool)
> -             return ret;
> 
>       spin_lock(&spool->lock);
> 
> Signed-off-by: Alexandre Ghiti <[email protected]>
> ---
>  scripts/checkpatch.pl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3298,7 +3298,7 @@ sub process {
>  
>  # check for multiple consecutive blank lines
>               if ($prevline =~ /^[\+ ]\s*$/ &&
> -                 $line =~ /^\+\s*$/ &&
> +                 $line =~ /^[\+ ]\s*$/ &&
>                   $last_blank_line != ($linenr - 1)) {
>                       if (CHK("LINE_SPACING",
>                               "Please don't use multiple blank lines\n" . 
> $hereprev) &&

I believe this screws up the --fix option just below this
if the line does not start with +





Reply via email to