line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::BuiltinFunctions::RequireBlockMap; |
2
|
133
|
|
|
133
|
|
67450
|
use strict; |
|
133
|
|
|
|
|
187
|
|
|
133
|
|
|
|
|
3249
|
|
3
|
133
|
|
|
133
|
|
432
|
use warnings; |
|
133
|
|
|
|
|
169
|
|
|
133
|
|
|
|
|
2506
|
|
4
|
133
|
|
|
133
|
|
787
|
use Perl::Lint::Constants::Type; |
|
133
|
|
|
|
|
162
|
|
|
133
|
|
|
|
|
59155
|
|
5
|
133
|
|
|
133
|
|
620
|
use parent "Perl::Lint::Policy"; |
|
133
|
|
|
|
|
202
|
|
|
133
|
|
|
|
|
575
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
133
|
|
|
|
|
22927
|
DESC => 'Expression form of "map"', |
9
|
|
|
|
|
|
|
EXPL => [169], |
10
|
133
|
|
|
133
|
|
6792
|
}; |
|
133
|
|
|
|
|
236
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
4
|
|
|
4
|
0
|
7
|
my ($class, $file, $tokens, $src, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
|
|
4
|
my @violations; |
16
|
4
|
|
|
|
|
16
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
17
|
102
|
|
|
|
|
78
|
my $token_type = $token->{type}; |
18
|
102
|
|
|
|
|
85
|
my $token_data = $token->{data}; |
19
|
|
|
|
|
|
|
|
20
|
102
|
100
|
66
|
|
|
244
|
if ($token_type == BUILTIN_FUNC && $token_data eq 'map') { |
21
|
13
|
|
|
|
|
15
|
$token = $tokens->[++$i]; |
22
|
13
|
|
|
|
|
9
|
$token_type = $token->{type}; |
23
|
13
|
100
|
|
|
|
30
|
if ($token_type == LEFT_PAREN) { |
|
|
100
|
|
|
|
|
|
24
|
4
|
|
|
|
|
6
|
next; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
elsif ($token_type != LEFT_BRACE) { |
27
|
|
|
|
|
|
|
push @violations, { |
28
|
|
|
|
|
|
|
filename => $file, |
29
|
|
|
|
|
|
|
line => $token->{line}, |
30
|
7
|
|
|
|
|
38
|
description => DESC, |
31
|
|
|
|
|
|
|
explanation => EXPL, |
32
|
|
|
|
|
|
|
policy => __PACKAGE__, |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
15
|
return \@violations; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|