Re: perlcritic and perltidy

Stephen Frost <sfrost@snowman.net>

From: Stephen Frost <sfrost@snowman.net>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: David Steele <david@pgmasters.net>, Michael Paquier <michael@paquier.xyz>, Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2018-05-08T16:51:20Z
Lists: pgsql-hackers
Greetings,

* Andrew Dunstan (andrew.dunstan@2ndquadrant.com) wrote:
> 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.
[...]
> 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;

There's not much point adding the ',' unless you're also putting the
');' on the next line, is there..?

Or is that going to be handled in a follow-up patch?

Thanks!

Stephen

Commits

  1. Don't force a blank line before comments in perl code

  2. Restrict vertical tightness to parentheses in Perl code