Re: pgsql: Fix precedence problem in new Perl code.

From: Mike Blackwell <mike(dot)blackwell(at)rrd(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Fix precedence problem in new Perl code.
Date: 2018-05-04 21:28:10
Message-ID: CANPAkgtG=78YwP8E3=maP9XZsB1w9DxyP-csrp5-EBGqrU=+1g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

I didn't see a .perlcriticrc file in the project, so ran with our local
settings.

With those, perlcritic is pretty unhappy, even at -4, though I don't see
anything that pops out as potentially bug-inducing. The ones I'd probably
look fixing at for starters would be the two argument form of open, and
maybe the .pl files without a #! so perlcritic doesn't mistake them for .pm
files.

It's also pretty noisy about the possible confusion cause by using a
leading zero for octal vs oct(), though that's been common practice as far
back as my memory goes. Those could be silenced in an rc file if that's
preferred.

If there's interest I could put together a patch for some or all of this.

Mike

__________________________________________________________________________________
*Mike Blackwell | Technical Analyst, Distribution Services/Rollout
Management | RRD*
1750 Wallace Ave | St Charles, IL 60174-3401
Office: 630.313.7818
Mike(dot)Blackwell(at)rrd(dot)com
http://www.rrdonnelley.com

<http://www.rrdonnelley.com/>
* <Mike(dot)Blackwell(at)rrd(dot)com>*

On Fri, May 4, 2018 at 10:19 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Mike Blackwell <mike(dot)blackwell(at)rrd(dot)com> writes:
> > In my experience, that would more commonly be written with the lower
> > precedence "or" operator (with or without the param list parens):
> > unlink $temp_name or die "unlink: $temp_name: $!";
>
> Yeah, I thought about that, but the pre-existing rename call had ||
> and I didn't want to deviate from the existing style; I'm not a good
> enough Perl programmer to be entitled to have opinions about Perl style.
>
> Probably all of this code could use a visit from the Perl style police.
> I wonder if anyone's tried perlcritic on it recently.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2018-05-04 21:36:05 perlcritic (was Re: pgsql: Fix precedence problem in new Perl code.)
Previous Message Alvaro Herrera 2018-05-04 21:26:35 pgsql: Don't mark pages all-visible spuriously

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-05-04 21:36:05 perlcritic (was Re: pgsql: Fix precedence problem in new Perl code.)
Previous Message Alvaro Herrera 2018-05-04 21:14:05 Re: --enable-ccache configure option