Skip to content

Commit

Permalink
checkpatch: add check for too short Kconfig descriptions
Browse files Browse the repository at this point in the history
I've seen various new Kconfigs with rather unhelpful one liner
descriptions.  Add a Kconfig warning for a minimum length of the Kconfig
help section.

Right now I arbitarily chose 4. The exact value can be debated.

[[email protected]: coding-style fixes]
Signed-off-by: Andi Kleen <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Andi Kleen authored and torvalds committed May 25, 2010
1 parent 965fd9e commit 3354957
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1382,6 +1382,21 @@ sub process {
ERROR("trailing whitespace\n" . $herevet);
}

# check for Kconfig help text having a real description
if ($realfile =~ /Kconfig/ &&
$line =~ /\+?\s*(---)?help(---)?$/) {
my $length = 0;
for (my $l = $linenr; defined($lines[$l]); $l++) {
my $f = $lines[$l];
$f =~ s/#.*//;
$f =~ s/^\s+//;
next if ($f =~ /^$/);
last if ($f =~ /^\s*config\s/);
$length++;
}
WARN("please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($length < 4);
}

# check we are in a valid source file if not then ignore this hunk
next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);

Expand Down

0 comments on commit 3354957

Please sign in to comment.