Re: [RFC PATCH] checkpatch: correctly detect lines of help text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/3/20 11:04 AM, Joe Perches wrote:
> On Thu, 2020-12-03 at 10:31 -0800, Randy Dunlap wrote:
>> On 12/3/20 9:58 AM, Joe Perches wrote:
>>> On Wed, 2020-12-02 at 10:59 -0800, Randy Dunlap wrote:
>>>
>>>> There are also large hunks of block/Kconfig and drivers/hid/Kconfig
>>>> that don't use any indentation for help text...
>>>> in case that matters here.
>>>
>>> Maybe something like this could help.
>>>
>>> Indent the unindented help blocks by 2 spaces and reflow where appropriate.
>>>
>>> ---
>>>  block/Kconfig       | 105 +++++-----
>>>  drivers/hid/Kconfig | 549 +++++++++++++++++++++++++++-------------------------
>>>  2 files changed, 335 insertions(+), 319 deletions(-)
>>
>>
>> LGTM. Thanks.
> 
> btw: there appears to be ~750 help sections in Kconfig files
> that do not use 2 space indentation for the help content vs
> the ~14000 help sections that do use 2 space indentation.
> 
> Maybe there's some value in standardizing on the 2 space style.

coding-style.rst implies to mean that we have already done that:

For all of the Kconfig* configuration files throughout the source tree,
the indentation is somewhat different.  Lines under a ``config`` definition
are indented with one tab, while help text is indented an additional two
spaces.


> 
> A trivial script to show the sections that don't use 2 spaces:
> 
> $ git grep -n -A1 -P "^\s*help\s*$" -- '*/Kconfig*' |
>   grep -v '^--$' |
>   perl -e 'while (<>) {
>     my $line1 = $_;
>     my $line2 = <>;
> 
>     my $l1 = $line1;
>     my $l2 = $line2;
> 
>     chomp($l1);
>     chomp($l2);
> 
>     $l1 =~ s/^.*:\d+:(\s*).*/$1/;
>     $l2 =~ s/^.*-\d+-(\s*).*/$1/;
> 
>     if ("$l1  " ne "$l2") {
> 	print "$line1";
> 	print "$line2";
>     }
> }'
> 
> Change the ne to eq to see the matches.
> 
> For instance, a head -50 of the above is:
> 
[snip]

thanks.
-- 
~Randy




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux