Explorar el Código

scripts: Initialize arrays with the qw() operator

Fixes CodeLayout::ProhibitQuotedWordLists.

Warned-by: perlcritic
Guillem Jover hace 13 años
padre
commit
9feb1c833b

+ 1 - 2
scripts/Dpkg/Vendor/Ubuntu.pm

@@ -126,8 +126,7 @@ sub run_hook {
 		    my @options = split(/,\s*/, $hardening);
 		    $hardening = 1;
 
-		    my @hardopts = ('format', 'fortify', 'stackprotector',
-				    'pie', 'relro');
+		    my @hardopts = qw(format fortify stackprotector pie relro);
 		    foreach my $item (@hardopts) {
 			my $upitem = uc($item);
 			foreach my $option (@options) {

+ 3 - 3
scripts/dpkg-buildpackage.pl

@@ -213,21 +213,21 @@ while (@ARGV) {
 	build_sourceonly && usageerr(_g('cannot combine %s and %s'), $_, '-S');
 	$include = BUILD_ARCH_DEP;
 	push @changes_opts, '-B';
-	@checkbuilddep_opts = ('-B');
+	@checkbuilddep_opts = qw(-B);
 	$buildtarget = 'build-arch';
 	$binarytarget = 'binary-arch';
     } elsif (/^-A$/) {
 	build_sourceonly && usageerr(_g('cannot combine %s and %s'), $_, '-S');
 	$include = BUILD_ARCH_INDEP;
 	push @changes_opts, '-A';
-	@checkbuilddep_opts = ('-A');
+	@checkbuilddep_opts = qw(-A);
 	$buildtarget = 'build-indep';
 	$binarytarget = 'binary-indep';
     } elsif (/^-S$/) {
 	build_binaryonly && usageerr(_g('cannot combine %s and %s'), build_opt, '-S');
 	$include = BUILD_SOURCE;
 	push @changes_opts, '-S';
-	@checkbuilddep_opts = ('-A', '-B');
+	@checkbuilddep_opts = qw(-A -B);
     } elsif (/^-F$/) {
 	!build_normal && usageerr(_g('cannot combine %s and %s'), $_, build_opt);
 	$include = BUILD_ALL;

+ 2 - 2
scripts/dpkg-name.pl

@@ -198,9 +198,9 @@ sub move($)
 
         my @command;
         if ($options{symlink}) {
-            @command = ('ln', '-s', '--');
+            @command = qw(ln -s --);
         } else {
-            @command = ('mv', '--');
+            @command = qw(mv --);
         }
 
         if (filesame($newname, $filename)) {

+ 2 - 2
scripts/dpkg-source.pl

@@ -303,9 +303,9 @@ if ($options{opmode} =~ /^(-b|--print-format|--(before|after)-build|--commit)$/)
         # If we encounter one 'any' then the other arches become insignificant
         # except for 'all' that must also be kept
         if (grep($_ eq 'all', @sourcearch)) {
-            @sourcearch = ('any', 'all');
+            @sourcearch = qw(any all);
         } else {
-            @sourcearch = ('any');
+            @sourcearch = qw(any);
         }
     } else {
         # Minimize arch list, by removing arches already covered by wildcards

+ 1 - 0
test/100_critic.t

@@ -44,6 +44,7 @@ my @policies = qw(
     ClassHierarchies::ProhibitAutoloading
     ClassHierarchies::ProhibitExplicitISA
     ClassHierarchies::ProhibitOneArgBless
+    CodeLayout::ProhibitQuotedWordLists
     CodeLayout::RequireConsistentNewlines
     ControlStructures::ProhibitLabelsWithSpecialBlockNames
     ControlStructures::ProhibitUntilBlocks