Sfoglia il codice sorgente

perl: Do not allow hard tabs anywhere other than leading position

Fixes CodeLayout::ProhibitHardTabs.

Warned-by: perlcritic
Guillem Jover 12 anni fa
parent
commit
f6ee09954c

+ 8 - 6
dselect/methods/Dselect/Ftp.pm

@@ -312,11 +312,11 @@ sub do_mdtm {
 
     #if ($has_mdtm) {
 	$time = $ftp->mdtm($file);
-#	my $code=$ftp->code();	my $message=$ftp->message();
+#	my $code = $ftp->code();
+#	my $message = $ftp->message();
 #	print " [ $code: $message ] ";
-	if ($ftp->code() == 502		      # MDTM not implemented
-	    || $ftp->code() == 500	      # command not understood (SUN firewall)
-	    ) {
+	if ($ftp->code() == 502 || # MDTM not implemented
+	    $ftp->code() == 500) { # command not understood (SUN firewall)
 	    $has_mdtm = 0;
 	} elsif (!$ftp->ok()) {
 	    return;
@@ -327,11 +327,13 @@ sub do_mdtm {
 	require Time::Local;
 
 	my @files = $ftp->dir($file);
-	if (($#files == -1) || ($ftp->code == 550)) { # No such file or directory
+	if (($#files == -1) ||
+	    ($ftp->code == 550)) { # No such file or directory
 	    return;
 	}
 
-#	my $code=$ftp->code();	my $message=$ftp->message();
+#	my $code = $ftp->code();
+#	my $message = $ftp->message();
 #	print " [ $code: $message ] ";
 
 #	print "[$#files]";

+ 2 - 1
dselect/methods/ftp/update

@@ -217,7 +217,8 @@ if($@) {
     $exit = 1;
 };
 
-if ($packages_modified) {	# don't clear if nothing changed
+# Don't clear if nothing changed.
+if ($packages_modified) {
     print <<'EOM';
 
 It is a good idea to clear the available list of old packages.

+ 2 - 2
dselect/mkcurkeys.pl

@@ -30,8 +30,8 @@ my (%over, %base, %name);
 open(my $override_fh, '<', $ARGV[0]) || die $!;
 while (<$override_fh>) {
     chomp;
-    /^#/ && next;		# skip comments
-    /\S/ || next;		# ignore blank lines
+    /^#/ && next; # skip comments
+    /\S/ || next; # ignore blank lines
     /^(\w+)\s+(\S.*\S)\s*$/ || die ("cannot parse line:\n$_\n");
     $over{$1}= $2;
     $base{$1}= '';

+ 1 - 1
scripts/Dpkg/Deps.pm

@@ -610,7 +610,7 @@ sub parse_string {
                 \s* (.*?)                   # don't parse architectures now
                 \s* \]                      # closing bracket
               )?                            # end of optional architecture
-	      \s*$			    # trailing spaces at end
+              \s*$                          # trailing spaces at end
             }x;
     if (defined($2)) {
 	return if $2 eq 'native' and not $self->{build_dep};

+ 29 - 29
scripts/Dpkg/Gettext.pm

@@ -29,35 +29,35 @@ use warnings;
 our $VERSION = '1.00';
 
 BEGIN {
-	eval 'use Locale::gettext';
-	if ($@) {
-		eval q{
-			sub _g {
-				return shift;
-			}
-			sub textdomain {
-			}
-			sub ngettext {
-				if ($_[2] == 1) {
-					return $_[0];
-				} else {
-					return $_[1];
-				}
-			}
-			sub P_ {
-				return ngettext(@_);
-			}
-		};
-	} else {
-		eval q{
-			sub _g {
-				return gettext(shift);
-			}
-			sub P_ {
-				return ngettext(@_);
-			}
-		};
-	}
+    eval 'use Locale::gettext';
+    if ($@) {
+        eval q{
+            sub _g {
+                return shift;
+            }
+            sub textdomain {
+            }
+            sub ngettext {
+                if ($_[2] == 1) {
+                    return $_[0];
+                } else {
+                    return $_[1];
+                }
+            }
+            sub P_ {
+                return ngettext(@_);
+            }
+        };
+    } else {
+        eval q{
+            sub _g {
+                return gettext(shift);
+            }
+            sub P_ {
+                return ngettext(@_);
+            }
+        };
+    }
 }
 
 use Exporter qw(import);

+ 27 - 27
scripts/Dpkg/Shlibs/SymbolFile.pm

@@ -31,33 +31,33 @@ use Dpkg::Arch qw(get_host_arch);
 use parent qw(Dpkg::Interface::Storable);
 
 my %blacklist = (
-    __bss_end__ => 1,			# arm
-    __bss_end => 1,			# arm
-    _bss_end__ => 1,			# arm
-    __bss_start => 1,			# ALL
-    __bss_start__ => 1,			# arm
-    __data_start => 1,			# arm
-    __do_global_ctors_aux => 1,		# ia64
-    __do_global_dtors_aux => 1,		# ia64
-    __do_jv_register_classes => 1,	# ia64
-    _DYNAMIC => 1,			# ALL
-    _edata => 1,			# ALL
-    _end => 1,				# ALL
-    __end__ => 1,			# arm
-    __exidx_end => 1,			# armel
-    __exidx_start => 1,			# armel
-    _fbss => 1,				# mips, mipsel
-    _fdata => 1,			# mips, mipsel
-    _fini => 1,				# ALL
-    _ftext => 1,			# mips, mipsel
-    _GLOBAL_OFFSET_TABLE_ => 1,		# hppa, mips, mipsel
-    __gmon_start__ => 1,		# hppa
-    __gnu_local_gp => 1,		# mips, mipsel
-    _gp => 1,				# mips, mipsel
-    _init => 1,				# ALL
-    _PROCEDURE_LINKAGE_TABLE_ => 1,	# sparc, alpha
-    _SDA2_BASE_ => 1,			# powerpc
-    _SDA_BASE_ => 1,			# powerpc
+    __bss_end__ => 1,                   # arm
+    __bss_end => 1,                     # arm
+    _bss_end__ => 1,                    # arm
+    __bss_start => 1,                   # ALL
+    __bss_start__ => 1,                 # arm
+    __data_start => 1,                  # arm
+    __do_global_ctors_aux => 1,         # ia64
+    __do_global_dtors_aux => 1,         # ia64
+    __do_jv_register_classes => 1,      # ia64
+    _DYNAMIC => 1,                      # ALL
+    _edata => 1,                        # ALL
+    _end => 1,                          # ALL
+    __end__ => 1,                       # arm
+    __exidx_end => 1,                   # armel
+    __exidx_start => 1,                 # armel
+    _fbss => 1,                         # mips, mipsel
+    _fdata => 1,                        # mips, mipsel
+    _fini => 1,                         # ALL
+    _ftext => 1,                        # mips, mipsel
+    _GLOBAL_OFFSET_TABLE_ => 1,         # hppa, mips, mipsel
+    __gmon_start__ => 1,                # hppa
+    __gnu_local_gp => 1,                # mips, mipsel
+    _gp => 1,                           # mips, mipsel
+    _init => 1,                         # ALL
+    _PROCEDURE_LINKAGE_TABLE_ => 1,     # sparc, alpha
+    _SDA2_BASE_ => 1,                   # powerpc
+    _SDA_BASE_ => 1,                    # powerpc
 );
 
 for my $i (14 .. 31) {

+ 7 - 7
scripts/dpkg-mergechangelogs.pl

@@ -40,13 +40,13 @@ sub join_lines($);
 BEGIN {
     eval 'use Algorithm::Merge qw(merge);';
     if ($@) {
-	eval q{
-	    sub merge {
-		my ($o, $a, $b) = @_;
-		return @$a if join("\n", @$a) eq join("\n", @$b);
-		return get_conflict_block($a, $b);
-	    }
-	};
+        eval q{
+            sub merge {
+                my ($o, $a, $b) = @_;
+                return @$a if join("\n", @$a) eq join("\n", @$b);
+                return get_conflict_block($a, $b);
+            }
+        };
     }
 }
 

+ 17 - 17
scripts/dpkg-scansources.pl

@@ -41,34 +41,34 @@ my $exit = 0;
 # the lists.
 
 my %override;
-sub O_PRIORITY		() { 0 }
-sub O_SECTION		() { 1 }
-sub O_MAINT_FROM	() { 2 } # undef for non-specific, else listref
-sub O_MAINT_TO		() { 3 } # undef if there's no maint override
+sub O_PRIORITY          () { 0 }
+sub O_SECTION           () { 1 }
+sub O_MAINT_FROM        () { 2 } # undef for non-specific, else listref
+sub O_MAINT_TO          () { 3 } # undef if there's no maint override
 my %extra_override;
 
 my %priority = (
-     'extra'		=> 1,
-     'optional'		=> 2,
-     'standard'		=> 3,
-     'important'	=> 4,
-     'required'		=> 5,
+    'extra' => 1,
+    'optional' => 2,
+    'standard' => 3,
+    'important' => 4,
+    'required' => 5,
 );
 
 # Switches
 
-my $debug	= 0;
-my $no_sort	= 0;
+my $debug = 0;
+my $no_sort = 0;
 my $src_override = undef;
 my $extra_override_file = undef;
 
 my @option_spec = (
-    'debug!'		=> \$debug,
-    'help|?'		=> sub { usage(); exit 0; },
-    'no-sort|n'		=> \$no_sort,
+    'debug!' => \$debug,
+    'help|?' => sub { usage(); exit 0; },
+    'no-sort|n' => \$no_sort,
     'source-override|s=s' => \$src_override,
     'extra-override|e=s' => \$extra_override_file,
-    'version'		=> \&version,
+    'version' => \&version,
 );
 
 sub debug {
@@ -303,8 +303,8 @@ sub main {
     }
     @ARGV >= 1 and @ARGV <= 3 or usageerr(_g('one to three arguments expected'));
 
-    push @ARGV, undef		if @ARGV < 2;
-    push @ARGV, ''		if @ARGV < 3;
+    push @ARGV, undef if @ARGV < 2;
+    push @ARGV, '' if @ARGV < 3;
     my ($dir, $override, $prefix) = @ARGV;
 
     load_override $override if defined $override;

+ 1 - 0
test/100_critic.t

@@ -50,6 +50,7 @@ my @policies = qw(
     ClassHierarchies::ProhibitAutoloading
     ClassHierarchies::ProhibitExplicitISA
     ClassHierarchies::ProhibitOneArgBless
+    CodeLayout::ProhibitHardTabs
     CodeLayout::ProhibitQuotedWordLists
     CodeLayout::ProhibitTrailingWhitespace
     CodeLayout::RequireConsistentNewlines