Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbb466c6

Browse files
Prohibit map and grep in void context
map and grep are not intended to be used as mutators, iteratingwith side-effects should be done with for or foreach loops. Thisfixes the one occurrence of the pattern, and bumps the perlcriticpolicy 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
1 parentf2bbadc commitbb466c6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

‎contrib/intarray/bench/create_test.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
else
5252
{
5353
print$msg"$i\t{" .join(',',@sect) ."}\n";
54-
map {print$map"$i\t$_\n"}@sect;
54+
print$map"$i\t$_\n"foreach@sect;
5555
}
5656
}
5757
close$map;

‎src/tools/perlcheck/perlcriticrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@ verbose = %f: %m at line %l, column %c. %e. ([%p] Severity: %s)\n
2222
# insist on use of the warnings pragma
2323
[TestingAndDebugging::RequireUseWarnings]
2424
severity = 5
25+
26+
# forbid grep and map in void context
27+
[BuiltinFunctions::ProhibitVoidGrep]
28+
severity = 5
29+
30+
[BuiltinFunctions::ProhibitVoidMap]
31+
severity = 5

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp