Re: perlcritic and perltidy

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: perlcritic and perltidy
Date: 2018-05-06 17:46:28
Message-ID: 20180506174628.GC27724@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
> > On 05/06/2018 11:53 AM, Tom Lane wrote:
> >> What sort of changes do we get if we remove those two flags as you prefer?
> >> It'd help to see some examples.
>
> > 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         => $.
> > +         };
>
> Hm. I have no strong opinion about whether this looks better or not;
> people who write more Perl than I do ought to weigh in.

I definitely prefer to have the braces on their own line- makes working
with the files a lot easier when you've got a lot of hashes
(particularly thinking about the hashes for the pg_dump regression
tests..). Having them on independent lines would have saved me quite a
few keystrokes when I reworked those tests.

> However, I do want to note that we've chosen the shorter style for
> the catalog .dat files, and that's enforced by reformat_dat_file.pl.
> I'd be against changing that decision, because one of the goals for
> the .dat file format was to minimize the risk of patches applying in
> the wrong place. Near-content-free lines containing just "{" or "},"
> would increase that risk by reducing the uniqueness of patch context
> lines.

I can understand that concern, though I don't think it really applies as
much to other the other perl code.

Thanks!

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yura Sokolov 2018-05-06 17:56:32 Re: [HACKERS] Clock with Adaptive Replacement
Previous Message Andrey Borodin 2018-05-06 17:28:59 Re: [HACKERS] Clock with Adaptive Replacement