pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Steele <david@pgmasters.net>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Noah Misch <noah@leadboat.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: cleaning perl code
Date: Sun, 12 Apr 2020 18:45:44 -0400
Message-ID: <576f4248-32d7-05fe-7ab8-0ea835e4428c@pgmasters.net> (raw)
In-Reply-To: <a7654dc2-ebe8-712e-c25d-146ef7d7b42f@2ndQuadrant.com>
References: <e56f6fb6-38d5-8450-577c-24eb5d63f2e1@2ndQuadrant.com>
	<20200411043014.GA590991@rfd.leadboat.com>
	<27481.1586618092@sss.pgh.pa.us>
	<CA+TgmobP4TQHvj3nLCYUnmeqBc6n3Xb-q+b3CfvmoVxWS0qydw@mail.gmail.com>
	<757f9c47-ad93-8ca0-49ea-2b2ced58d103@pgmasters.net>
	<a7654dc2-ebe8-712e-c25d-146ef7d7b42f@2ndQuadrant.com>

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





view thread (34+ messages)  latest in thread

Message-ID: <576f4248-32d7-05fe-7ab8-0ea835e4428c@pgmasters.net>
Permalink:  ../576f4248-32d7-05fe-7ab8-0ea835e4428c@pgmasters.net/
Also on:    postgresql.org/message-id/576f4248-32d7-05fe-7ab8-0ea835e4428c@pgmasters.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: david@pgmasters.net, andrew.dunstan@2ndquadrant.com, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, noah@leadboat.com
  Subject: Re: cleaning perl code
  In-Reply-To: <576f4248-32d7-05fe-7ab8-0ea835e4428c@pgmasters.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox