Message ID | 1510296157-13041-1-git-send-email-leo.yan@linaro.org |
---|---|
State | New |
Headers | show |
Series | [v2] checkpatch: Fix checks for Kconfig help text | expand |
On Fri, 2017-11-10 at 14:42 +0800, Leo Yan wrote: > If one patch has Kconfig section, the check script variable '$is_start' > will be set by first 'config' line and the variable '$is_end' is to be > set by the second 'config' line. But patches often only has 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 Kconfig description has at least one line. Hello Leo. I do not like this. Separate changes please and that $min_conf_desc_length change is definitely not a fix. It's a preference. > diff --git 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); > }
On Fri, Nov 10, 2017 at 05:42:27AM -0800, Joe Perches wrote: > On Fri, 2017-11-10 at 14:42 +0800, Leo Yan wrote: > > If one patch has Kconfig section, the check script variable '$is_start' > > will be set by first 'config' line and the variable '$is_end' is to be > > set by the second 'config' line. But patches often only has 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 Kconfig description has at least one line. > > Hello Leo. > > I do not like this. > > Separate changes please and that $min_conf_desc_length > change is definitely not a fix. It's a preference. Thank you for suggestion, Joe. Will send new patches soon. Thanks, Leo Yan > > diff --git 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); > > }
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); }
If one patch has Kconfig section, the check script variable '$is_start' will be set by first 'config' line and the variable '$is_end' is to be set by the second 'config' line. But patches often only has 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 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(-) -- 2.7.4