Re: Cleaning up perl code

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cleaning up perl code
Date: 2024-07-02 15:38:01
Message-ID: 87tth7erdy.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

> On 2024-07-02 Tu 8:55 AM, Dagfinn Ilmari Mannsåker wrote:
>> Relatedly, I also had a look at prohibiting unused regex captures
>> (RegularExpressions::ProhibitUnusedCapture), which found a few real
>> cases, but also lots of false positives in Catalog.pm, because it
>> doesn't understand that %+ uses all named captures, so I won't propose a
>> patch for that until that's fixed upstream
>> (https://github.com/Perl-Critic/Perl-Critic/pull/1065)
>>
>
> We could mark Catalog.pm with a "## no critic (ProhibitUnusedCapture)"
> and then use the test elsewhere.

Yeah, that's what I've done for now. Here's a sequence of patches that
fixes the existing cases of unused captures, and adds the policy and
override.

The seg-validate.pl script seems unused, unmaintained and useless (it
doesn't actually match the syntax accepted by seg, specifcially the (+-)
syntax (which my patch fixes in passing)), so maybe we should just
delete it instead?

> cheers
>
> andrew

-ilmari

Attachment Content-Type Size
0001-seg-validate.pl-Use-qr-instead-of-strings-to-assembl.patch text/x-diff 1.6 KB
0002-Fix-unused-regular-expression-captures.patch text/x-diff 2.1 KB
0003-Prohibit-unused-regular-expression-captures.patch text/x-diff 1.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2024-07-02 16:02:38 [PoC] XMLCast (SQL/XML X025)
Previous Message Tomas Vondra 2024-07-02 15:11:52 Re: Parallel CREATE INDEX for GIN indexes