lkml.org 
[lkml]   [2014]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] checkpatch: Make SI unit tolerance more lenient with 3-character units
From
Date
On Fri, 2014-11-07 at 16:18 -0800, Julius Werner wrote:
> Checkpatch flags CamelCase identifiers in strict mode, but it has a
> feature to ignore parts with only two characters to allow for SI units
> like mV or uA. Unfortunately, not all SI units fit in two characters,
> and not all are lower case followed by upper case.
>
> This patch changes the check from [a-z][A-Z] to [a-zA-Z]{1,3} (any
> combination of up to three lower and upper case characters), so that it
> will also allow units like MHz, As or KiB.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -4055,8 +4055,8 @@ sub process {
> $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
> #Ignore Page<foo> variants
> $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
> -#Ignore SI style variants like nS, mV and dB (ie: max_uV, regulator_min_uA_show)
> - $var !~ /^(?:[a-z_]*?)_?[a-z][A-Z](?:_[a-z_]+)?$/) {
> +#Ignore SI style variants like nS, mV, MHz and dB (ie: max_uV, regulator_min_uA_show)
> + $var !~ /^(?:[a-z_]*?)_?[a-zA-Z]{1,3}(?:_[a-z_]+)?$/) {
> while ($var =~ m{($Ident)}g) {
> my $word = $1;
> next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);

I think this may miss too many uses like pDB and
other variables used for hungarian notations.

It may be better to enumerate the specific character
sequences to exempt.



\
 
 \ /
  Last update: 2014-11-08 02:21    [W:0.040 / U:0.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site