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 1m8Pb8-0006Mb-6o for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jul 2021 16:06: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 1m8Pb7-0001nX-6J for pgsql-hackers@arkaria.postgresql.org; Tue, 27 Jul 2021 16:06:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8Pb6-0001nG-Ul for pgsql-hackers@lists.postgresql.org; Tue, 27 Jul 2021 16:06:24 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8Pb4-000524-FS for pgsql-hackers@lists.postgresql.org; Tue, 27 Jul 2021 16:06:23 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4C3E85C00F7 for ; Tue, 27 Jul 2021 12:06:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 27 Jul 2021 12:06:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ilmari.org; h= from:to:subject:date:message-id:mime-version:content-type; s= fm2; bh=Q7UfQvbNxcZ7plC04nryTEp/Vq21wXvzfHBXKnAdyd4=; b=gKsichvD ep8SRQewFdQkCaUYyQ3CM+ZdBXpUQGuhIFssYn6NID39YimhncEbvTivxkiczcNZ upTmM5XqTE/fZfXO41VaJP8zdyOSCmQTY44KPFDI7AVkRPvm5BOZz/duVEb5/Upa cwR3E/IpEKKP3IiVEOAY4Nfc/IK5+yyTYhmxRItnLDP3GRXUcKU3mriI9pLxe0m7 dkPzxBJY/JdFFy9O02ii/d1mz9gf9lqAdMMB6hiuhYm986tkNPLdGftVtKrr3W7f TrTElsu46GLVw9N8xaZwL6sTgCnYxoN9qBSengk8d3YqvX/la8XPWtKu9hVoBDdn CczAUkYWRt/Xpg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=Q7UfQvbNxcZ7plC04nryTEp/Vq21w XvzfHBXKnAdyd4=; b=om18OHQERDO+GofukHnx9AKiS89T+1Bf9p2eiCpv9JIVG Is98pkn01NxZpL78RXf4Sn5M/gKURVcnhfSIF0Qh9Zbw4PtskFxSh2Ha6aUgqEx7 61Moj+sPGnLSofgx7f4g3zruP3CKE/Q3kkMJuRCMu8Yhd24XPHsevfMUgyQwNqMx JPH2NTkMkvvOOxJMMDIWkGleTSPLyVJoNnUy2s3Q5wJLHT121bwdltG67SIyb2Nu gqemJ1OWWbJ41aF4V8vfCM6TW1DdFEm7LxxrkjeoE+qIxrbso0kTgGBL+1D2xR9u ol2JqgHkn2OpJwR4ArUe3YOENI41dckmANbHU4rpw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrgeejgdeltdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgfgggtsehmtderredtre ejnecuhfhrohhmpehilhhmrghrihesihhlmhgrrhhirdhorhhgucdlffgrghhfihhnnhcu kfhlmhgrrhhiucforghnnhhsnohkvghrmdenucggtffrrghtthgvrhhnpefgteehgfffgf ejudfhuefggffghffgieehhfefgffhkeegtefghfdthfdtfeffhfenucffohhmrghinhep mhgvthgrtghprghnrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepihhlmhgrrhhisehilhhmrghrihdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 27 Jul 2021 12:06:20 -0400 (EDT) From: ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) To: pgsql-hackers@lists.postgresql.org Subject: perlcritic: prohibit map and grep in void conext Date: Tue, 27 Jul 2021 17:06:19 +0100 Message-ID: <87fsvzhhc4.fsf@wibble.ilmari.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain Hi hackers, In the patches for improving the MSVC build process, I noticed a use of `map` in void context. This is considered bad form, and has a perlcritic policy forbidding it: https://metacpan.org/pod/Perl::Critic::Policy::BuiltinFunctions::ProhibitVoidMap. Attached is a patch that increases severity of that and the corresponding `grep` policy to 5 to enable it in our perlcritic policy, and fixes the one use that had already snuck in. - ilmari --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-perlcritic-prohibit-map-and-grep-in-void-context.patch From c82b08ce047ab47188753806984f1dc5be365556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= Date: Tue, 27 Jul 2021 16:51:29 +0100 Subject: [PATCH] perlcritic: prohibit map and grep in void context --- contrib/intarray/bench/create_test.pl | 2 +- src/tools/perlcheck/perlcriticrc | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/contrib/intarray/bench/create_test.pl b/contrib/intarray/bench/create_test.pl index 993a4572f4..ae8d72bab0 100755 --- a/contrib/intarray/bench/create_test.pl +++ b/contrib/intarray/bench/create_test.pl @@ -51,7 +51,7 @@ else { print $msg "$i\t{" . join(',', @sect) . "}\n"; - map { print $map "$i\t$_\n" } @sect; + print $map "$i\t$_\n" foreach @sect; } } close $map; diff --git a/src/tools/perlcheck/perlcriticrc b/src/tools/perlcheck/perlcriticrc index e230111b23..9267fb43b2 100644 --- a/src/tools/perlcheck/perlcriticrc +++ b/src/tools/perlcheck/perlcriticrc @@ -22,3 +22,10 @@ verbose = %f: %m at line %l, column %c. %e. ([%p] Severity: %s)\n # insist on use of the warnings pragma [TestingAndDebugging::RequireUseWarnings] severity = 5 + +# forbid grep and map in void context +[BuiltinFunctions::ProhibitVoidGrep] +severity = 5 + +[BuiltinFunctions::ProhibitVoidMap] +severity = 5 -- 2.30.2 --=-=-=--