kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [RFC PATCH] checkpatch: correctly detect lines of help text
       [not found]       ` <7a81a3c0-2734-4799-5b34-0a6279c1e59d@infradead.org>
@ 2020-12-03 19:04         ` Joe Perches
  2020-12-03 19:07           ` Randy Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2020-12-03 19:04 UTC (permalink / raw)
  To: Randy Dunlap, Nicolai Fischer, linux-kernel, Andi Kleen
  Cc: apw, johannes.czekay, kernel-janitors, linux-kernel-mentees,
	linux-kernel

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.

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:

arch/Kconfig:84:	help
arch/Kconfig-85-	 This option enables a transparent branch optimization that
arch/Kconfig:127:	help
arch/Kconfig-128-	 If function tracer is enabled and the arch supports full
arch/Kconfig:167:	help
arch/Kconfig-168-	 Modern versions of GCC (since 4.4) have builtin functions
arch/Kconfig:1056:       help
arch/Kconfig-1057-          An architecture should select this if its syscall numbering is sparse
arch/alpha/Kconfig:147:	help
arch/alpha/Kconfig-148-	  XL-233 and XL-266-based Alpha systems.
arch/arm/Kconfig:1001:       help
arch/arm/Kconfig-1002-	 This option enables the workaround for the 775420 Cortex-A9 (r2p2,
arch/arm/Kconfig-nommu:9:	help
arch/arm/Kconfig-nommu-10-	 Say Y to manually set the base addresses and sizes.
arch/arm/Kconfig.debug:24:	help
arch/arm/Kconfig.debug-25-		Generate a warning if any W+X mappings are found at boot.
arch/arm/mach-aspeed/Kconfig:21:	help
arch/arm/mach-aspeed/Kconfig-22-	 Say yes if you intend to run on an Aspeed ast2400 or similar
arch/arm/mach-aspeed/Kconfig:31:	help
arch/arm/mach-aspeed/Kconfig-32-	 Say yes if you intend to run on an Aspeed ast2500 or similar
arch/arm/mach-aspeed/Kconfig:42:	help
arch/arm/mach-aspeed/Kconfig-43-	 Say yes if you intend to run on an Aspeed ast2600 or similar
arch/arm/mach-imx/Kconfig:230:	help
arch/arm/mach-imx/Kconfig-231-		This enables support for Freescale i.MX7 Dual processor.
arch/arm/mach-ixp4xx/Kconfig:41:    help
arch/arm/mach-ixp4xx/Kconfig-42-	  Say 'Y' here if you want your kernel to support the Giant
arch/arm/mach-ixp4xx/Kconfig:178:	help
arch/arm/mach-ixp4xx/Kconfig-179-		This board is currently inside the Linksys WRV54G Gateways.
arch/arm/mach-ixp4xx/Kconfig:216:	help
arch/arm/mach-ixp4xx/Kconfig-217-          IXP4xx provides two methods of accessing PCI memory space:
arch/arm/mach-omap1/Kconfig:61:	help
arch/arm/mach-omap1/Kconfig-62-          TI OMAP 1510 or 1610 Innovator board support. Say Y here if you
arch/arm/mach-omap1/Kconfig:68:    	help
arch/arm/mach-omap1/Kconfig-69-	  TI OMAP 1610/1611B H2 board support. Say Y here if you have such
arch/arm/mach-omap1/Kconfig:75:    	help
arch/arm/mach-omap1/Kconfig-76-	  TI OMAP 1710 H3 board support. Say Y here if you have such
arch/arm/mach-omap1/Kconfig:88:    	help
arch/arm/mach-omap1/Kconfig-89-	  TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
arch/arm/mach-omap1/Kconfig:95:    	help
arch/arm/mach-omap1/Kconfig-96-	  The OSK supports an optional add-on board with a Quarter-VGA
arch/arm/mach-omap1/Kconfig:103:    	help
arch/arm/mach-omap1/Kconfig-104-	  Support for TI OMAP 730 Perseus2 board. Say Y here if you have such
arch/arm/mach-omap1/Kconfig:110:    	help
arch/arm/mach-omap1/Kconfig-111-	  Support for TI OMAP 850 F-Sample board. Say Y here if you have such
arch/arm/mach-omap1/Kconfig:126:	help
arch/arm/mach-omap1/Kconfig-127-	 Support for the Palm Zire71 PDA. To boot the kernel,
arch/arm/mach-omap1/Kconfig:175:	help
arch/arm/mach-omap1/Kconfig-176-          Support for generic OMAP-1510, 1610 or 1710 board with
arch/arm/mach-prima2/Kconfig:24:	help
arch/arm/mach-prima2/Kconfig-25-          Support for CSR SiRFSoC ARM Cortex A9 Platform

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] checkpatch: correctly detect lines of help text
  2020-12-03 19:04         ` [RFC PATCH] checkpatch: correctly detect lines of help text Joe Perches
@ 2020-12-03 19:07           ` Randy Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2020-12-03 19:07 UTC (permalink / raw)
  To: Joe Perches, Nicolai Fischer, linux-kernel, Andi Kleen
  Cc: apw, johannes.czekay, kernel-janitors, linux-kernel-mentees,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-03 19:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <133ac827-c0d2-c5c7-39d8-7d2c17de7c76@fau.de>
     [not found] ` <8436bc4191d92af283ea6aa7ca450e36da653e2e.camel@perches.com>
     [not found]   ` <16f0bfd4-61ca-48d8-c9ab-10bfc9a233ad@infradead.org>
     [not found]     ` <a83033e9fcc706be129e9c4c0d30a0542f13d406.camel@perches.com>
     [not found]       ` <7a81a3c0-2734-4799-5b34-0a6279c1e59d@infradead.org>
2020-12-03 19:04         ` [RFC PATCH] checkpatch: correctly detect lines of help text Joe Perches
2020-12-03 19:07           ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).