[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f932082c38d8b67fd15e08c2f4f5eee8e4519291.camel@perches.com>
Date: Fri, 30 Dec 2022 12:31:12 -0800
From: Joe Perches <joe@...ches.com>
To: Gerhard Engleder <gerhard@...leder-embedded.com>,
linux-kernel@...r.kernel.org
Cc: apw@...onical.com, dwaipayanray1@...il.com, lukas.bulwahn@...il.com
Subject: Re: [PATCH] checkpatch: Ignore ETHTOOL_LINK_MODE_ enum values
On Fri, 2022-12-30 at 20:59 +0100, Gerhard Engleder wrote:
> Since commit 4104a20646 enum values like
> ETHTOOL_LINK_MODE_Asym_Pause_BIT are ignored. But there are other enums
> like ETHTOOL_LINK_MODE_1000baseT_Full_BIT, which are not ignored
> because of the not matching '1000baseT' substring.
>
> Extend regex to match also substrings like '1000baseT'.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5780,7 +5780,7 @@ sub process {
> if ($var !~ /^$Constant$/ &&
> $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
> #Ignore some autogenerated defines and enum values
> - $var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/ &&
> + $var !~ /^(?:[A-Z]+_){1,5}([A-Z]{1,3}[a-z]|[0-9]+[a-z]+[A-Z])/ &&
NAK.
This introduces an unnecessary capture group and as well it would also
allow too many other variants that should get a warning.
Try a git grep using that pattern and see if all the matches are
actually what you want to allow
$ git grep -Poh '\b(?:[A-Z]+_){1,5}([A-Z]{1,3}[a-z]|[0-9]+[a-z]+[A-Z])\w*\b' -- '*.[ch]' | \
sort | uniq -c | sort -rn
...
Powered by blists - more mailing lists