Grinnz / Perl-Critic-Community

Perl::Critic::Community - Community-inspired Perl::Critic policies
https://metacpan.org/pod/Perl::Critic::Community
Other
8 stars 10 forks source link

Freenode::DollarAB - false negative #9

Closed Tux closed 9 years ago

Tux commented 9 years ago
$ cat test.pl
#!perl

use strict;
use warnings;

our $VERSION = "0.00";

my @c;
my %row = map { $_ => 1 } 0..10;
push @c, [ @row{sort { $a <=> $b } keys %row } ];
$ perlcritic -1 test.pl
test.pl#10.24:  [4 - Freenode::DollarAB]        Using $a or $b outside sort()   :$a <=> $b
test.pl#10.31:  [4 - Freenode::DollarAB]        Using $a or $b outside sort()   :$a <=> $b
Grinnz commented 9 years ago

Perl::Critic::Utils appears to class "sort" as a hash key in this instance, I'll add a check to allow for that. Thanks!