mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Robert Elliott <elliott@hpe.com>,
	apw@canonical.com, dwaipayanray1@gmail.com,
	lukas.bulwahn@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/5] checkpatch: check line length in Kconfig help text
Date: Wed, 23 Nov 2022 17:04:22 -0800	[thread overview]
Message-ID: <b15978c31c043d198e33a4acc0959d4fde494e08.camel@perches.com> (raw)
In-Reply-To: <20221123011202.939319-4-elliott@hpe.com>

On Tue, 2022-11-22 at 19:12 -0600, Robert Elliott wrote:
> Apply the normal --max-line-length=nn line length checks to
> Kconfig help text.
> 
> The default of 100 is only triggered by one existing line in
> a file named Kconfig. Running with --max-line-length=80 reports
> only a few long lines:

Perhaps add a KCONFIG_LINE_LENGTH specific length.
Likely this should use 80 and not 100

> - 11 between 90 and 99 characters
> - 25 betwen 81 and 89 characters
> 9 of which are due to long URLs.
> 
> Signed-off-by: Robert Elliott <elliott@hpe.com>
> ---
>  scripts/checkpatch.pl | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index c907d5cf0ac8..1b7a98adcaeb 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -3496,7 +3496,7 @@ sub process {
>  				next if ($f =~ /^-/);
>  				last if ($f !~ /^[\+ ]/);	# !patch context
>  
> -				if ($f =~ /^[\+ ]\s*(?:bool|tristate|prompt)\s*["']/) {
> +				if ($f =~ /^[\+ ]\s*(?:bool|tristate|string|hex|int|prompt)\s*["']/) {
>  					$needs_help = 1;
>  					next;
>  				}
> @@ -3515,12 +3515,27 @@ sub process {
>  				# and so hopefully shouldn't trigger false
>  				# positives, even though some of these are
>  				# common words in help texts
> -				if ($f =~ /^(?:config|menuconfig|choice|endchoice|
> -					       if|endif|menu|endmenu|source)\b/x) {
> +				if ($f =~ /^(?:config|menuconfig|
> +					       choice|endchoice|
> +					       comment|if|endif|
> +					       menu|endmenu|source)\b/x) {
>  					last;
>  				}
> +
> +				# no further checking for lines with these keywords
> +				if ($f =~ /^(?:default|def_bool|depends|select|imply)\b/x) {
> +					next;
> +				}
> +
> +				my ($length, $indent) = line_stats($f);
> +				if ($length > $max_line_length) {
> +					WARN("CONFIG_DESCRIPTION",
> +					     "Kconfig help text line length ($length) too long: $f\n");
> +				}
> +
>  				$help_length++ if ($has_help);
>  			}
> +
>  			if ($needs_help &&
>  			    $help_length < $min_conf_desc_length) {
>  				my $stat_real = get_stat_real($linenr, $ln - 1);


  reply	other threads:[~2022-11-24  1:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15  4:15 [PATCH 0/3] checkpatch: enhance Kconfig parsing Robert Elliott
2022-08-15  4:15 ` [PATCH 1/3] checkpatch: improve Kconfig help text patch parsing Robert Elliott
2022-08-15  4:15 ` [PATCH 2/3] checkpatch: don't sanitise quotes in Kconfig files Robert Elliott
2022-08-15  4:15 ` [PATCH 3/3] checkpatch: check line length in Kconfig help text Robert Elliott
2022-11-23  1:11 ` [PATCH v2 0/5] checkpatch: enhance Kconfig parsing Robert Elliott
2022-11-23  1:11   ` [PATCH v2 1/5] checkpatch: improve Kconfig help text patch parsing Robert Elliott
2022-11-24  1:09     ` Joe Perches
2022-11-23  1:11   ` [PATCH v2 2/5] checkpatch: don't sanitise quotes in Kconfig files Robert Elliott
2022-11-23  1:12   ` [PATCH v2 3/5] checkpatch: check line length in Kconfig help text Robert Elliott
2022-11-24  1:04     ` Joe Perches [this message]
2022-11-23  1:12   ` [PATCH v2 4/5] checkpatch: discard processed lines Robert Elliott
2022-11-24  1:07     ` Joe Perches
2022-11-23  1:12   ` [PATCH v2 5/5] checkpatch: ignore a file named b Robert Elliott
2022-11-24  1:08     ` Joe Perches

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=b15978c31c043d198e33a4acc0959d4fde494e08.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=elliott@hpe.com \
    --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®