mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andy Whitcroft <apw@shadowen.org>
Subject: [PATCH 12/13] checkpatch: fix the perlcritic errors
Date: Sun,  7 Dec 2008 18:30:49 +0000	[thread overview]
Message-ID: <1228674650-24392-13-git-send-email-apw@shadowen.org> (raw)
In-Reply-To: <1228674650-24392-1-git-send-email-apw@shadowen.org>

From: Andy Whitcroft <apw@canonical.com>

Clean up checkpatch using perlcritic.

Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 scripts/checkpatch.pl |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 94371f6..bd6ac90 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -69,7 +69,9 @@ my $dbg_possible = 0;
 my $dbg_type = 0;
 my $dbg_attr = 0;
 for my $key (keys %debug) {
-	eval "\${dbg_$key} = '$debug{$key}';"
+	## no critic
+	eval "\${dbg_$key} = '$debug{$key}';";
+	die "$@" if ($@);
 }
 
 if ($terse) {
@@ -206,9 +208,9 @@ my @dep_includes = ();
 my @dep_functions = ();
 my $removal = "Documentation/feature-removal-schedule.txt";
 if ($tree && -f "$root/$removal") {
-	open(REMOVE, "<$root/$removal") ||
+	open(my $REMOVE, '<', "$root/$removal") ||
 				die "$P: $removal: open failed - $!\n";
-	while (<REMOVE>) {
+	while (<$REMOVE>) {
 		if (/^Check:\s+(.*\S)/) {
 			for my $entry (split(/[, ]+/, $1)) {
 				if ($entry =~ m@include/(.*)@) {
@@ -220,17 +222,21 @@ if ($tree && -f "$root/$removal") {
 			}
 		}
 	}
+	close($REMOVE);
 }
 
 my @rawlines = ();
 my @lines = ();
 my $vname;
 for my $filename (@ARGV) {
+	my $FILE;
 	if ($file) {
-		open(FILE, "diff -u /dev/null $filename|") ||
+		open($FILE, '-|', "diff -u /dev/null $filename") ||
 			die "$P: $filename: diff failed - $!\n";
+	} elsif ($filename eq '-') {
+		open($FILE, '<&STDIN');
 	} else {
-		open(FILE, "<$filename") ||
+		open($FILE, '<', "$filename") ||
 			die "$P: $filename: open failed - $!\n";
 	}
 	if ($filename eq '-') {
@@ -238,11 +244,11 @@ for my $filename (@ARGV) {
 	} else {
 		$vname = $filename;
 	}
-	while (<FILE>) {
+	while (<$FILE>) {
 		chomp;
 		push(@rawlines, $_);
 	}
-	close(FILE);
+	close($FILE);
 	if (!process($filename)) {
 		$exit = 1;
 	}
-- 
1.6.0.4.911.gc990


  parent reply	other threads:[~2008-12-07 18:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-07 18:30 [PATCH 00/13] update checkpatch to version 0.26 Andy Whitcroft
2008-12-07 18:30 ` [PATCH 01/13] checkpatch: update MAINTAINERS entry Andy Whitcroft
2008-12-07 18:30 ` [PATCH 02/13] checkpatch: update copyrights Andy Whitcroft
2008-12-07 18:30 ` [PATCH 03/13] checkpatch: Add warning for p0-patches Andy Whitcroft
2008-12-07 18:30 ` [PATCH 04/13] checkpatch: allow parentheses on return for comparisons Andy Whitcroft
2008-12-07 18:30 ` [PATCH 05/13] checkpatch: try to catch missing VMLINUX_SYMBOL() in vmlinux.lds.h Andy Whitcroft
2008-12-07 18:30 ` [PATCH 06/13] checkpatch: loosen spacing on typedef function checks Andy Whitcroft
2008-12-07 18:30 ` [PATCH 07/13] checkpatch: fix continuation detection when handling spacing on operators Andy Whitcroft
2008-12-07 18:30 ` [PATCH 08/13] checkpatch: track #ifdef/#else/#endif when tracking blocks Andy Whitcroft
2008-12-07 18:30 ` [PATCH 09/13] checkpatch: do not report nr_static as a static declaration Andy Whitcroft
2008-12-07 18:30 ` [PATCH 10/13] checkpatch: ensure we actually detect if assignments split across lines Andy Whitcroft
2008-12-07 18:30 ` [PATCH 11/13] checkpatch: struct file_operations should normally be const Andy Whitcroft
2008-12-09  0:30   ` Steven Rostedt
2008-12-07 18:30 ` Andy Whitcroft [this message]
2008-12-07 18:30 ` [PATCH 13/13] checkpatch: version: 0.26 Andy Whitcroft

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=1228674650-24392-13-git-send-email-apw@shadowen.org \
    --to=apw@shadowen.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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

all inboxes | Powered by JetHome®