pg-perlcritic-fix-misc-errors.patch
text/x-patch
Filename: pg-perlcritic-fix-misc-errors.patch
Type: text/x-patch
Part: 0
Message:
Re: cleaning perl code
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/catalog/genbki.pl | 1 | 1 |
| src/backend/parser/check_keywords.pl | 4 | 4 |
| src/common/unicode/generate-unicode_combining_table.pl | 1 | 1 |
| src/common/unicode/generate-unicode_normprops_table.pl | 1 | 1 |
| src/include/catalog/reformat_dat_file.pl | 1 | 1 |
| src/tools/perlcheck/perlcriticrc | 4 | 4 |
diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index da34124595..25b18e84c5 100644
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -590,7 +590,7 @@ EOM
# Special hack to generate OID symbols for pg_type entries
# that lack one.
- if ($catname eq 'pg_type' and !exists $bki_values{oid_symbol})
+ if ($catname eq 'pg_type' && !exists $bki_values{oid_symbol})
{
my $symbol = form_pg_type_symbol($bki_values{typname});
$bki_values{oid_symbol} = $symbol
diff --git a/src/backend/parser/check_keywords.pl b/src/backend/parser/check_keywords.pl
index 68d1f517b7..6b27fbf1be 100644
--- a/src/backend/parser/check_keywords.pl
+++ b/src/backend/parser/check_keywords.pl
@@ -44,12 +44,12 @@ line: while (my $S = <$gram>)
my $s;
# Make sure any braces are split
- $s = '{', $S =~ s/$s/ { /g;
- $s = '}', $S =~ s/$s/ } /g;
+ $s = '{'; $S =~ s/$s/ { /g;
+ $s = '}'; $S =~ s/$s/ } /g;
# Any comments are split
- $s = '[/][*]', $S =~ s#$s# /* #g;
- $s = '[*][/]', $S =~ s#$s# */ #g;
+ $s = '[/][*]'; $S =~ s#$s# /* #g;
+ $s = '[*][/]'; $S =~ s#$s# */ #g;
if (!($kcat))
{
diff --git a/src/common/unicode/generate-unicode_combining_table.pl b/src/common/unicode/generate-unicode_combining_table.pl
index e468a5f8c9..c984a903ee 100644
--- a/src/common/unicode/generate-unicode_combining_table.pl
+++ b/src/common/unicode/generate-unicode_combining_table.pl
@@ -18,7 +18,7 @@ print "/* generated by src/common/unicode/generate-unicode_combining_table.pl, d
print "static const struct mbinterval combining[] = {\n";
-foreach my $line (<ARGV>)
+while (my $line = <ARGV>)
{
chomp $line;
my @fields = split ';', $line;
diff --git a/src/common/unicode/generate-unicode_normprops_table.pl b/src/common/unicode/generate-unicode_normprops_table.pl
index c07a04a58a..ec4e8ea72a 100644
--- a/src/common/unicode/generate-unicode_normprops_table.pl
+++ b/src/common/unicode/generate-unicode_normprops_table.pl
@@ -26,7 +26,7 @@ typedef struct
} pg_unicode_normprops;
EOS
-foreach my $line (<ARGV>)
+while (my $line = <ARGV>)
{
chomp $line;
$line =~ s/\s*#.*$//;
diff --git a/src/include/catalog/reformat_dat_file.pl b/src/include/catalog/reformat_dat_file.pl
index 1cadbfd9f4..8bb4d0ab63 100755
--- a/src/include/catalog/reformat_dat_file.pl
+++ b/src/include/catalog/reformat_dat_file.pl
@@ -187,7 +187,7 @@ sub strip_default_values
# It's okay if we have no oid value, since it will be assigned
# automatically before bootstrap.
die "strip_default_values: $catname.$attname undefined\n"
- if !defined $row->{$attname} and $attname ne 'oid';
+ if !defined $row->{$attname} && $attname ne 'oid';
if (defined $column->{default}
and ($row->{$attname} eq $column->{default}))
diff --git a/src/tools/perlcheck/perlcriticrc b/src/tools/perlcheck/perlcriticrc
index 4130da460a..286d6ef122 100644
--- a/src/tools/perlcheck/perlcriticrc
+++ b/src/tools/perlcheck/perlcriticrc
@@ -31,21 +31,21 @@ verbose = %f: %m at line %l, column %c. %e. ([%p] Severity: %s)\n
[Variables::RequireLocalizedPunctuationVars]
allow = %ENV %SIG
+# default is 3 statements for a block with 'no strict'. Allow some more.
+[TestingAndDebugging::ProhibitProlongedStrictureOverride]
+statements = 8
+
# severity 4 policies currently violated
[-BuiltinFunctions::RequireBlockGrep]
[-BuiltinFunctions::RequireBlockMap]
-[-InputOutput::ProhibitReadlineInForLoop]
[-InputOutput::RequireBriefOpen]
[-Modules::ProhibitAutomaticExportation]
[-Modules::ProhibitMultiplePackages]
[-Objects::ProhibitIndirectSyntax]
[-Subroutines::RequireArgUnpacking]
[-TestingAndDebugging::ProhibitNoWarnings]
-[-TestingAndDebugging::ProhibitProlongedStrictureOverride]
-[-ValuesAndExpressions::ProhibitCommaSeparatedStatements]
[-ValuesAndExpressions::ProhibitConstantPragma]
-[-ValuesAndExpressions::ProhibitMixedBooleanOperators]
# severity 3 policies currently violated