Skip to content

Commit 3354957

Browse files
Andi Kleentorvalds
Andi Kleen
authored andcommitted
checkpatch: add check for too short Kconfig descriptions
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]>
1 parent 965fd9e commit 3354957

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/checkpatch.pl

+15
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,21 @@ sub process {
13821382
ERROR("trailing whitespace\n" . $herevet);
13831383
}
13841384

1385+
# check for Kconfig help text having a real description
1386+
if ($realfile =~ /Kconfig/ &&
1387+
$line =~ /\+?\s*(---)?help(---)?$/) {
1388+
my $length = 0;
1389+
for (my $l = $linenr; defined($lines[$l]); $l++) {
1390+
my $f = $lines[$l];
1391+
$f =~ s/#.*//;
1392+
$f =~ s/^\s+//;
1393+
next if ($f =~ /^$/);
1394+
last if ($f =~ /^\s*config\s/);
1395+
$length++;
1396+
}
1397+
WARN("please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($length < 4);
1398+
}
1399+
13851400
# check we are in a valid source file if not then ignore this hunk
13861401
next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
13871402

0 commit comments

Comments
 (0)