mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aditya <yashsri421@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	lukas.bulwahn@gmail.com, dwaipayanray1@gmail.com
Subject: Re: [PATCH v4] checkpatch: fix false positives in REPEATED_WORD warning
Date: Sat, 24 Oct 2020 14:58:17 +0530	[thread overview]
Message-ID: <c4432b0c-3e21-20ec-d439-cdfebc283148@gmail.com> (raw)
In-Reply-To: <5bc34c6faf989f528c92f5e631607f1774f08d20.camel@perches.com>

On 24/10/20 7:07 am, Joe Perches wrote:
> On Sat, 2020-10-24 at 05:38 +0530, Aditya Srivastava wrote: 
>> A quick evaluation on v5.6..v5.8 showed that this fix reduces
>> REPEATED_WORD warnings from 2797 to 907.
> 
> How many of these 907 remaining are still false positive?
>  
>> A quick manual check found all cases are related to hex output or
>> list command outputs in commit messages.
> 
> You mean 1890 of the 2797 are now no longer reported and all 1890
> were false positives yes?
> 

Yes. In v5.6..5.8, there were 2797 warnings for REPEATED_WORD, after
these changes, they are reduced to 907.
However, many among these 907 must have been fixed by Dwaipayan's
patch. I'll replace it with 1890 instead, for the better.

>>  			pos($rawline) = 1 if (!$in_commit_log);
>>  			while ($rawline =~ /\b($word_pattern) (?=($word_pattern))/g) {
>>  
>>
>> @@ -3074,6 +3076,17 @@ sub process {
>>  				next if ($start_char =~ /^\S$/);
>>  				next if (index(" \t.,;?!", $end_char) == -1);
>>  
>>
>> +                                # avoid repeating hex occurrences like 'ff ff fe 09 ...'
>> +                                my %allow_repeated_words = (
>> +                                        add => '',
>> +                                        added => '',
>> +                                        bad => '',
>> +                                        be => '',
>> +                                );
> 
> If perl caches this local hash declaration, fine,
> but I think it better to use 'our %allow_repeated_words'
> and move it so it's only declared using the file scope.
> 

I ran checkpatch over few commits, it was working fine. But I'll move
it to file scope, using 'our'. That should do as well.

>> +                                if ($first =~ /\b[0-9a-f]{2,}\b/) {
> 
> This regex matches only lower case so it wouldn't match "Add".
> 
> I think this regex would be clearer using
> 	/^[0-9a-f]+$/i or /^[A-Fa-f0-9]+$/
> 
> 

Missed it. Will do.

Thanks
Aditya

      reply	other threads:[~2020-10-24  9:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-24  0:08 Aditya Srivastava
2020-10-24  0:27 ` Aditya
2020-10-24  1:37 ` Joe Perches
2020-10-24  9:28   ` Aditya [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c4432b0c-3e21-20ec-d439-cdfebc283148@gmail.com \
    --to=yashsri421@gmail.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®