Преглед на файлове

Explicitly quote HEREDOC markers in perl code

This makes the HEREDOC quoting-style used explicit, so that it's obvious
if the code text will get interpolated or not.

Fixes ValuesAndExpressions::RequireQuotedHeredocTerminator.

Warned-by: perlcritic
Guillem Jover преди 13 години
родител
ревизия
57c5880205
променени са 5 файла, в които са добавени 16 реда и са изтрити 15 реда
  1. 1 1
      dselect/methods/Debian/Dselect/Ftp.pm
  2. 1 1
      dselect/methods/ftp/setup
  3. 1 1
      dselect/methods/ftp/update
  4. 12 12
      src/t/100_dpkg_divert.t
  5. 1 0
      test/100_critic.t

+ 1 - 1
dselect/methods/Debian/Dselect/Ftp.pm

@@ -169,7 +169,7 @@ sub edit_site {
   chomp($_ = <STDIN>);
   chomp($_ = <STDIN>);
   $site->[4] = $_ || $site->[4];
   $site->[4] = $_ || $site->[4];
 
 
-  print <<EOF;
+  print <<'EOF';
 
 
 If you're using anonymous ftp to retrieve files, enter your email
 If you're using anonymous ftp to retrieve files, enter your email
 address for use as a password. Otherwise enter your password,
 address for use as a password. Otherwise enter your password,

+ 1 - 1
dselect/methods/ftp/setup

@@ -76,7 +76,7 @@ if (! -d "debian") {
 
 
 $| = 1;
 $| = 1;
 
 
-print <<EOM;
+print <<"EOM";
 
 
 You must supply an ftp site, use of passive mode, username, password,
 You must supply an ftp site, use of passive mode, username, password,
 path to the debian directory,list of distributions you are interested
 path to the debian directory,list of distributions you are interested

+ 1 - 1
dselect/methods/ftp/update

@@ -226,7 +226,7 @@ if($@) {
 my $ans;
 my $ans;
 
 
 if ($packages_modified) {	# don't clear if nothing changed
 if ($packages_modified) {	# don't clear if nothing changed
-    print <<EOM;
+    print <<'EOM';
 
 
 It is a good idea to clear the available list of old packages.
 It is a good idea to clear the available list of old packages.
 However if you have only downloaded a Package files from non-main
 However if you have only downloaded a Package files from non-main

+ 12 - 12
src/t/100_dpkg_divert.t

@@ -62,7 +62,7 @@ sub install_filelist {
     close(L);
     close(L);
     # Only installed packages have their files list considered.
     # Only installed packages have their files list considered.
     open(S, ">> $admindir/status");
     open(S, ">> $admindir/status");
-    print S <<EOF;
+    print S <<"EOF";
 Package: $pkg
 Package: $pkg
 Status: install ok installed
 Status: install ok installed
 Version: 0
 Version: 0
@@ -203,7 +203,7 @@ cleanup();
 
 
 note("Querying information from diverts db (1)");
 note("Querying information from diverts db (1)");
 
 
-install_diversions(<<EOF);
+install_diversions(<<'EOF');
 /bin/sh
 /bin/sh
 /bin/sh.distrib
 /bin/sh.distrib
 dash
 dash
@@ -239,7 +239,7 @@ cleanup();
 
 
 note("Querying information from diverts db (2)");
 note("Querying information from diverts db (2)");
 
 
-install_diversions(<<EOF);
+install_diversions(<<'EOF');
 /bin/sh
 /bin/sh
 /bin/sh.distrib
 /bin/sh.distrib
 dash
 dash
@@ -261,7 +261,7 @@ cleanup();
 
 
 note("Adding diversion");
 note("Adding diversion");
 
 
-my $diversions_added_foo_local = <<EOF;
+my $diversions_added_foo_local = <<"EOF";
 $testdir/foo
 $testdir/foo
 $testdir/foo.distrib
 $testdir/foo.distrib
 :
 :
@@ -346,7 +346,7 @@ note("Adding diversion (7)");
 install_diversions('');
 install_diversions('');
 call_divert(['--quiet', '--rename', '--package', 'bash', "$testdir/foo"],
 call_divert(['--quiet', '--rename', '--package', 'bash', "$testdir/foo"],
             expect_stdout => '', expect_stderr => '');
             expect_stdout => '', expect_stderr => '');
-diversions_eq(<<EOF);
+diversions_eq(<<"EOF");
 $testdir/foo
 $testdir/foo
 $testdir/foo.distrib
 $testdir/foo.distrib
 bash
 bash
@@ -411,7 +411,7 @@ install_diversions('');
 
 
 call_divert(['--quiet', '--rename', '--add', "$testdir/zoo/foo"],
 call_divert(['--quiet', '--rename', '--add', "$testdir/zoo/foo"],
             expect_stderr => '', expect_stdout => '');
             expect_stderr => '', expect_stdout => '');
-diversions_eq(<<EOF);
+diversions_eq(<<"EOF");
 $testdir/zoo/foo
 $testdir/zoo/foo
 $testdir/zoo/foo.distrib
 $testdir/zoo/foo.distrib
 :
 :
@@ -429,7 +429,7 @@ call_divert(['--quiet', '--rename', '--add', '--package', 'coreutils', "$testdir
             expect_stderr => '', expect_stdout => '');
             expect_stderr => '', expect_stdout => '');
 ok(-e "$testdir/foo", "foo not renamed");
 ok(-e "$testdir/foo", "foo not renamed");
 ok(!-e "$testdir/foo.distrib", "foo renamed");
 ok(!-e "$testdir/foo.distrib", "foo renamed");
-diversions_eq(<<EOF);
+diversions_eq(<<"EOF");
 $testdir/foo
 $testdir/foo
 $testdir/foo.distrib
 $testdir/foo.distrib
 coreutils
 coreutils
@@ -462,7 +462,7 @@ call_divert(["--package", "baz", "--divert", "$testdir/foo.my", "--remove", "$te
 
 
 call_divert(["--divert", "$testdir/foo.distrib", "--remove", "$testdir/foo"],
 call_divert(["--divert", "$testdir/foo.distrib", "--remove", "$testdir/foo"],
             expect_stdout_like => qr,Removing.*\Q$testdir\E/foo,);
             expect_stdout_like => qr,Removing.*\Q$testdir\E/foo,);
-diversions_eq(<<EOF);
+diversions_eq(<<"EOF");
 $testdir/bar
 $testdir/bar
 $testdir/bar.distrib
 $testdir/bar.distrib
 :
 :
@@ -483,7 +483,7 @@ call_divert(["$testdir/baz"]);
 
 
 call_divert(["--remove", "$testdir/bar"],
 call_divert(["--remove", "$testdir/bar"],
             expect_stdout_like => qr,Removing.*\Q$testdir\E/bar,);
             expect_stdout_like => qr,Removing.*\Q$testdir\E/bar,);
-diversions_eq(<<EOF);
+diversions_eq(<<"EOF");
 $testdir/foo
 $testdir/foo
 $testdir/foo.distrib
 $testdir/foo.distrib
 :
 :
@@ -504,7 +504,7 @@ call_divert(["--package", "bash", "$testdir/baz"]);
 
 
 call_divert(["--quiet", "--package", "bash", "--remove", "$testdir/baz"],
 call_divert(["--quiet", "--package", "bash", "--remove", "$testdir/baz"],
             expect_stdout => '', expect_stderr => '');
             expect_stdout => '', expect_stderr => '');
-diversions_eq(<<EOF);
+diversions_eq(<<"EOF");
 $testdir/foo
 $testdir/foo
 $testdir/foo.distrib
 $testdir/foo.distrib
 :
 :
@@ -549,14 +549,14 @@ SKIP: {
     system("chmod 644 $admindir/diversions");
     system("chmod 644 $admindir/diversions");
 }
 }
 
 
-install_diversions(<<EOF);
+install_diversions(<<'EOF');
 /bin/sh
 /bin/sh
 EOF
 EOF
 
 
 call_divert_sort(['--list'], expect_failure => 1,
 call_divert_sort(['--list'], expect_failure => 1,
             expect_stderr_like => qr/(corrupt|unexpected eof)/, expect_stdout => '');
             expect_stderr_like => qr/(corrupt|unexpected eof)/, expect_stdout => '');
 
 
-install_diversions(<<EOF);
+install_diversions(<<'EOF');
 /bin/sh
 /bin/sh
 bash
 bash
 EOF
 EOF

+ 1 - 0
test/100_critic.t

@@ -67,6 +67,7 @@ my @policies = qw(
     ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator
     ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator
     ValuesAndExpressions::ProhibitVersionStrings
     ValuesAndExpressions::ProhibitVersionStrings
     ValuesAndExpressions::RequireConstantVersion
     ValuesAndExpressions::RequireConstantVersion
+    ValuesAndExpressions::RequireQuotedHeredocTerminator
     ValuesAndExpressions::RequireUpperCaseHeredocTerminator
     ValuesAndExpressions::RequireUpperCaseHeredocTerminator
     Variables::ProhibitAugmentedAssignmentInDeclaration
     Variables::ProhibitAugmentedAssignmentInDeclaration
     Variables::ProhibitPerl4PackageNames
     Variables::ProhibitPerl4PackageNames