On 05/08/2018 10:06 AM, Andrew Dunstan wrote:
> { find . -type f -a \( -name
> '*.pl' -o -name '*.pm' \) -print; find . -type f -perm -100
> -exec file {} \; -print | egrep -i
> ':.*perl[0-9]*\>' | cut -d: -f1; } | sort -u |
> xargs perlcritic --quiet --single CodeLayout::RequireTrailingCommas
Here's a diff of all the places it found fixed. At this stage I don't
think it's worth it. If someone wants to write a perlcritic policy that
identifies missing trailing commas reasonably comprehensively, we can
look again. Otherwise we should just clean them up as we come across them.
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index f387c86..ac19682 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -34,7 +34,7 @@ sub ParseHeader
'Oid' => 'oid',
'NameData' => 'name',
'TransactionId' => 'xid',
- 'XLogRecPtr' => 'pg_lsn');
+ 'XLogRecPtr' => 'pg_lsn',);
my %catalog;
my $declaring_attributes = 0;
diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index fb61db0..0a7d433 100644
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -245,7 +245,7 @@ my %lookup_kind = (
pg_operator => \%operoids,
pg_opfamily => \%opfoids,
pg_proc => \%procoids,
- pg_type => \%typeoids);
+ pg_type => \%typeoids,);
# Open temp files
@@ -631,7 +631,7 @@ sub gen_pg_attribute
{ name => 'cmin', type => 'cid' },
{ name => 'xmax', type => 'xid' },
{ name => 'cmax', type => 'cid' },
- { name => 'tableoid', type => 'oid' });
+ { name => 'tableoid', type => 'oid' },);
foreach my $attr (@SYS_ATTRS)
{
$attnum--;
diff --git a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
index a50f6f3..6d40d68 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
@@ -21,7 +21,7 @@ my $mapping = read_source("CP932.TXT");
my @reject_sjis = (
0xed40 .. 0xeefc, 0x8754 .. 0x875d, 0x878a, 0x8782,
0x8784, 0xfa5b, 0xfa54, 0x8790 .. 0x8792,
- 0x8795 .. 0x8797, 0x879a .. 0x879c);
+ 0x8795 .. 0x8797, 0x879a .. 0x879c,);
foreach my $i (@$mapping)
{
diff --git a/src/backend/utils/mb/Unicode/UCS_to_most.pl b/src/backend/utils/mb/Unicode/UCS_to_most.pl
index 4453449..26fd15d 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_most.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_most.pl
@@ -47,7 +47,7 @@ my %filename = (
'ISO8859_16' => '8859-16.TXT',
'KOI8R' => 'KOI8-R.TXT',
'KOI8U' => 'KOI8-U.TXT',
- 'GBK' => 'CP936.TXT');
+ 'GBK' => 'CP936.TXT',);
# make maps for all encodings if not specified
my @charsets = (scalar(@ARGV) > 0) ? @ARGV : sort keys(%filename);
diff --git a/src/interfaces/ecpg/preproc/check_rules.pl b/src/interfaces/ecpg/preproc/check_rules.pl
index 6c8b004..566de5d 100644
--- a/src/interfaces/ecpg/preproc/check_rules.pl
+++ b/src/interfaces/ecpg/preproc/check_rules.pl
@@ -43,7 +43,7 @@ my %replace_line = (
=> 'CREATE OptTemp TABLE create_as_target AS EXECUTE prepared_name execute_param_clause',
'PrepareStmtPREPAREnameprep_type_clauseASPreparableStmt' =>
- 'PREPARE prepared_name prep_type_clause AS PreparableStmt');
+ 'PREPARE prepared_name prep_type_clause AS PreparableStmt',);
my $block = '';
my $yaccmode = 0;
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 53efb57..6e3a62f 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -1470,7 +1470,7 @@ sub lsn
'flush' => 'pg_current_wal_flush_lsn()',
'write' => 'pg_current_wal_lsn()',
'receive' => 'pg_last_wal_receive_lsn()',
- 'replay' => 'pg_last_wal_replay_lsn()');
+ 'replay' => 'pg_last_wal_replay_lsn()',);
$mode = '<undef>' if !defined($mode);
croak "unknown mode for 'lsn': '$mode', valid modes are "
@@ -1657,7 +1657,7 @@ sub slot
my @columns = (
'plugin', 'slot_type', 'datoid', 'database',
'active', 'active_pid', 'xmin', 'catalog_xmin',
- 'restart_lsn');
+ 'restart_lsn',);
return $self->query_hash(
'postgres',
"SELECT __COLUMNS__ FROM pg_catalog.pg_replication_slots WHERE slot_name = '$slot_name'",
@@ -1696,7 +1696,7 @@ sub pg_recvlogical_upto
my @cmd = (
'pg_recvlogical', '-S', $slot_name, '--dbname',
- $self->connstr($dbname));
+ $self->connstr($dbname),);
push @cmd, '--endpos', $endpos;
push @cmd, '-f', '-', '--no-loop', '--start';
diff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.pl
index 824fa4d..dec17d0 100644
--- a/src/test/recovery/t/003_recovery_targets.pl
+++ b/src/test/recovery/t/003_recovery_targets.pl
@@ -119,19 +119,19 @@ test_recovery_standby('LSN', 'standby_5', $node_master, \@recovery_params,
@recovery_params = (
"recovery_target_name = '$recovery_name'",
"recovery_target_xid = '$recovery_txid'",
- "recovery_target_time = '$recovery_time'");
+ "recovery_target_time = '$recovery_time'",);
test_recovery_standby('name + XID + time',
'standby_6', $node_master, \@recovery_params, "3000", $lsn3);
@recovery_params = (
"recovery_target_time = '$recovery_time'",
"recovery_target_name = '$recovery_name'",
- "recovery_target_xid = '$recovery_txid'");
+ "recovery_target_xid = '$recovery_txid'",);
test_recovery_standby('time + name + XID',
'standby_7', $node_master, \@recovery_params, "2000", $lsn2);
@recovery_params = (
"recovery_target_xid = '$recovery_txid'",
"recovery_target_time = '$recovery_time'",
- "recovery_target_name = '$recovery_name'");
+ "recovery_target_name = '$recovery_name'",);
test_recovery_standby('XID + time + name',
'standby_8', $node_master, \@recovery_params, "4000", $lsn4);
@recovery_params = (
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
index 884c330..dc2d6ec 100644
--- a/src/tools/msvc/Install.pm
+++ b/src/tools/msvc/Install.pm
@@ -25,7 +25,7 @@ my @client_program_files = (
'libpgtypes', 'libpq', 'pg_basebackup', 'pg_config',
'pg_dump', 'pg_dumpall', 'pg_isready', 'pg_receivewal',
'pg_recvlogical', 'pg_restore', 'psql', 'reindexdb',
- 'vacuumdb', @client_contribs);
+ 'vacuumdb', @client_contribs,);
sub lcopy
{
@@ -80,7 +80,7 @@ sub Install
my @client_dirs = ('bin', 'lib', 'share', 'symbols');
my @all_dirs = (
@client_dirs, 'doc', 'doc/contrib', 'doc/extension', 'share/contrib',
- 'share/extension', 'share/timezonesets', 'share/tsearch_data');
+ 'share/extension', 'share/timezonesets', 'share/tsearch_data',);
if ($insttype eq "client")
{
EnsureDirectories($target, @client_dirs);
@@ -652,7 +652,7 @@ sub CopyIncludeFiles
EnsureDirectories("$target/include/server/$d");
my @args = (
'xcopy', '/s', '/i', '/q', '/r', '/y', "src\\include\\$d\\*.h",
- "$ctarget\\include\\server\\$d\\");
+ "$ctarget\\include\\server\\$d\\",);
system(@args) && croak("Failed to copy include directory $d\n");
}
closedir($D);
@@ -710,7 +710,7 @@ sub GenerateNLSFiles
"$nlspath\\bin\\msgfmt",
'-o',
"$target\\share\\locale\\$lang\\LC_MESSAGES\\$prgm-$majorver.mo",
- $_);
+ $_,);
system(@args) && croak("Could not run msgfmt on $dir\\$_");
print ".";
}
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index b2f5fd6..7551fe4 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -47,7 +47,7 @@ my @contrib_excludes = (
'ltree_plpython', 'pgcrypto',
'sepgsql', 'brin',
'test_extensions', 'test_pg_dump',
- 'snapshot_too_old');
+ 'snapshot_too_old',);
# Set of variables for frontend modules
my $frontend_defines = { 'initdb' => 'FRONTEND' };
@@ -55,11 +55,11 @@ my @frontend_uselibpq = ('pg_ctl', 'pg_upgrade', 'pgbench', 'psql', 'initdb');
my @frontend_uselibpgport = (
'pg_archivecleanup', 'pg_test_fsync',
'pg_test_timing', 'pg_upgrade',
- 'pg_waldump', 'pgbench');
+ 'pg_waldump', 'pgbench',);
my @frontend_uselibpgcommon = (
'pg_archivecleanup', 'pg_test_fsync',
'pg_test_timing', 'pg_upgrade',
- 'pg_waldump', 'pgbench');
+ 'pg_waldump', 'pgbench',);
my $frontend_extralibs = {
'initdb' => ['ws2_32.lib'],
'pg_restore' => ['ws2_32.lib'],
@@ -74,7 +74,7 @@ my $frontend_extrasource = {
[ 'src/bin/pgbench/exprscan.l', 'src/bin/pgbench/exprparse.y' ] };
my @frontend_excludes = (
'pgevent', 'pg_basebackup', 'pg_rewind', 'pg_dump',
- 'pg_waldump', 'scripts');
+ 'pg_waldump', 'scripts',);
sub mkvcbuild
{
@@ -626,7 +626,7 @@ sub mkvcbuild
(map { "-D$_" } @perl_embed_ccflags, $define || ()),
$source_file,
'/link',
- $perl_libs[0]);
+ $perl_libs[0],);
my $compile_output = `@cmd 2>&1`;
-f $exe || die "Failed to build Perl test:\n$compile_output";
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 3a88638..3ce8512 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -106,7 +106,7 @@ sub installcheck
"--schedule=${schedule}_schedule",
"--max-concurrent-tests=20",
"--encoding=SQL_ASCII",
- "--no-locale");
+ "--no-locale",);
push(@args, $maxconn) if $maxconn;
system(@args);
my $status = $? >> 8;
@@ -126,7 +126,7 @@ sub check
"--max-concurrent-tests=20",
"--encoding=SQL_ASCII",
"--no-locale",
- "--temp-instance=./tmp_check");
+ "--temp-instance=./tmp_check",);
push(@args, $maxconn) if $maxconn;
push(@args, $temp_config) if $temp_config;
system(@args);
@@ -152,7 +152,7 @@ sub ecpgcheck
"--schedule=${schedule}_schedule",
"--encoding=SQL_ASCII",
"--no-locale",
- "--temp-instance=./tmp_chk");
+ "--temp-instance=./tmp_chk",);
push(@args, $maxconn) if $maxconn;
system(@args);
$status = $? >> 8;
@@ -168,7 +168,7 @@ sub isolationcheck
"../../../$Config/pg_isolation_regress/pg_isolation_regress",
"--bindir=../../../$Config/psql",
"--inputdir=.",
- "--schedule=./isolation_schedule");
+ "--schedule=./isolation_schedule",);
push(@args, $maxconn) if $maxconn;
system(@args);
my $status = $? >> 8;
@@ -352,7 +352,7 @@ sub plcheck
my @args = (
"$topdir/$Config/pg_regress/pg_regress",
"--bindir=$topdir/$Config/psql",
- "--dbname=pl_regression", @lang_args, @tests);
+ "--dbname=pl_regression", @lang_args, @tests,);
system(@args);
my $status = $? >> 8;
exit $status if $status;
@@ -404,7 +404,7 @@ sub subdircheck
my @args = (
"$topdir/$Config/pg_regress/pg_regress",
"--bindir=${topdir}/${Config}/psql",
- "--dbname=contrib_regression", @opts, @tests);
+ "--dbname=contrib_regression", @opts, @tests,);
print join(' ',@args),"\n";
system(@args);
chdir "..";
@@ -553,7 +553,7 @@ sub upgradecheck
print "\nRunning pg_upgrade\n\n";
@args = (
'pg_upgrade', '-d', "$data.old", '-D', $data, '-b',
- $bindir, '-B', $bindir);
+ $bindir, '-B', $bindir,);
system(@args) == 0 or exit 1;
print "\nStarting new cluster\n\n";
@args = ('pg_ctl', '-l', "$logdir/postmaster2.log", 'start');