1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

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
This commit is contained in:
Daniel Gustafsson
2021-08-31 11:07:04 +02:00
parent f2bbadce6b
commit bb466c6b09
2 changed files with 8 additions and 1 deletions

View File

@ -51,7 +51,7 @@ foreach my $i (1 .. 200000)
else
{
print $msg "$i\t{" . join(',', @sect) . "}\n";
map { print $map "$i\t$_\n" } @sect;
print $map "$i\t$_\n" foreach @sect;
}
}
close $map;