linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Fix checks for Kconfig help text
@ 2017-11-10  6:32 Leo Yan
  2017-11-10  6:39 ` Leo Yan
  0 siblings, 1 reply; 2+ messages in thread
From: Leo Yan @ 2017-11-10  6:32 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, linux-kernel; +Cc: Leo Yan

If one patch has Kconfig section with only one 'config', then variable
'$is_start' will be set by first 'config' line and '$is_end' set by the
second 'config' line. But patches often has only one 'config' line so
we have no chance to set '$is_end', as result below condition is invalid
and it skips check for Kconfig description:

	if ($is_start && $is_end && $length < $min_conf_desc_length) {
		......
	}

When script runs to this condition sentence it means the Kconfig
section parsing has been completed, whatever '$is_end' is true
or not. So removes '$is_end' from condition sentence.

Another change is to change '$min_conf_desc_length' from 4 to 1; so can
pass the check if the Kconfig description has at least one line.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3453df9..ba724b0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -51,7 +51,7 @@ my $configuration_file = ".checkpatch.conf";
 my $max_line_length = 80;
 my $ignore_perl_version = 0;
 my $minimum_perl_version = 5.10.0;
-my $min_conf_desc_length = 4;
+my $min_conf_desc_length = 1;
 my $spelling_file = "$D/spelling.txt";
 my $codespell = 0;
 my $codespellfile = "/usr/share/codespell/dictionary.txt";
@@ -2796,7 +2796,7 @@ sub process {
 				}
 				$length++;
 			}
-			if ($is_start && $is_end && $length < $min_conf_desc_length) {
+			if ($is_start && $length < $min_conf_desc_length) {
 				WARN("CONFIG_DESCRIPTION",
 				     "please write a paragraph that describes the config symbol fully\n" . $herecurr);
 			}
-- 
2.7.4

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

* Re: [PATCH] checkpatch: Fix checks for Kconfig help text
  2017-11-10  6:32 [PATCH] checkpatch: Fix checks for Kconfig help text Leo Yan
@ 2017-11-10  6:39 ` Leo Yan
  0 siblings, 0 replies; 2+ messages in thread
From: Leo Yan @ 2017-11-10  6:39 UTC (permalink / raw)
  To: Andy Whitcroft, Joe Perches, linux-kernel

On Fri, Nov 10, 2017 at 02:32:37PM +0800, Leo Yan wrote:
> If one patch has Kconfig section with only one 'config', then variable
> '$is_start' will be set by first 'config' line and '$is_end' set by the
> second 'config' line. But patches often has only one 'config' line so
> we have no chance to set '$is_end', as result below condition is invalid
> and it skips check for Kconfig description:

Sorry for the bad commit log, I will send v2 for this.

> 	if ($is_start && $is_end && $length < $min_conf_desc_length) {
> 		......
> 	}
> 
> When script runs to this condition sentence it means the Kconfig
> section parsing has been completed, whatever '$is_end' is true
> or not. So removes '$is_end' from condition sentence.
> 
> Another change is to change '$min_conf_desc_length' from 4 to 1; so can
> pass the check if the Kconfig description has at least one line.
> 
> Signed-off-by: Leo Yan <leo.yan@linaro.org>
> ---
>  scripts/checkpatch.pl | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 3453df9..ba724b0 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -51,7 +51,7 @@ my $configuration_file = ".checkpatch.conf";
>  my $max_line_length = 80;
>  my $ignore_perl_version = 0;
>  my $minimum_perl_version = 5.10.0;
> -my $min_conf_desc_length = 4;
> +my $min_conf_desc_length = 1;
>  my $spelling_file = "$D/spelling.txt";
>  my $codespell = 0;
>  my $codespellfile = "/usr/share/codespell/dictionary.txt";
> @@ -2796,7 +2796,7 @@ sub process {
>  				}
>  				$length++;
>  			}
> -			if ($is_start && $is_end && $length < $min_conf_desc_length) {
> +			if ($is_start && $length < $min_conf_desc_length) {
>  				WARN("CONFIG_DESCRIPTION",
>  				     "please write a paragraph that describes the config symbol fully\n" . $herecurr);
>  			}
> -- 
> 2.7.4
> 

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

end of thread, other threads:[~2017-11-10  6:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-10  6:32 [PATCH] checkpatch: Fix checks for Kconfig help text Leo Yan
2017-11-10  6:39 ` Leo Yan

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).