Re: perlcritic and perltidy

From: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: perlcritic and perltidy
Date: 2018-05-06 16:13:44
Message-ID: 4cd213e7-56e2-a99d-00bc-ad37271fc234@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05/06/2018 11:53 AM, Tom Lane wrote:
> Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
>> The attached patch allows a clean run from the following script adapted
>> from pgperltidy:
> I'm hardly a perl expert, but those changes look reasonable.
>
>> w.r.t. perltidy, I note that our policy has these two lines:
>> --vertical-tightness=2
>> --vertical-tightness-closing=2
>> I've been looking at syncing the buildfarm client with our core code
>> perltidy settings. However, I don't actually like these two and I've
>> decided to exercise some editorial discretion and not use them.
> Okay ...
>
>> Note that the perltidy man page does suggest that these can make things
>> less readable, and it also states unequivocally "You must also use the
>> -lp flag when you use the -vt flag". That is the --line-up-parentheses
>> flag and it's something we don't use. Enabling it would generate about
>> 12k lines of diff.
> What sort of changes do we get if we remove those two flags as you prefer?
> It'd help to see some examples.
>
> Since we just went to a new perltidy version, and made some other
> policy changes for it, in HEAD, it'd make sense to make any further
> changes in this same release cycle rather than drip drip drip over
> multiple cycles. We just need to get some consensus about what
> style we like.

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         => $.
+         };

I am attaching the diff for a complete run with these two settings
removed. It's about 10k lines.

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
pgerltidy-no-verticaltightness.patch text/x-patch 299.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-05-06 16:34:06 Re: perlcritic and perltidy
Previous Message Tom Lane 2018-05-06 15:53:34 Re: perlcritic and perltidy