Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqAlz-007XcR-Bq for pgsql-committers@arkaria.postgresql.org; Mon, 16 Sep 2024 12:24:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sqAly-00FXMc-Ia for pgsql-committers@arkaria.postgresql.org; Mon, 16 Sep 2024 12:24:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sqAly-00FXMN-1z for pgsql-committers@lists.postgresql.org; Mon, 16 Sep 2024 12:24:06 +0000 Received: from mail-qk1-x735.google.com ([2607:f8b0:4864:20::735]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqAlu-001RSb-LQ for pgsql-committers@lists.postgresql.org; Mon, 16 Sep 2024 12:24:04 +0000 Received: by mail-qk1-x735.google.com with SMTP id af79cd13be357-7a9acc6f22dso440819085a.0 for ; Mon, 16 Sep 2024 05:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1726489441; x=1727094241; darn=lists.postgresql.org; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:from:to:cc:subject :date:message-id:reply-to; bh=O3hj2S1UbswbgIcS6+5T/Jrby2h8Y7+nla1JAo4363A=; b=NoR541taDOjAuW4l8BPk+5Bglv8W0/GSYoA5m5+elfKLD3vhUqKvlAuTvhgOBAj1RT qEyg9QpTpMemEEdAK9EY7vURdqx8TaLvQ3dAJQVEEQ08DRtv99KnLf+t895HTzWjBoS4 BYhfJiMF585AHJNteIonQ2eQqRpcAmy8yRyUS1decrcb9iute0E1laarhBKJQZYTv6T6 yc4JdzCkbS2uIay3cKRzaPfM/9GgRSckFgrSdBkPtmWQgMOwDao2tHjdepEbGvb+6ZjX 6VccjUluzFZHDywRCMJ17XW37mEJBYdtaQD/HY9UccFQSFBQfBtfemflahoDNkMny/26 kGYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726489441; x=1727094241; h=in-reply-to:autocrypt:content-language:from:references:cc:to :subject:user-agent:mime-version:date:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=O3hj2S1UbswbgIcS6+5T/Jrby2h8Y7+nla1JAo4363A=; b=PD1MKbqQQGKZlF0Kl5OrUQ/MIt6LTS+0RSk+M2y8rkM0hozvjq1JRewK1+oc13qU9j ZczYwiFxXlf+dQLSDkc7sDkXTm4EX0Swb3bOoGRsEnetL2PLgY/vlVGBQighBVqBpxh1 +bfPOo9q9okD+PLFfob6Y45f4Z/ZRgBi5IkL7V/qcesw0g+BUNXX77WZC1z7jtGjZPle UxP51P5uldNEG1eBpP9hfGRk5x/x8HLq6VINQtgU8xtOiQZidNafY6TYBFc/S+PjfxKF 5GtW7fxP5p2wfQGB95TdTHe5YwUfh7RfQL00pkgGRRt3NY/ZHlHvpwBmMTTU49EJk/pl dxfQ== X-Gm-Message-State: AOJu0YxHQFsEytj2RggXpzavwBBQ9XrBRmMHntwF6ADCI1Vrb0+R38v3 /97+TtHOdhdN5oRl/zoau6eful3ZU67WTKlzukc3uQ+U9FiU6G1tX5ohCFUpVNU2YzF1zJJ/rFf r X-Google-Smtp-Source: AGHT+IFy6HUi32xbInvWp9ADvzWoUea/QHKtkdRfeKBoI6staibfNIz//czq/+Nu3uIexoOdkQv/hQ== X-Received: by 2002:a05:620a:1712:b0:7a9:b456:c5e6 with SMTP id af79cd13be357-7a9e5fa1478mr2188062385a.42.1726489441295; Mon, 16 Sep 2024 05:24:01 -0700 (PDT) Received: from ?IPV6:2605:a601:9180:9800::2bb? ([2605:a601:9180:9800::2bb]) by smtp.googlemail.com with ESMTPSA id af79cd13be357-7ab3eb62cefsm243375985a.102.2024.09.16.05.24.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Sep 2024 05:24:00 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------gDpm6SWagPI7PLfqOJeZkSzV" Message-ID: <5dadbccb-a36c-4195-a4b6-bf5e828fc60d@dunslane.net> Date: Mon, 16 Sep 2024 08:23:58 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pgsql: Perl scripts: eliminate "Useless interpolation" warnings To: Bruce Momjian Cc: pgsql-committers@lists.postgresql.org References: <66b5b1d6-3f2a-4944-91a3-7e40a565ccac@dunslane.net> <42f2242a-422b-4aa3-8d60-d67b229c4a52@dunslane.net> From: Andrew Dunstan Content-Language: en-US Autocrypt: addr=andrew@dunslane.net; keydata= xsBNBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAHNJEFuZHJldyBEdW5zdGFuIDxhbmRyZXdAZHVuc2xhbmUubmV0PsLAmwQTAQgARQIbAwIX gAIZAQULCQgHAgMiAgEGFQoJCAsCBBYCAwECHgcWIQTkPlhGHfx8v0RpFaWZ+n/LWfw7gQUC ZFlxxwUJGVGAbgAKCRC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EtpYk8B/wtS 5dIMD7Q8hwQpL+4C6GNpb6ZKnPkLi47pDOLhz2qBrqN+rqUEsT3YnExYpzj5yOBi+FlmV1Hw 49QYe1sn2ZPs In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------gDpm6SWagPI7PLfqOJeZkSzV Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-09-15 Su 9:28 PM, Bruce Momjian wrote: > On Sun, Sep 15, 2024 at 06:07:21PM -0400, Andrew Dunstan wrote: >> On 2024-09-15 Su 4:36 PM, Bruce Momjian wrote: >>> On Sun, Sep 15, 2024 at 04:33:49PM -0400, Andrew Dunstan wrote: >>>> I understand perfectly what the warning is about. >>>> >>>> But the project's perlcritic policy is expressed at src/tools/perlcheck/ >>>> perlcriticrc. It's basically severity 5 plus some additions and one exception. >>>> We shouldn't be imposing our personal perlcritic policies on the project. >>>> >>>> The change isn't bad in itself, but there shouldn't be any expectation that we >>>> will keep to this policy, as it's not required by project policy. >>>> >>>> There is a huge mass of perlcritic issues in our perl code at severity 1 (over >>>> 13000 by my count). If we're going to clean them up (which I would oppose) we >>>> should do it in a systematic way. It's hard to see why this one is special. >>> I guess it is special only because my policy is more strict so I wanted >>> my new code to match. Should I revert it? >> >> Yes I think so. > Okay, done. > >>> Is the very tiny improvement >>> not worth the churn in the code? >> >> Yeah, I don't think it is. > FYI, the line that got me started was: > > my ($tmpfilename) = $filename . ".tmp"; > > while I would write that with single quotes. Because mine uses single > quotes and version_stamp.pl uses double-quotes, I started to try to > unify the style. I would normally write this as     my $tempfile = "$filename.tmp"; or possibly     my $tempfile = "${filename}.tmp"; There's a perl mantra that says There Is More Than One Way To Do It, usually abbreviated to TIMTOWTDI, which perlcritic fights against to some extent. I think the idea of unifying style beyond the official project policy is an effort doomed to failure. Nobody is going to maintain that consistency, and the project has rejected attempts to have a stricter set of rules in the past. > > I agree severity=1 generates many false warnings, and changing code > based on them can actually produce errors, but I do think there are some > safe ones like the single/double quote item we can improve. > > Attached is my Perl critic file, where I do use severity=1, but turn off > various warnings. Sure, or for something in between, there's the buildfarm policy at cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------gDpm6SWagPI7PLfqOJeZkSzV Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 2024-09-15 Su 9:28 PM, Bruce Momjian wrote:
On Sun, Sep 15, 2024 at 06:07:21PM -0400, Andrew Dunstan wrote:
On 2024-09-15 Su 4:36 PM, Bruce Momjian wrote:
On Sun, Sep 15, 2024 at 04:33:49PM -0400, Andrew Dunstan wrote:
I understand perfectly what the warning is about.

But the project's perlcritic policy is expressed at src/tools/perlcheck/
perlcriticrc. It's basically severity 5 plus some additions and one exception.
We shouldn't be imposing our personal perlcritic policies on the project.

The change isn't bad in itself, but there shouldn't be any expectation that we
will keep to this policy, as it's not required by project policy.

There is a huge mass of perlcritic issues in our perl code at severity 1 (over
13000 by my count). If we're going to clean them up (which I would oppose) we
should do it in a systematic way. It's hard to see why this one is special.
I guess it is special only because my policy is more strict so I wanted
my new code to match.  Should I revert it?

Yes I think so.
Okay, done.

Is the very tiny improvement
not worth the churn in the code?

Yeah, I don't think it is.
FYI, the line that got me started was:

	my ($tmpfilename) = $filename . ".tmp";

while I would write that with single quotes.  Because mine uses single
quotes and version_stamp.pl uses double-quotes, I started to try to
unify the style.


I would normally write this as

    my $tempfile = "$filename.tmp";

or possibly

    my $tempfile = "${filename}.tmp";

There's a perl mantra that says There Is More Than One Way To Do It, usually abbreviated to TIMTOWTDI, which perlcritic fights against to some extent. I think the idea of unifying style beyond the official project policy is an effort doomed to failure. Nobody is going to maintain that consistency, and the project has rejected attempts to have a stricter set of rules in the past.



I agree severity=1 generates many false warnings, and changing code
based on them can actually produce errors, but I do think there are some
safe ones like the single/double quote item we can improve.

Attached is my Perl critic file, where I do use severity=1, but turn off
various warnings.


Sure, or for something in between, there's the buildfarm policy at <https://github.com/PGBuildFarm/client-code/blob/main/.perlcriticrc>

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------gDpm6SWagPI7PLfqOJeZkSzV--