From: Andy Whitcroft <apw@canonical.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 09/16] checkpatch: ensure kconfig help checks only apply when we are adding help
Date: Wed, 18 Aug 2010 16:46:42 +0100 [thread overview]
Message-ID: <1282146409-30544-10-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <1282146409-30544-1-git-send-email-apw@canonical.com>
When checking the length of the help we need to be sure we are seeing
the whole story before erroring. Firstly we only want to check when
adding the help in the first place. Second we need to be sure that we
are seeing the end of the entry, nominally when there is no context below
or that context shows the start of the next entry.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
scripts/checkpatch.pl | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index cb19f54..e44ff91 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1400,18 +1400,34 @@ sub process {
}
# check for Kconfig help text having a real description
+# Only applies when adding the entry originally, after that we do not have
+# sufficient context to determine whether it is indeed long enough.
if ($realfile =~ /Kconfig/ &&
- $line =~ /\+?\s*(---)?help(---)?$/) {
+ $line =~ /\+\s*(?:---)?help(?:---)?$/) {
my $length = 0;
- for (my $l = $linenr; defined($lines[$l]); $l++) {
- my $f = $lines[$l];
+ my $cnt = $realcnt;
+ my $ln = $linenr + 1;
+ my $f;
+ my $is_end = 0;
+ while ($cnt > 0 && defined $lines[$ln - 1]) {
+ $f = $lines[$ln - 1];
+ $cnt-- if ($lines[$ln - 1] !~ /^-/);
+ $is_end = $lines[$ln - 1] =~ /^\+/;
+ $ln++;
+
+ next if ($f =~ /^-/);
+ $f =~ s/^.//;
$f =~ s/#.*//;
$f =~ s/^\s+//;
next if ($f =~ /^$/);
- last if ($f =~ /^\s*config\s/);
+ if ($f =~ /^\s*config\s/) {
+ $is_end = 1;
+ last;
+ }
$length++;
}
- WARN("please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($length < 4);
+ WARN("please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($is_end && $length < 4);
+ #print "is_end<$is_end> length<$length>\n";
}
# check we are in a valid source file if not then ignore this hunk
--
1.7.0.4
next prev parent reply other threads:[~2010-08-18 15:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 15:46 [PATCH 00/16] update checkpatch to v0.31 Andy Whitcroft
2010-08-18 15:46 ` [PATCH 01/16] checkpatch: fix regressions in "fix handling of leading spaces" Andy Whitcroft
2010-08-18 15:46 ` [PATCH 02/16] checkpatch: types may sit on a line on their own Andy Whitcroft
2010-08-18 15:46 ` [PATCH 03/16] checkpatch: suggest cleanpatch and cleanfile when appropriate Andy Whitcroft
2010-08-18 15:46 ` [PATCH 04/16] checkpatch: ensure we do not collapse bracketed sections into constants Andy Whitcroft
2010-08-18 15:46 ` [PATCH 05/16] checkpatch: handle casts better fixing false categorisation of : as binary Andy Whitcroft
2010-08-18 15:46 ` [PATCH 06/16] checkpatch: returning errno typically should be negative Andy Whitcroft
2010-08-18 15:46 ` [PATCH 07/16] checkpatch: add check for space after struct, union, and enum Andy Whitcroft
2010-08-18 15:46 ` [PATCH 08/16] checkpatch: simplify and consolidate "missing space after" checks Andy Whitcroft
2010-08-18 15:46 ` Andy Whitcroft [this message]
2010-08-18 15:46 ` [PATCH 10/16] checkpatch: check for incorrect permissions Andy Whitcroft
2010-08-18 15:46 ` [PATCH 11/16] checkpatch: Add additional attribute #defines Andy Whitcroft
2010-08-18 15:46 ` [PATCH 12/16] checkpatch: update copyright dates Andy Whitcroft
2010-08-18 15:46 ` [PATCH 13/16] checkpatch: clean up structure definition macro handline Andy Whitcroft
2010-08-18 15:46 ` [PATCH 14/16] checkpatch: handle EXPORT_SYMBOL for DEVICE_ATTR and similar Andy Whitcroft
2010-08-18 15:46 ` [PATCH 15/16] checkpatch: statement/block context analyser should look at sanitised lines Andy Whitcroft
2010-08-18 15:46 ` [PATCH 16/16] checkpatch: version 0.31 Andy Whitcroft
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282146409-30544-10-git-send-email-apw@canonical.com \
--to=apw@canonical.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®