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 1jNJyX-0003AE-JJ for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Apr 2020 17:31:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jNJyW-0005K2-FX for pgsql-hackers@arkaria.postgresql.org; Sat, 11 Apr 2020 17:31:24 +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 1jNJyW-0005Jv-8k for pgsql-hackers@lists.postgresql.org; Sat, 11 Apr 2020 17:31:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNJyT-0000v7-3o for pgsql-hackers@postgresql.org; Sat, 11 Apr 2020 17:31:23 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 03BHVGm2021774; Sat, 11 Apr 2020 13:31:16 -0400 From: Tom Lane To: Andrew Dunstan cc: Noah Misch , PostgreSQL-development Subject: Re: cleaning perl code In-reply-to: <52405073-d836-6edb-b09a-681c59d18387@2ndQuadrant.com> References: <20200411043014.GA590991@rfd.leadboat.com> <0a4406d5-b428-4831-8ed9-c36764360f57@2ndQuadrant.com> <19843.1586623730@sss.pgh.pa.us> <52405073-d836-6edb-b09a-681c59d18387@2ndQuadrant.com> Comments: In-reply-to Andrew Dunstan message dated "Sat, 11 Apr 2020 13:01:54 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21772.1586626276.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 11 Apr 2020 13:31:16 -0400 Message-ID: <21773.1586626276@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andrew Dunstan writes: > On 4/11/20 12:48 PM, Tom Lane wrote: >> Is there a way to modify the test so that it only complains when >> the final return is missing and there are other return(s) with values? >> That would seem like a more narrowly tailored check. > Not AFAICS: > Yeah, the list of all policies in the parent page doesn't offer any promising alternatives either :-( BTW, this bit in the policy's man page seems pretty disheartening: Be careful when fixing problems identified by this Policy; don't blindly put a return; statement at the end of every subroutine. since I'd venture that's *exactly* what we've done every time perlcritic moaned about this. I wonder what else the author expected would happen. > That would probably require writing a replacement module. Looking at the > source if this module I think it might be possible, although I don't > know much of the internals of perlcritic. I doubt we want to go maintaining our own perlcritic policies; aside from the effort involved, it'd become that much harder for anyone to reproduce the results. regards, tom lane