aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2010-03-05 16:43:06 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-06 14:26:34 -0500
commit22dd5b0cba50a197aaa3bd2790a29ee2e8e4e372 (patch)
tree3447841bde2fef9b1adfa127549e50d15b940798
parent64f77f312b15f101bf6c4c65d5359ccc16e3f82b (diff)
get_maintainer: fix perlcritic warnings
perlcritic is a standard checker for Perl Best Practices. This patch fixes most of the warnings in the get_maintainer script. If kernel programmers are going to have checkpatch they should write clean scripts as well... Bareword file handle opened at line 176, column 1. See pages 202,204 of PBP. (Severity: 5) Two-argument "open" used at line 176, column 1. See page 207 of PBP. (Severity: 5) Bareword file handle opened at line 207, column 5. See pages 202,204 of PBP. (Severity: 5) Two-argument "open" used at line 207, column 5. See page 207 of PBP. (Severity: 5) Bareword file handle opened at line 246, column 6. See pages 202,204 of PBP. (Severity: 5) Two-argument "open" used at line 246, column 6. See page 207 of PBP. (Severity: 5) Bareword file handle opened at line 258, column 2. See pages 202,204 of PBP. (Severity: 5) Two-argument "open" used at line 258, column 2. See page 207 of PBP. (Severity: 5) Expression form of "eval" at line 983, column 17. See page 161 of PBP. (Severity: 5) Expression form of "eval" at line 985, column 17. See page 161 of PBP. (Severity: 5) Subroutine prototypes used at line 1186, column 1. See page 194 of PBP. (Severity: 5) Subroutine prototypes used at line 1206, column 1. See page 194 of PBP. (Severity: 5) Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-xscripts/get_maintainer.pl34
1 files changed, 20 insertions, 14 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index f8baeeb8c3f7..9bb094138dd8 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -185,8 +185,9 @@ if (!top_of_kernel_tree($lk_path)) {
185my @typevalue = (); 185my @typevalue = ();
186my %keyword_hash; 186my %keyword_hash;
187 187
188open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n"; 188open (my $maint, '<', "${lk_path}MAINTAINERS")
189while (<MAINT>) { 189 or die "$P: Can't open MAINTAINERS: $!\n";
190while (<$maint>) {
190 my $line = $_; 191 my $line = $_;
191 192
192 if ($line =~ m/^(\C):\s*(.*)/) { 193 if ($line =~ m/^(\C):\s*(.*)/) {
@@ -211,13 +212,14 @@ while (<MAINT>) {
211 push(@typevalue, $line); 212 push(@typevalue, $line);
212 } 213 }
213} 214}
214close(MAINT); 215close($maint);
215 216
216my %mailmap; 217my %mailmap;
217 218
218if ($email_remove_duplicates) { 219if ($email_remove_duplicates) {
219 open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n"; 220 open(my $mailmap, '<', "${lk_path}.mailmap")
220 while (<MAILMAP>) { 221 or warn "$P: Can't open .mailmap: $!\n";
222 while (<$mailmap>) {
221 my $line = $_; 223 my $line = $_;
222 224
223 next if ($line =~ m/^\s*#/); 225 next if ($line =~ m/^\s*#/);
@@ -236,7 +238,7 @@ if ($email_remove_duplicates) {
236 $mailmap{$name} = \@arr; 238 $mailmap{$name} = \@arr;
237 } 239 }
238 } 240 }
239 close(MAILMAP); 241 close($mailmap);
240} 242}
241 243
242## use the filenames on the command line or find the filenames in the patchfiles 244## use the filenames on the command line or find the filenames in the patchfiles
@@ -262,9 +264,10 @@ foreach my $file (@ARGV) {
262 if ($from_filename) { 264 if ($from_filename) {
263 push(@files, $file); 265 push(@files, $file);
264 if (-f $file && ($keywords || $file_emails)) { 266 if (-f $file && ($keywords || $file_emails)) {
265 open(FILE, "<$file") or die "$P: Can't open ${file}\n"; 267 open(my $f, '<', $file)
266 my $text = do { local($/) ; <FILE> }; 268 or die "$P: Can't open $file: $!\n";
267 close(FILE); 269 my $text = do { local($/) ; <$f> };
270 close($f);
268 if ($keywords) { 271 if ($keywords) {
269 foreach my $line (keys %keyword_hash) { 272 foreach my $line (keys %keyword_hash) {
270 if ($text =~ m/$keyword_hash{$line}/x) { 273 if ($text =~ m/$keyword_hash{$line}/x) {
@@ -280,8 +283,10 @@ foreach my $file (@ARGV) {
280 } else { 283 } else {
281 my $file_cnt = @files; 284 my $file_cnt = @files;
282 my $lastfile; 285 my $lastfile;
283 open(PATCH, "<$file") or die "$P: Can't open ${file}\n"; 286
284 while (<PATCH>) { 287 open(my $patch, '<', $file)
288 or die "$P: Can't open $file: $!\n";
289 while (<$patch>) {
285 my $patch_line = $_; 290 my $patch_line = $_;
286 if (m/^\+\+\+\s+(\S+)/) { 291 if (m/^\+\+\+\s+(\S+)/) {
287 my $filename = $1; 292 my $filename = $1;
@@ -301,7 +306,8 @@ foreach my $file (@ARGV) {
301 } 306 }
302 } 307 }
303 } 308 }
304 close(PATCH); 309 close($patch);
310
305 if ($file_cnt == @files) { 311 if ($file_cnt == @files) {
306 warn "$P: file '${file}' doesn't appear to be a patch. " 312 warn "$P: file '${file}' doesn't appear to be a patch. "
307 . "Add -f to options?\n"; 313 . "Add -f to options?\n";
@@ -1286,7 +1292,7 @@ sub rfc822_strip_comments {
1286 1292
1287# valid: returns true if the parameter is an RFC822 valid address 1293# valid: returns true if the parameter is an RFC822 valid address
1288# 1294#
1289sub rfc822_valid ($) { 1295sub rfc822_valid {
1290 my $s = rfc822_strip_comments(shift); 1296 my $s = rfc822_strip_comments(shift);
1291 1297
1292 if (!$rfc822re) { 1298 if (!$rfc822re) {
@@ -1306,7 +1312,7 @@ sub rfc822_valid ($) {
1306# from success with no addresses found, because an empty string is 1312# from success with no addresses found, because an empty string is
1307# a valid list. 1313# a valid list.
1308 1314
1309sub rfc822_validlist ($) { 1315sub rfc822_validlist {
1310 my $s = rfc822_strip_comments(shift); 1316 my $s = rfc822_strip_comments(shift);
1311 1317
1312 if (!$rfc822re) { 1318 if (!$rfc822re) {