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

scripts: Use the block form for the grep function

Fixes BuiltinFunctions::RequireBlockGrep.
Guillem Jover лет назад: 13
Родитель
Сommit
8d5d625cfd
4 измененных файлов с 4 добавлено и 3 удалено
  1. 1 1
      scripts/dpkg-genchanges.pl
  2. 1 1
      scripts/dpkg-gencontrol.pl
  3. 1 1
      scripts/dpkg-source.pl
  4. 1 0
      test/100_critic.t

+ 1 - 1
scripts/dpkg-genchanges.pl

@@ -430,7 +430,7 @@ if (!is_binaryonly) {
 	any { m/\.(debian\.tar|diff)\.$ext$/ } $checksums->get_files())
     {
 	$origsrcmsg= _g('not including original source code in upload');
-	foreach my $f (grep m/\.orig(-.+)?\.tar\.$ext$/, $checksums->get_files()) {
+	foreach my $f (grep { m/\.orig(-.+)?\.tar\.$ext$/ } $checksums->get_files()) {
 	    $checksums->remove_file($f);
 	}
     } else {

+ 1 - 1
scripts/dpkg-gencontrol.pl

@@ -204,7 +204,7 @@ foreach (keys %{$pkg}) {
 	    $fields->{$_} = $v;
 	} else {
 	    my @archlist = split(/\s+/, $v);
-	    my @invalid_archs = grep m/[^\w-]/, @archlist;
+	    my @invalid_archs = grep { m/[^\w-]/ } @archlist;
 	    warning(ngettext("`%s' is not a legal architecture string.",
 			     "`%s' are not legal architecture strings.",
 			     scalar(@invalid_archs)),

+ 1 - 1
scripts/dpkg-source.pl

@@ -310,7 +310,7 @@ if ($options{opmode} =~ /^(-b|--print-format|--(before|after)-build|--commit)$/)
         }
     } else {
         # Minimize arch list, by removing arches already covered by wildcards
-        my @arch_wildcards = grep(debarch_is_wildcard($_), @sourcearch);
+        my @arch_wildcards = grep { debarch_is_wildcard($_) } @sourcearch;
         my @mini_sourcearch = @arch_wildcards;
         foreach my $arch (@sourcearch) {
             if (none { debarch_is($arch, $_) } @arch_wildcards) {

+ 1 - 0
test/100_critic.t

@@ -43,6 +43,7 @@ my @policies = qw(
     BuiltinFunctions::ProhibitUniversalIsa
     BuiltinFunctions::ProhibitVoidGrep
     BuiltinFunctions::ProhibitVoidMap
+    BuiltinFunctions::RequireBlockGrep
     BuiltinFunctions::RequireBlockMap
     BuiltinFunctions::RequireGlobFunction
     BuiltinFunctions::RequireSimpleSortBlock