提交 a1385803 编写于 作者: A Andy Whitcroft 提交者: Linus Torvalds

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: NSteven Rostedt <rostedt@goodmis.org>
Tested-by: NSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: NAndy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 3e469cdc
...@@ -1674,19 +1674,26 @@ sub process { ...@@ -1674,19 +1674,26 @@ sub process {
# Only applies when adding the entry originally, after that we do not have # Only applies when adding the entry originally, after that we do not have
# sufficient context to determine whether it is indeed long enough. # sufficient context to determine whether it is indeed long enough.
if ($realfile =~ /Kconfig/ && if ($realfile =~ /Kconfig/ &&
$line =~ /\+\s*(?:---)?help(?:---)?$/) { $line =~ /.\s*config\s+/) {
my $length = 0; my $length = 0;
my $cnt = $realcnt; my $cnt = $realcnt;
my $ln = $linenr + 1; my $ln = $linenr + 1;
my $f; my $f;
my $is_start = 0;
my $is_end = 0; my $is_end = 0;
while ($cnt > 0 && defined $lines[$ln - 1]) { for (; $cnt > 0 && defined $lines[$ln - 1]; $ln++) {
$f = $lines[$ln - 1]; $f = $lines[$ln - 1];
$cnt-- if ($lines[$ln - 1] !~ /^-/); $cnt-- if ($lines[$ln - 1] !~ /^-/);
$is_end = $lines[$ln - 1] =~ /^\+/; $is_end = $lines[$ln - 1] =~ /^\+/;
$ln++;
next if ($f =~ /^-/); next if ($f =~ /^-/);
if ($lines[$ln - 1] =~ /.\s*(?:bool|tristate)\s*\"/) {
$is_start = 1;
} elsif ($lines[$ln - 1] =~ /.\s*(?:---)?help(?:---)?$/) {
$length = -1;
}
$f =~ s/^.//; $f =~ s/^.//;
$f =~ s/#.*//; $f =~ s/#.*//;
$f =~ s/^\s+//; $f =~ s/^\s+//;
...@@ -1698,8 +1705,8 @@ sub process { ...@@ -1698,8 +1705,8 @@ sub process {
$length++; $length++;
} }
WARN("CONFIG_DESCRIPTION", WARN("CONFIG_DESCRIPTION",
"please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($is_end && $length < 4); "please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($is_start && $is_end && $length < 4);
#print "is_end<$is_end> length<$length>\n"; #print "is_start<$is_start> is_end<$is_end> length<$length>\n";
} }
if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) && if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册