You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2015/01/15 18:04:11 UTC

[Bug 7119] New: Perl::Critic: ControlStructures::ProhibitMutatingListFunctions

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: dev@spamassassin.apache.org
          Reporter: Mark.Martinec@ijs.si

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.

[Bug 7119] Perl::Critic: ControlStructures::ProhibitMutatingListFunctions

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=7119

Kevin A. McGrail <km...@pccc.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |kmcgrail@pccc.com
         Resolution|---                         |FIXED

--- Comment #4 from Kevin A. McGrail <km...@pccc.com> ---
Closing as resolved

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7119] Perl::Critic: ControlStructures::ProhibitMutatingListFunctions

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=7119

--- Comment #2 from Mark Martinec <Ma...@ijs.si> ---
Created attachment 5265
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=5265&action=edit
proposed fix

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7119] Perl::Critic: ControlStructures::ProhibitMutatingListFunctions

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=7119

Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|Undefined                   |3.4.1

--- Comment #3 from Mark Martinec <Ma...@ijs.si> ---
Bug 7119: Perl::Critic: ControlStructures::ProhibitMutatingListFunctions
  Sending sa-update.raw
  Sending spamassassin.raw
  Sending spamd/spamd.raw
Committed revision 1652181.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7119] Perl::Critic: ControlStructures::ProhibitMutatingListFunctions

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=7119

--- Comment #1 from Mark Martinec <Ma...@ijs.si> ---
Created attachment 5264
  --> https://issues.apache.org/SpamAssassin/attachment.cgi?id=5264&action=edit
log

Full output from '$ prove xt/60_perlcritic.t'

-- 
You are receiving this mail because:
You are the assignee for the bug.