[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f738d4c2-35ce-5e96-f6a3-8db5e39a178b@ghiti.fr>
Date: Sat, 2 Mar 2019 03:09:56 -0500
From: Alex Ghiti <alex@...ti.fr>
To: Joe Perches <joe@...ches.com>
Cc: Andy Whitcroft <apw@...onical.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scripts: checkpatch: Check multiple blank lines when
deleting code
On 3/1/19 2:31 PM, Joe Perches wrote:
> 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
> []
I do not understand what you mean here, can you clarify for v2 please ?
Thanks !
>> @@ -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 +
>
>
Totally, you're right, thanks.
>
>
Powered by blists - more mailing lists