History

checkpatch: kconfig: check help texts for menuconfig and choice

Currently, only Kconfig symbols are checked for a missing or short help text, and are only checked if they are defined with the 'config' keyword. To make the check more general, extend it to also check help texts for choices and for symbols defined with the 'menuconfig' keyword. This increases the accuracy of the check for symbols that would already have been checked as well, since e.g. a 'menuconfig' symbol after a help text will be recognized as ending the preceding symbol/choice definition. To increase the accuracy of the check further, also recognize 'if', 'endif', 'menu', 'endmenu', 'endchoice', and 'source' as ending a symbol/choice definition.

Ulf Magnusson committed 8 years ago

Commit 678ae161 parent 86adf1a1 file · +11 −2Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+11−2
@@ -2797,7 +2797,10 @@ sub process { · 2796 unmodified lines
2797# Only applies when adding the entry originally, after that we do not have2797# Only applies when adding the entry originally, after that we do not have
2798# sufficient context to determine whether it is indeed long enough.2798# sufficient context to determine whether it is indeed long enough.
2799 if ($realfile =~ /Kconfig/ &&2799 if ($realfile =~ /Kconfig/ &&
2800 $line =~ /^\+\s*config\s+/) {2800 # 'choice' is usually the last thing on the line (though
2801 # Kconfig supports named choices), so use a word boundary
2802 # (\b) rather than a whitespace character (\s)
2803 $line =~ /^\+\s*(?:config|menuconfig|choice)\b/) {
2801 my $length = 0;2804 my $length = 0;
2802 my $cnt = $realcnt;2805 my $cnt = $realcnt;
2803 my $ln = $linenr + 1;2806 my $ln = $linenr + 1;
@@ -2822,7 +2825,13 @@ sub process { · 18 unmodified lines
2822 $f =~ s/#.*//;2825 $f =~ s/#.*//;
2823 $f =~ s/^\s+//;2826 $f =~ s/^\s+//;
2824 next if ($f =~ /^$/);2827 next if ($f =~ /^$/);
2825 if ($f =~ /^\s*config\s/) {2828
2829 # This only checks context lines in the patch
2830 # and so hopefully shouldn't trigger false
2831 # positives, even though some of these are
2832 # common words in help texts
2833 if ($f =~ /^\s*(?:config|menuconfig|choice|endchoice|
2834 if|endif|menu|endmenu|source)\b/x) {
2826 $is_end = 1;2835 $is_end = 1;
2827 last;2836 last;
2828 }2837 }