Messages in this thread Patch in this message | | | From | Cruz Julian Bishop <> | Subject | [PATCH 4/4] scripts/checkincludes.pl: Introduce 'quiet' mode | Date | Fri, 31 Aug 2012 23:18:10 +1000 |
| |
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
| |