diff options
author | Daniel Gustafsson <dgustafsson@postgresql.org> | 2021-08-31 11:07:04 +0200 |
---|---|---|
committer | Daniel Gustafsson <dgustafsson@postgresql.org> | 2021-08-31 11:07:04 +0200 |
commit | bb466c6b0992a1a21c03239a7b0a87ebadd3bee1 (patch) | |
tree | ca337e27f75307637ab18311e0c733e03f517587 /src | |
parent | f2bbadce6b5052337a11a33ea6bd8d8aebe2610a (diff) | |
download | postgresql-bb466c6b0992a1a21c03239a7b0a87ebadd3bee1.tar.gz postgresql-bb466c6b0992a1a21c03239a7b0a87ebadd3bee1.zip |
Prohibit map and grep in void context
map and grep are not intended to be used as mutators, iterating
with side-effects should be done with for or foreach loops. This
fixes the one occurrence of the pattern, and bumps the perlcritic
policy to severity 5 for the map and grep policies.
Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Reviewed-by: Julien Rouhaud <rjuju123@gmail.com>
Discussion: https://postgr.es/m/87fsvzhhc4.fsf@wibble.ilmari.org
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/perlcheck/perlcriticrc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/tools/perlcheck/perlcriticrc b/src/tools/perlcheck/perlcriticrc index e230111b232..9267fb43b27 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 |