Skip to content

Commit a138580

Browse files
Andy Whitcrofttorvalds
authored andcommitted
checkpatch: only apply kconfig help checks for options which prompt
The intent of this check is to catch the options which the user will see and ensure they are properly described. It is also common for internal only options to have a brief description. Allow this form. Reported-by: Steven Rostedt <rostedt@goodmis.org> Tested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Andy Whitcroft <apw@canonical.com> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3e469cd commit a138580

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

scripts/checkpatch.pl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,19 +1674,26 @@ sub process {
16741674
# Only applies when adding the entry originally, after that we do not have
16751675
# sufficient context to determine whether it is indeed long enough.
16761676
if ($realfile =~ /Kconfig/ &&
1677-
$line =~ /\+\s*(?:---)?help(?:---)?$/) {
1677+
$line =~ /.\s*config\s+/) {
16781678
my $length = 0;
16791679
my $cnt = $realcnt;
16801680
my $ln = $linenr + 1;
16811681
my $f;
1682+
my $is_start = 0;
16821683
my $is_end = 0;
1683-
while ($cnt > 0 && defined $lines[$ln - 1]) {
1684+
for (; $cnt > 0 && defined $lines[$ln - 1]; $ln++) {
16841685
$f = $lines[$ln - 1];
16851686
$cnt-- if ($lines[$ln - 1] !~ /^-/);
16861687
$is_end = $lines[$ln - 1] =~ /^\+/;
1687-
$ln++;
16881688

16891689
next if ($f =~ /^-/);
1690+
1691+
if ($lines[$ln - 1] =~ /.\s*(?:bool|tristate)\s*\"/) {
1692+
$is_start = 1;
1693+
} elsif ($lines[$ln - 1] =~ /.\s*(?:---)?help(?:---)?$/) {
1694+
$length = -1;
1695+
}
1696+
16901697
$f =~ s/^.//;
16911698
$f =~ s/#.*//;
16921699
$f =~ s/^\s+//;
@@ -1698,8 +1705,8 @@ sub process {
16981705
$length++;
16991706
}
17001707
WARN("CONFIG_DESCRIPTION",
1701-
"please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($is_end && $length < 4);
1702-
#print "is_end<$is_end> length<$length>\n";
1708+
"please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($is_start && $is_end && $length < 4);
1709+
#print "is_start<$is_start> is_end<$is_end> length<$length>\n";
17031710
}
17041711

17051712
if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&

0 commit comments

Comments
 (0)