Re: perlcritic and perltidy - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: perlcritic and perltidy
Date
Msg-id 4cd213e7-56e2-a99d-00bc-ad37271fc234@2ndQuadrant.com
Whole thread Raw
In response to Re: perlcritic and perltidy  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: perlcritic and perltidy  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: perlcritic and perltidy  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers

On 05/06/2018 11:53 AM, Tom Lane wrote:
> Andrew Dunstan <andrew.dunstan@2ndquadrant.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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: perlcritic and perltidy
Next
From: Tom Lane
Date:
Subject: Re: perlcritic and perltidy