https://issues.apache.org/SpamAssassin/show_bug.cgi?id=7119
Bug ID: 7119
Summary: Perl::Critic:
ControlStructures::ProhibitMutatingListFunctions
Product: Spamassassin
Version: SVN Trunk (Latest Devel Version)
Hardware: All
OS: All
Status: NEW
Severity: minor
Priority: P2
Component: spamassassin
Assignee: [email protected]
Reporter: [email protected]
xt/60_perlcritic.t reports "Don't modify $_ in list functions"
in: sa-update, spamassassin, spamd .
# Failed test 'Test::Perl::Critic for "../blib/script/sa-update"'
# at /usr/local/lib/perl5/site_perl/Test/Perl/Critic.pm line 110.
#
# Perl::Critic found these violations in "../blib/script/sa-update":
# Don't modify $_ in list functions at line 1598, column 50.
# ControlStructures::ProhibitMutatingListFunctions (Severity: 5)
# `map', `grep' and other list operators are intended to transform arrays
# into other arrays by applying code to the array elements one by one. For
# speed, the elements are referenced via a `$_' alias rather than copying
# them. As a consequence, if the code block of the `map' or `grep' modify
# `$_' in any way, then it is actually modifying the source array. This IS
# technically allowed, but those side effects can be quite surprising,
# especially when the array being passed is `@_' or perhaps
# `values(%ENV)'! Instead authors should restrict in-place array
# modification to `for(@array) { ... }' constructs instead, or use
# `List::MoreUtils::apply()'.
Attached is the full report.
(version: Perl-Critic-1.12, Test-Perl-Critic-1.02, perl 5.20.1)
--
You are receiving this mail because:
You are the assignee for the bug.