Re: pgsql: Fix perltidy breaking perlcritic

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Fix perltidy breaking perlcritic
Date: 2022-09-12 09:54:47
Message-ID: 8735cwncig.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:

> On Fri, Sep 9, 2022 at 10:44 PM John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
> wrote:
>
>> On Fri, Sep 9, 2022 at 3:32 AM Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>
>> > A better way do do this IMNSHO is to put the eval in a block on its own
>> along with the no critic marker on its own line, like this:
>> >
>> > {
>> > ## no critic (ProhibitStringyEval)
>> > eval ...
>> > }
>> >
>> > perlcritic respects block boundaries for its directives.
>>
>> I tried that in the attached -- it looks a bit nicer but requires more
>> explanation. I don't have strong feelings either way.
>>
>>
> Maybe even better would be just this, which I bet perltidy would not monkey
> with, and would require no explanation:
>
> eval "\$hash_ref = $_"; ## no critic (ProhibitStringyEval)

I didn't see this until it got committed, since I'm not subscribed to
-committers, but I think it would be even better to rely on the fact
that eval returns the value of the last expression in the string, which
also gets rid of the ugly quoting and escaping, per the attached.

- ilmari

Attachment Content-Type Size
0001-Use-return-value-of-eval-instead-of-assigning-inside.patch text/x-diff 1.2 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2022-09-12 11:05:39 pgsql: Fix NaN comparison in circle_same test
Previous Message Peter Eisentraut 2022-09-12 08:26:32 pgsql: pgstattuple: Use double consistently for percentages

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-09-12 10:42:31 Re: Introduce wait_for_subscription_sync for TAP tests
Previous Message Pavel Stehule 2022-09-12 09:30:02 Re: broken table formatting in psql