[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <29a040d31a84dd24618096e2776a66c23880f2d7.camel@perches.com>
Date: Fri, 01 Mar 2019 11:31:15 -0800
From: Joe Perches <joe@...ches.com>
To: Alexandre Ghiti <alex@...ti.fr>,
Andy Whitcroft <apw@...onical.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scripts: checkpatch: Check multiple blank lines when
deleting code
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 <alex@...ti.fr>
> ---
> 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 +
Powered by blists - more mailing lists