Re: Cleaning up perl code

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Cleaning up perl code
Date: 2024-05-21 03:00:00
Message-ID: 730c8376-77db-5af6-ea2f-d530f68c5fa3@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Dagfinn,

Thank you for paying attention to it and improving the possible fix!

20.05.2024 23:39, Dagfinn Ilmari Mannsåker wrote:
> Nice cleanup! Did you use some static analysis tool, or did look for
> them manually?

I reviewed my collection of unica I gathered for several months, but had
found some of them too minor/requiring more analysis.
Then I added more with perlcritic's policy UnusedVariables, and also
checked for unused subs with a script from blogs.perl.org (and it confirmed
my only previous find of that kind).

> If I add [Variables::ProhibitUnusedVariables] to
> src/tools/perlcheck/perlcriticrc, it finds a few more, see the attached
> patch.

Yes, I saw unused $sqlstates, but decided that they are meaningful enough
to stay. Though maybe enabling ProhibitUnusedVariables justifies fixing
them too.

> The scripts parsing errcodes.txt really should be refactored into using
> a common module, but that's a patch for another day.

Agree, and I would leave 005_negotiate_encryption.pl (with $node_conf,
$server_config unused since d39a49c1e) aside for another day too.

Best regards,
Alexander

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-05-21 03:24:07 doc regexp_replace replacement string \n does not explained properly
Previous Message David Rowley 2024-05-21 02:58:10 Path to unreverting "Allow planner to use Merge Append to efficiently implement UNION"