From: Cruz Julian Bishop <cruzjbishop@gmail.com>
To: mcgrof@gmail.com
Cc: linux-kernel@vger.kernel.org, Cruz Julian Bishop <cruzjbishop@gmail.com>
Subject: [PATCH 4/4] scripts/checkincludes.pl: Introduce 'quiet' mode
Date: Fri, 31 Aug 2012 23:18:10 +1000 [thread overview]
Message-ID: <1346419090-3808-5-git-send-email-cruzjbishop@gmail.com> (raw)
In-Reply-To: <1346419090-3808-1-git-send-email-cruzjbishop@gmail.com>
In order to make checkincludes more like checkpatch in terms
of functionality, I have introduced a 'quiet' mode.
This mode can be turned on with the -q argument.
When not in quiet mode, each file that does not have duplicated
includes will have a message generated. Not having this is
sometimes annoying when performing checks on a single file
or directory without problems - "No output, does that mean it's
all good or I wrote the wrong command?"
Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
---
scripts/checkincludes.pl | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/scripts/checkincludes.pl b/scripts/checkincludes.pl
index cde7ce1..bff7316 100755
--- a/scripts/checkincludes.pl
+++ b/scripts/checkincludes.pl
@@ -20,11 +20,14 @@ By default, we just warn of duplicates.
Options:
-r Remove duplicated includes in place
+ -q Do not show messages for files that do not
+ have duplicated includes
EOM
exit 1;
}
my $remove = 0;
+my $quiet = 0;
if ($#ARGV < 0) {
usage();
@@ -35,6 +38,8 @@ my $argc = 0;
foreach my $arg (@ARGV) {
if ($arg eq "-r") {
$remove = 1;
+ } elsif($arg eq "-q") {
+ $quiet = 1;
} else {
open(my $f, '<', $arg)
or die "Cannot open $arg: $!.\n";
@@ -54,11 +59,16 @@ foreach my $arg (@ARGV) {
close($f);
if (!$remove) {
+ my $detected = 0;
foreach my $filename (keys %includedfiles) {
if ($includedfiles{$filename} > 1) {
+ $detected++;
print "$arg: $filename is included more than once.\n";
}
}
+ if (!$detected && !$quiet) {
+ print "$arg: No duplicated includes detected.\n";
+ }
next;
}
@@ -84,6 +94,8 @@ foreach my $arg (@ARGV) {
}
if ($dups > 0) {
print "$arg: removed $dups duplicate includes \n";
+ } elsif (!$quiet) {
+ print "$arg: no duplicated includes to remove \n";
}
close($f);
}
--
1.7.9.5
next prev parent reply other threads:[~2012-08-31 13:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-31 13:18 [PATCH 0/4] scripts/checkpatch.pl: A small step for Linux Cruz Julian Bishop
2012-08-31 13:18 ` [PATCH 1/4] scripts/checkincludes.pl: Print usage with heredoc Cruz Julian Bishop
2012-08-31 13:18 ` [PATCH 2/4] scripts/checkincludes.pl: Simplify and shorten argument logic Cruz Julian Bishop
2012-08-31 15:42 ` Joe Perches
2012-08-31 21:54 ` Cruz Julian Bishop
2012-08-31 13:18 ` [PATCH 3/4] scripts/checkincludes.pl: Fix a bug introduced in the last commit Cruz Julian Bishop
2012-08-31 13:18 ` Cruz Julian Bishop [this message]
2012-08-31 13:23 ` [PATCH 0/4] scripts/checkpatch.pl: A small step for Linux Cruz Julian Bishop
2012-08-31 18:09 ` Jesper Juhl
2012-08-31 21:55 ` Cruz Julian Bishop
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=1346419090-3808-5-git-send-email-cruzjbishop@gmail.com \
--to=cruzjbishop@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).