aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@canonical.com>2009-01-06 17:41:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:17 -0500
commit21caa13c02d67f755fad50370996c489c34a9b15 (patch)
treeadc788fef2b0eedcdd4fa35c6b321644979e499a /scripts/checkpatch.pl
parent2b6db5cb65cb1276a7aa363a6e7335b0a8a68393 (diff)
checkpatch: fix the perlcritic errors
Clean up checkpatch using perlcritic. Signed-off-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl20
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 94371f69122c..bd6ac90d194c 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -69,7 +69,9 @@ my $dbg_possible = 0;
69my $dbg_type = 0; 69my $dbg_type = 0;
70my $dbg_attr = 0; 70my $dbg_attr = 0;
71for my $key (keys %debug) { 71for my $key (keys %debug) {
72 eval "\${dbg_$key} = '$debug{$key}';" 72 ## no critic
73 eval "\${dbg_$key} = '$debug{$key}';";
74 die "$@" if ($@);
73} 75}
74 76
75if ($terse) { 77if ($terse) {
@@ -206,9 +208,9 @@ my @dep_includes = ();
206my @dep_functions = (); 208my @dep_functions = ();
207my $removal = "Documentation/feature-removal-schedule.txt"; 209my $removal = "Documentation/feature-removal-schedule.txt";
208if ($tree && -f "$root/$removal") { 210if ($tree && -f "$root/$removal") {
209 open(REMOVE, "<$root/$removal") || 211 open(my $REMOVE, '<', "$root/$removal") ||
210 die "$P: $removal: open failed - $!\n"; 212 die "$P: $removal: open failed - $!\n";
211 while (<REMOVE>) { 213 while (<$REMOVE>) {
212 if (/^Check:\s+(.*\S)/) { 214 if (/^Check:\s+(.*\S)/) {
213 for my $entry (split(/[, ]+/, $1)) { 215 for my $entry (split(/[, ]+/, $1)) {
214 if ($entry =~ m@include/(.*)@) { 216 if ($entry =~ m@include/(.*)@) {
@@ -220,17 +222,21 @@ if ($tree && -f "$root/$removal") {
220 } 222 }
221 } 223 }
222 } 224 }
225 close($REMOVE);
223} 226}
224 227
225my @rawlines = (); 228my @rawlines = ();
226my @lines = (); 229my @lines = ();
227my $vname; 230my $vname;
228for my $filename (@ARGV) { 231for my $filename (@ARGV) {
232 my $FILE;
229 if ($file) { 233 if ($file) {
230 open(FILE, "diff -u /dev/null $filename|") || 234 open($FILE, '-|', "diff -u /dev/null $filename") ||
231 die "$P: $filename: diff failed - $!\n"; 235 die "$P: $filename: diff failed - $!\n";
236 } elsif ($filename eq '-') {
237 open($FILE, '<&STDIN');
232 } else { 238 } else {
233 open(FILE, "<$filename") || 239 open($FILE, '<', "$filename") ||
234 die "$P: $filename: open failed - $!\n"; 240 die "$P: $filename: open failed - $!\n";
235 } 241 }
236 if ($filename eq '-') { 242 if ($filename eq '-') {
@@ -238,11 +244,11 @@ for my $filename (@ARGV) {
238 } else { 244 } else {
239 $vname = $filename; 245 $vname = $filename;
240 } 246 }
241 while (<FILE>) { 247 while (<$FILE>) {
242 chomp; 248 chomp;
243 push(@rawlines, $_); 249 push(@rawlines, $_);
244 } 250 }
245 close(FILE); 251 close($FILE);
246 if (!process($filename)) { 252 if (!process($filename)) {
247 $exit = 1; 253 $exit = 1;
248 } 254 }