From: Erez Zadok <ezk@cs.sunysb.edu>
To: apw@shadowen.org, rdunlap@xenotime.net, jschopp@austin.ibm.com
Cc: linux-kernel@vger.kernel.org, Erez Zadok <ezk@cs.sunysb.edu>
Subject: [PATCH 2/3] CHECKPATCH: add terse output option to checkpatch.pl
Date: Fri, 5 Oct 2007 12:56:07 -0400 [thread overview]
Message-ID: <11916033691871-git-send-email-ezk@cs.sunysb.edu> (raw)
In-Reply-To: <11916033681196-git-send-email-ezk@cs.sunysb.edu>
Such terse output complies with g/cc and looks like
file_name:line_number:error_message
This output can be easily parsed within text editors (e.g., emacs/vim) that
can produce a split text screen showing in one screen the error message, and
in another screen the corresponding source file, with the cursor placed on
the offending line.
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
scripts/checkpatch.pl | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ecbb030..f8bd630 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -18,12 +18,14 @@ my $tree = 1;
my $chk_signoff = 1;
my $chk_patch = 1;
my $tst_type = 0;
+my $terse = 0; # terse ouput: report using g/cc error style
GetOptions(
'q|quiet' => \$quiet,
'tree!' => \$tree,
'signoff!' => \$chk_signoff,
'patch!' => \$chk_patch,
'test-type!' => \$tst_type,
+ 't|terse' => \$terse,
) or exit;
my $exit = 0;
@@ -34,6 +36,7 @@ if ($#ARGV < 0) {
print "options: -q => quiet\n";
print " --no-tree => run without a kernel tree\n";
print " --no-signoff => don't check for signed-off-by\n";
+ print " -t => report errors using terse cc-style output (implies -q)\n";
exit(1);
}
@@ -267,7 +270,16 @@ sub cat_vet {
my @report = ();
sub report {
- push(@report, $_[0]);
+ if (!$terse) {
+ push(@report, $_[0]);
+ return;
+ }
+ # if terse output, extract filename, linenumber, and short message;
+ # format them as a new one-line message and push onto report
+ my($msg, $location, @rest) = split(/\n/, $_[0]);
+ @rest = split(/: /, $location);
+ my($newreport) = sprintf("%s%s\n", $rest[2], $msg);
+ push(@report, $newreport);
}
sub report_dump {
@report;
@@ -1097,17 +1109,17 @@ sub process {
if ($chk_patch && !$is_patch) {
ERROR("Does not appear to be a unified-diff format patch\n");
}
- if ($is_patch && $chk_signoff && $signoff == 0) {
+ if ($terse == 0 && $is_patch && $chk_signoff && $signoff == 0) {
ERROR("Missing Signed-off-by: line(s)\n");
}
if ($clean == 0 && ($chk_patch || $is_patch)) {
print report_dump();
}
- if ($clean == 1 && $quiet == 0) {
+ if ($terse == 0 && $clean == 1 && $quiet == 0) {
print "Your patch has no obvious style problems and is ready for submission.\n"
}
- if ($clean == 0 && $quiet == 0) {
+ if ($terse == 0 && $clean == 0 && $quiet == 0) {
print "Your patch has style problems, please review. If any of these errors\n";
print "are false positives report them to the maintainer, see\n";
print "CHECKPATCH in MAINTAINERS.\n";
--
1.5.2.2
next prev parent reply other threads:[~2007-10-05 16:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-05 16:56 [PATCH] 0/3 checkpatch updates, new checkfiles script Erez Zadok
2007-10-05 16:56 ` [PATCH 1/3] CHECKPATCH: update usage string for checkpatch.pl Erez Zadok
2007-10-05 16:56 ` Erez Zadok [this message]
2007-10-05 16:56 ` [PATCH 3/3] CHECKFILES: new small shell script to check multiple source files Erez Zadok
2007-10-06 11:13 ` [PATCH] 0/3 checkpatch updates, new checkfiles script Ingo Molnar
2007-10-07 19:05 ` Erez Zadok
2007-10-11 13:47 ` Andy Whitcroft
2007-10-13 18:55 ` Erez Zadok
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=11916033691871-git-send-email-ezk@cs.sunysb.edu \
--to=ezk@cs.sunysb.edu \
--cc=apw@shadowen.org \
--cc=jschopp@austin.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
/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