Просмотр исходного кода

Dpkg::Deps: Use braces for multiline regexp

Fixes RegularExpressions::RequireBracesForMultiline.

Warned-by: perlcritic
Guillem Jover лет назад: 13
Родитель
Сommit
8d9cf6246f
2 измененных файлов с 3 добавлено и 2 удалено
  1. 2 2
      scripts/Dpkg/Deps.pm
  2. 1 0
      test/100_critic.t

+ 2 - 2
scripts/Dpkg/Deps.pm

@@ -585,7 +585,7 @@ sub parse {
 sub parse_string {
 sub parse_string {
     my ($self, $dep) = @_;
     my ($self, $dep) = @_;
     return if not $dep =~
     return if not $dep =~
-            /^\s*                           # skip leading whitespace
+           m{^\s*                           # skip leading whitespace
               ([a-zA-Z0-9][a-zA-Z0-9+.-]*)  # package name
               ([a-zA-Z0-9][a-zA-Z0-9+.-]*)  # package name
               (?:                           # start of optional part
               (?:                           # start of optional part
                 :                           # colon for architecture
                 :                           # colon for architecture
@@ -603,7 +603,7 @@ sub parse_string {
                 \s* \]                      # closing bracket
                 \s* \]                      # closing bracket
               )?                            # end of optional architecture
               )?                            # end of optional architecture
 	      \s*$			    # trailing spaces at end
 	      \s*$			    # trailing spaces at end
-            /x;
+            }x;
     if (defined($2)) {
     if (defined($2)) {
 	return if $2 eq 'native' and not $self->{build_dep};
 	return if $2 eq 'native' and not $self->{build_dep};
 	$self->{archqual} = $2;
 	$self->{archqual} = $2;

+ 1 - 0
test/100_critic.t

@@ -67,6 +67,7 @@ my @policies = qw(
     Modules::RequireExplicitPackage
     Modules::RequireExplicitPackage
     Modules::RequireFilenameMatchesPackage
     Modules::RequireFilenameMatchesPackage
     Objects::ProhibitIndirectSyntax
     Objects::ProhibitIndirectSyntax
+    RegularExpressions::RequireBracesForMultiline
     Subroutines::ProhibitExplicitReturnUndef
     Subroutines::ProhibitExplicitReturnUndef
     Subroutines::ProhibitNestedSubs
     Subroutines::ProhibitNestedSubs
     Subroutines::ProhibitReturnSort
     Subroutines::ProhibitReturnSort