1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-29 22:49:41 +03:00

Clean up Perl code according to perlcritic

Fix all perlcritic warnings of severity level 5, except in
src/backend/utils/Gen_dummy_probes.pl, which is automatically generated.

Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
This commit is contained in:
Peter Eisentraut
2017-03-26 22:24:13 -04:00
parent de4da168d5
commit facde2a98f
41 changed files with 360 additions and 358 deletions

View File

@@ -14,7 +14,7 @@ my $kwlist_filename = $ARGV[1];
my $errors = 0;
sub error(@)
sub error
{
print STDERR @_;
$errors = 1;
@@ -29,18 +29,18 @@ $keyword_categories{'col_name_keyword'} = 'COL_NAME_KEYWORD';
$keyword_categories{'type_func_name_keyword'} = 'TYPE_FUNC_NAME_KEYWORD';
$keyword_categories{'reserved_keyword'} = 'RESERVED_KEYWORD';
open(GRAM, $gram_filename) || die("Could not open : $gram_filename");
open(my $gram, '<', $gram_filename) || die("Could not open : $gram_filename");
my ($S, $s, $k, $n, $kcat);
my $kcat;
my $comment;
my @arr;
my %keywords;
line: while (<GRAM>)
line: while (my $S = <$gram>)
{
chomp; # strip record separator
chomp $S; # strip record separator
$S = $_;
my $s;
# Make sure any braces are split
$s = '{', $S =~ s/$s/ { /g;
@@ -54,7 +54,7 @@ line: while (<GRAM>)
{
# Is this the beginning of a keyword list?
foreach $k (keys %keyword_categories)
foreach my $k (keys %keyword_categories)
{
if ($S =~ m/^($k):/)
{
@@ -66,7 +66,7 @@ line: while (<GRAM>)
}
# Now split the line into individual fields
$n = (@arr = split(' ', $S));
my $n = (@arr = split(' ', $S));
# Ok, we're in a keyword list. Go through each field in turn
for (my $fieldIndexer = 0; $fieldIndexer < $n; $fieldIndexer++)
@@ -109,15 +109,15 @@ line: while (<GRAM>)
push @{ $keywords{$kcat} }, $arr[$fieldIndexer];
}
}
close GRAM;
close $gram;
# Check that each keyword list is in alphabetical order (just for neatnik-ism)
my ($prevkword, $kword, $bare_kword);
foreach $kcat (keys %keyword_categories)
my ($prevkword, $bare_kword);
foreach my $kcat (keys %keyword_categories)
{
$prevkword = '';
foreach $kword (@{ $keywords{$kcat} })
foreach my $kword (@{ $keywords{$kcat} })
{
# Some keyword have a _P suffix. Remove it for the comparison.
@@ -149,12 +149,12 @@ while (my ($kcat, $kcat_id) = each(%keyword_categories))
# Now read in kwlist.h
open(KWLIST, $kwlist_filename) || die("Could not open : $kwlist_filename");
open(my $kwlist, '<', $kwlist_filename) || die("Could not open : $kwlist_filename");
my $prevkwstring = '';
my $bare_kwname;
my %kwhash;
kwlist_line: while (<KWLIST>)
kwlist_line: while (<$kwlist>)
{
my ($line) = $_;
@@ -219,7 +219,7 @@ kwlist_line: while (<KWLIST>)
}
}
}
close KWLIST;
close $kwlist;
# Check that we've paired up all keywords from gram.y with lines in kwlist.h
while (my ($kwcat, $kwcat_id) = each(%keyword_categories))