Re: perlcritic and perltidy
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>,
Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2018-05-08T11:53:32Z
Lists: pgsql-hackers
On 5/6/18 12:13, Andrew Dunstan wrote:
> Essentially it adds some vertical whitespace to structures so that the
> enclosing braces etc appear on their own lines. A very typical change
> looks like this:
>
> - { code => $code,
> + {
> + code => $code,
> ucs => $ucs,
> comment => $rest,
> direction => $direction,
> f => $in_file,
> - l => $. };
> + l => $.
> + };
The proposed changes certainly match the style we use in C better, which
is what some of the other settings were also informed by. So I'm in
favor of the changes -- for braces.
For parentheses, I'm not sure whether this is a good idea:
diff --git a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
index 2971e64..0d3184c 100755
--- a/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
+++ b/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
@@ -40,8 +40,11 @@ while (<$in>)
next if (($code & 0xFF) < 0xA1);
next
if (
- !( $code >= 0xA100 && $code <= 0xA9FF
- || $code >= 0xB000 && $code <= 0xF7FF));
+ !(
+ $code >= 0xA100 && $code <= 0xA9FF
+ || $code >= 0xB000 && $code <= 0xF7FF
+ )
+ );
next if ($code >= 0xA2A1 && $code <= 0xA2B0);
next if ($code >= 0xA2E3 && $code <= 0xA2E4);
In a manual C-style indentation, this would just be
next if (!($code >= 0xA100 && $code <= 0xA9FF
|| $code >= 0xB000 && $code <= 0xF7FF));
but somehow the indent runs have managed to spread this compact
expression over the entire screen.
Can we have separate settings for braces and parentheses?
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Don't force a blank line before comments in perl code
- 8a56ff484808 11.0 landed
-
Restrict vertical tightness to parentheses in Perl code
- 35361ee78890 11.0 landed