From: Stephen Hemminger <shemminger@vyatta.com>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 1/3] get_maintainer: fix perlcritic warnings
Date: Thu, 18 Feb 2010 23:01:09 -0800 [thread overview]
Message-ID: <20100219070130.698143797@vyatta.com> (raw)
In-Reply-To: <20100219070108.670062169@vyatta.com>
[-- Attachment #1: cleanup-get-maintainer.patch --]
[-- Type: text/plain, Size: 4089 bytes --]
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...
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
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)
--- a/scripts/get_maintainer.pl 2010-02-18 21:58:16.326458296 -0800
+++ b/scripts/get_maintainer.pl 2010-02-18 22:10:58.451944275 -0800
@@ -173,8 +173,9 @@ if (!top_of_kernel_tree($lk_path)) {
my @typevalue = ();
my %keyword_hash;
-open(MAINT, "<${lk_path}MAINTAINERS") || die "$P: Can't open MAINTAINERS\n";
-while (<MAINT>) {
+open (my $maint, '<', "${lk_path}MAINTAINERS")
+ or die "$P: Can't open MAINTAINERS: $!\n";
+while (<$maint>) {
my $line = $_;
if ($line =~ m/^(\C):\s*(.*)/) {
@@ -199,13 +200,14 @@ while (<MAINT>) {
push(@typevalue, $line);
}
}
-close(MAINT);
+close($maint);
my %mailmap;
if ($email_remove_duplicates) {
- open(MAILMAP, "<${lk_path}.mailmap") || warn "$P: Can't open .mailmap\n";
- while (<MAILMAP>) {
+ open(my $mailmap, '<', "${lk_path}.mailmap")
+ or warn "$P: Can't open .mailmap: $!\n";
+ while (<$mailmap>) {
my $line = $_;
next if ($line =~ m/^\s*#/);
@@ -224,7 +226,7 @@ if ($email_remove_duplicates) {
$mailmap{$name} = \@arr;
}
}
- close(MAILMAP);
+ close($mailmap);
}
## use the filenames on the command line or find the filenames in the patchfiles
@@ -243,20 +245,23 @@ foreach my $file (@ARGV) {
if ($from_filename) {
push(@files, $file);
if (-f $file && $keywords) {
- open(FILE, "<$file") or die "$P: Can't open ${file}\n";
- my $text = do { local($/) ; <FILE> };
+ open(my $f, '<', $file)
+ or die "$P: Can't open $file: $!\n";
+ my $text = do { local($/) ; <$f> };
foreach my $line (keys %keyword_hash) {
if ($text =~ m/$keyword_hash{$line}/x) {
push(@keyword_tvi, $line);
}
}
- close(FILE);
+ close($f);
}
} else {
my $file_cnt = @files;
my $lastfile;
- open(PATCH, "<$file") or die "$P: Can't open ${file}\n";
- while (<PATCH>) {
+
+ open(my $patch, '<', $file)
+ or die "$P: Can't open $file: $!\n";
+ while (<$patch>) {
my $patch_line = $_;
if (m/^\+\+\+\s+(\S+)/) {
my $filename = $1;
@@ -276,7 +281,8 @@ foreach my $file (@ARGV) {
}
}
}
- close(PATCH);
+ close($patch);
+
if ($file_cnt == @files) {
warn "$P: file '${file}' doesn't appear to be a patch. "
. "Add -f to options?\n";
@@ -1183,7 +1189,7 @@ sub rfc822_strip_comments {
# valid: returns true if the parameter is an RFC822 valid address
#
-sub rfc822_valid ($) {
+sub rfc822_valid {
my $s = rfc822_strip_comments(shift);
if (!$rfc822re) {
@@ -1203,7 +1209,7 @@ sub rfc822_valid ($) {
# from success with no addresses found, because an empty string is
# a valid list.
-sub rfc822_validlist ($) {
+sub rfc822_validlist {
my $s = rfc822_strip_comments(shift);
if (!$rfc822re) {
--
next prev parent reply other threads:[~2010-02-19 7:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-19 7:01 [PATCH 0/3] Get maintainer script cleanups Stephen Hemminger
2010-02-19 7:01 ` Stephen Hemminger [this message]
2010-02-19 16:07 ` [PATCH 1/3] get_maintainer: fix perlcritic warnings Joe Perches
2010-02-19 7:01 ` [PATCH 2/3] get_maintainer: use references and closures Stephen Hemminger
2010-02-19 16:08 ` Joe Perches
2010-02-19 7:01 ` [PATCH 3/3] get_maintainer: quote email address with period Stephen Hemminger
2010-02-19 16:08 ` Joe Perches
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=20100219070130.698143797@vyatta.com \
--to=shemminger@vyatta.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome