Ver código fonte

Test::Dpkg: Use x modifier on a long regex

Addresses RegularExpressions::RequireExtendedFormatting.

Warned-by: perlcritic
Guillem Jover 9 anos atrás
pai
commit
e169dfcb23
1 arquivos alterados com 18 adições e 1 exclusões
  1. 18 1
      scripts/Test/Dpkg.pm

+ 18 - 1
scripts/Test/Dpkg.pm

@@ -111,7 +111,24 @@ sub test_neutralize_checksums
     open my $fh, '<', $filename or die;
     open my $fh, '<', $filename or die;
     while (<$fh>) {
     while (<$fh>) {
         s/^ ([0-9a-f]{32,}) [1-9][0-9]* /q{ } . $1 =~ tr{0-9a-f}{0}r . q{ 0 }/e;
         s/^ ([0-9a-f]{32,}) [1-9][0-9]* /q{ } . $1 =~ tr{0-9a-f}{0}r . q{ 0 }/e;
-        s/^( 0{32,} 0(?: [\w]* [\w]*)? [^_]*_[^_]*)_[^.]*\.(buildinfo)$/$1_20160101T123000z-00000000.$2/;
+        s{^
+            (
+                \s
+                # Digest
+                0{32,}
+                \s
+                # Size
+                0
+                # Optional Section and Priority
+                (?:\s[\w]*\s[\w]*)?
+                \s
+                # Filename (package and version)
+                [^_]*_[^_]*
+            )
+            # Filename (architecture and extension)
+            _[^.]*\.(buildinfo)
+            $
+        }{$1_20160101T123000z-00000000.$2}x;
         print { $fhnew } $_;
         print { $fhnew } $_;
     }
     }
     close $fh or die;
     close $fh or die;