Re: cleaning perl code - Mailing list pgsql-hackers

From David Steele
Subject Re: cleaning perl code
Date
Msg-id 576f4248-32d7-05fe-7ab8-0ea835e4428c@pgmasters.net
Whole thread Raw
In response to Re: cleaning perl code  (Andrew Dunstan <andrew.dunstan@2ndquadrant.com>)
List pgsql-hackers
On 4/12/20 6:24 PM, Andrew Dunstan wrote:
> On 4/12/20 4:12 PM, David Steele wrote:
>>
>> Just in case it is useful, I have attached our old policy file with
>> exceptions and excuses (when we had one).
> 
> That's a pretty short list for --brutal, well done. I agree there is
> value in keeping documented the policies you're not complying with.
> Maybe the burden of that is too much for this use, that's up to the
> project to decide.

Thanks! Perl is, well Perl, and we made a lot of effort to keep it as 
clean and consistent as possible.

Obviously I'm +1 on documenting all the exceptions.

> For good or ill we now have a significant investment in perl code - I
> just looked and it's 180 files with 38,135 LOC, and that's not counting
> the catalog data files, so we have some interest in keeping it fairly clean.

Agreed. According to cloc pgBackRest still has 26,744 lines of Perl (not 
including comments or whitespace) so we're in the same boat.

> The absolutely minimal things I want to do are a) fix the code that
> we're agreed on fixing (use of warnings, idiomatic use of $/), and b)
> fix the output format to include the name of the policy being violated.

We found limiting results and being very verbose about the violation was 
extremely helpful:

perlcritic --quiet --verbose=8 --brutal --top=10 \
--verbose "[%p] %f: %m at line %l, column %c.  %e.  (Severity: %s)\n"
--profile=test/lint/perlcritic.policy \
<files>

-- 
-David
david@pgmasters.net



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: where should I stick that backup?
Next
From: David Steele
Date:
Subject: Re: where should I stick that backup?