Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNl1e-0000jP-3z for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2020 22:24:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jNl1b-0007Hy-SL for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2020 22:24:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNl1b-0007HT-G0 for pgsql-hackers@lists.postgresql.org; Sun, 12 Apr 2020 22:24:23 +0000 Received: from mail-qv1-xf2d.google.com ([2607:f8b0:4864:20::f2d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jNl1Y-0006EY-6m for pgsql-hackers@postgresql.org; Sun, 12 Apr 2020 22:24:23 +0000 Received: by mail-qv1-xf2d.google.com with SMTP id v38so3621132qvf.6 for ; Sun, 12 Apr 2020 15:24:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=ptpxdatb39h486W3OtnfBfTGl4lK96CezZfT08uj/HU=; b=pAUACX0fJhod4q50CF2XRaTECly4oYi1RpQVn3HaP/NNPCuHMDsVnGzDKbqDTNGY3/ 56203IZ5xwkB9TWAiwZveH2xKXpqPJlDaN5vKVtdIWTKivzgNEo51v5jKaNikojiOfzD tXWum1j5GNJkUn1ei+EOkh457H662X/IGpSLKTLbTi0FPlSeErKjMlYwP4VQft083VJV /jR9cncKM00RV9yE18MffRCqv1LZKGCOaZSmOtetngdlLBDi2Pdqe35Yd7II/jh3BCxF hFn5Bsq7Yvsh29tHrSnJ24dXeG1TkOpu3K1xbmNJlP989qiBeruC/Bj58UB2pLSr4idP BNQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=ptpxdatb39h486W3OtnfBfTGl4lK96CezZfT08uj/HU=; b=tAQSYRtaPQG+BBeBKrpuIE9RrHrvCfuBWCMEXgxZeLd62uK2/285CWJE9r0BMXFGlB 0Iya6EsLUSQOVaD/F5+2VB8yrq/9q4w1fP+SqRUuw5PBL6kS6lj7t04ETdGPVo+oFeTc LyHfmUqpxS7oe+6n71pizAhkyMujAXDXvkhjKtlRKFyuLmTnEIfLMOdtvFHNmEl5rvxU 89bjssgyx7MJw46c8TEtB1B+ptMhHoiKE8iPE1OE7uVQph0QV5pDcZ+M+KAmiaJ89n1s 2apNg6cmlw1zUNK+5d/Ci8izKFbh5thvHfOHUoP+cUaw718g/87kHGRmALSa2Z6cWASM LInA== X-Gm-Message-State: AGi0PuZDdYySNWa6FYwKgMWcCo6YmzrxtlkpnNR5aCErbGbBibCKdC1y TxIDDq8+rAaMT4iJ9UK5JoiD2KmxWySSH0/c0eN4xKemAN5OHF5f/0ZpzmMs5AEyDivgn26rMum eitTvmyZbM1kruEr1tYwlAs7cn+uSKkHgQm4rNQODT0ApniDdE3LktGZXWaCWoCdDYBhCes+RCk xMOvJwB+j7bh9SI3k= X-Google-Smtp-Source: APiQypKf5bU/cb9z2lLccUxtADFK984crYEMcQtvUMqwMi9A0OxsqqR2DF3+eNUKbsSioq4yEGT8BA== X-Received: by 2002:a05:6214:1841:: with SMTP id d1mr14034487qvy.230.1586730257294; Sun, 12 Apr 2020 15:24:17 -0700 (PDT) Received: from [192.168.10.146] (99-10-92-30.lightspeed.rlghnc.sbcglobal.net. [99.10.92.30]) by smtp.gmail.com with ESMTPSA id s188sm7045434qkh.67.2020.04.12.15.24.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 12 Apr 2020 15:24:16 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: cleaning perl code To: David Steele Cc: Robert Haas , Tom Lane , Noah Misch , PostgreSQL-development References: <20200411043014.GA590991@rfd.leadboat.com> <27481.1586618092@sss.pgh.pa.us> <757f9c47-ad93-8ca0-49ea-2b2ced58d103@pgmasters.net> Autocrypt: addr=andrew.dunstan@2ndQuadrant.com; prefer-encrypt=mutual; keydata= mQENBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAG0L0FuZHJldyBEdW5zdGFuIDxhbmRyZXcuZHVuc3RhbkAybmRRdWFkcmFudC5jb20+iQFY BBMBAgBCAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ /DuBAhkBBQJd1pSYBQkSzqMsAAoJEJn6f8tZ/DuBJmEIAIVFBIC3qGqh+YTPVTkfowwxpHz0 tZSPjZ6GS/5y62kgoZrZOVXw+Rg2ceuMM3a+In/RRjTx4bembgYqRKgzXlDfiNBJeq5ioVuN H1faDKE2lm5a6QkRQ2JU6DKf60fqSJGP5LisCUr1V0wz6EnlO31ArrKtXCNB+yk0KDAS6o6I Ql4pkXpr+vq4iilwJmiJOqTBam0LmQE7ulYCCYU8Z6MkpiSl+dO7QSramcGyxauQRI3a7gcq dpo8Vrv3gFTQDeMYxk7cqZp08pIVH5XR0+LgBz4X84f59rA/VAKlC/r6CyEQk59rvDLxCMyP 2buoj51Z25N3MVghRDGcsU6mT7e5AQ0ETspYWQEIANGc4zQULOxhbqO2dyD51YhqCNRmm9oK Waqf+wmW4tpDe/VVcxAnNizd4LWCHfzpb5cHAtGkOPePMfzWVf6nvdF7d3eglbtf59+zG7O7 llV0xSSoFiieQBsrGvqDInXYX/4mRRXMtyhM353/tixC9RWLs1oofyYmCPPXXY7h9R7en3B8 BoVrRFcdzlIY/NFNhFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C 4R+M6w7o2PLGOjdZ+kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaY L++LAEOqrlvm2TvqQqZRtnEAEQEAAYkBJQQYAQIADwIbDAUCXdaUtAUJEs6jVQAKCRCZ+n/L Wfw7gQi5B/9sHbmRloZNCWWwZGm+O9iG/JGQxS0WWa4GaZqzqSTWOft2/gO0Bgag89r1djq4 PFgSZtzHvKQpqYz/7HkPrWh1jpcS83i/uYY1uyHXUUtpdEmn4buNObEtD0YNaJkGdhASsECq 6akw+u7WJYmAHs/SpR6ok6HqLw7JHDVc2h5dViLfTk0qrgDa7sq/LVMoJje5Ct/Ku3YaWAV6 YSmzoPP5BmPVFqP11OMQkCqurIu9vTLXKFWX623vCmqRDHJ6e5GCDHbH8USU+4wJBfPymZkd cA7NGm/mmWeJiWBFIDyjzYxrjku8ty9TZJVsaRXnS+OFQzXz9Eu2wTpKdHij46uY Message-ID: Date: Sun, 12 Apr 2020 18:24:15 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <757f9c47-ad93-8ca0-49ea-2b2ced58d103@pgmasters.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/12/20 4:12 PM, David Steele wrote: > On 4/12/20 3:22 PM, Robert Haas wrote: >> On Sat, Apr 11, 2020 at 11:15 AM Tom Lane wrote: >>> Noah Misch writes: >>>> In summary, among those warnings, I see non-negative value in "Code >>>> before >>>> warnings are enabled" only.  While we're changing this, I propose >>>> removing >>>> Subroutines::RequireFinalReturn. >>> >>> If it's possible to turn off just that warning, then +several. >>> It's routinely caused buildfarm failures, yet I can detect exactly >>> no value in it.  If there were sufficient cross-procedural analysis >>> backing it to detect whether any caller examines the subroutine's >>> result value, then it'd be worth having.  But there isn't, so those >>> extra returns are just pedantic verbosity. >> >> I agree with Noah's comment about CPAN: it would be worth being more >> careful about things like this if we were writing code that was likely >> to be used by a wide variety of people and a lot of code over which we >> have no control and which we do not get to even see. But that's not >> the case here. It does not seem worth stressing the authors of TAP >> tests over such things. > > FWIW, pgBackRest used Perl Critic when we were distributing Perl code > but stopped when our Perl code was only used for integration testing. > Perhaps that was the wrong call but we decided the extra time required > to run it was not worth the benefit. Most new test code is written in > C and the Perl test code is primarily in maintenance mode now. > > When we did use Perl Critic we set it at level 1 (--brutal) and then > wrote an exception file for the stuff we wanted to ignore. The > advantage of this is that if new code violated a policy that did not > already have an exception we could evaluate it and either add an > exception or modify the code. In practice this was pretty rare, but we > also had a short excuse for many exceptions and a list of exceptions > that should be re-evaluated in the future. > > About the time we introduced Perl Critic we were already considering > the C migration so most of the exceptions stayed. > > 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. 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. I did something similar to what's above with the buildfarm code, although on checking now I find it's a bit out of date for the sev 1 and 2 warnings, so I'm fixing that. Having said that, my normal target is level 3. 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. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services