line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::InputOutput::ProhibitBarewordFileHandles; |
2
|
133
|
|
|
133
|
|
67990
|
use strict; |
|
133
|
|
|
|
|
184
|
|
|
133
|
|
|
|
|
2985
|
|
3
|
133
|
|
|
133
|
|
413
|
use warnings; |
|
133
|
|
|
|
|
153
|
|
|
133
|
|
|
|
|
2383
|
|
4
|
133
|
|
|
133
|
|
875
|
use Perl::Lint::Constants::Type; |
|
133
|
|
|
|
|
149
|
|
|
133
|
|
|
|
|
58979
|
|
5
|
133
|
|
|
133
|
|
1035
|
use Perl::Lint::Constants::Kind; |
|
133
|
|
|
|
|
168
|
|
|
133
|
|
|
|
|
6704
|
|
6
|
133
|
|
|
133
|
|
476
|
use parent "Perl::Lint::Policy"; |
|
133
|
|
|
|
|
172
|
|
|
133
|
|
|
|
|
603
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use constant { |
9
|
133
|
|
|
|
|
23247
|
DESC => 'Bareword file handle opened', |
10
|
|
|
|
|
|
|
EXPL => [202, 204], |
11
|
133
|
|
|
133
|
|
6851
|
}; |
|
133
|
|
|
|
|
188
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub evaluate { |
14
|
4
|
|
|
4
|
0
|
8
|
my ($class, $file, $tokens, $src, $args) = @_; |
15
|
|
|
|
|
|
|
|
16
|
4
|
|
|
|
|
4
|
my @violations; |
17
|
4
|
|
|
|
|
18
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
18
|
178
|
|
|
|
|
112
|
my $token_type = $token->{type}; |
19
|
178
|
|
|
|
|
124
|
my $token_data = $token->{data}; |
20
|
|
|
|
|
|
|
|
21
|
178
|
100
|
100
|
|
|
409
|
if ($token_type == BUILTIN_FUNC && $token_data eq 'open') { |
22
|
21
|
|
|
|
|
16
|
$token = $tokens->[++$i]; |
23
|
21
|
|
|
|
|
19
|
$token_type = $token->{type}; |
24
|
|
|
|
|
|
|
|
25
|
21
|
100
|
|
|
|
25
|
if ($token_type == LEFT_PAREN) { |
26
|
13
|
|
|
|
|
13
|
$token = $tokens->[++$i]; |
27
|
13
|
|
|
|
|
10
|
$token_type = $token->{type}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
21
|
100
|
|
|
|
38
|
if ($token_type == KEY) { |
31
|
|
|
|
|
|
|
push @violations, { |
32
|
|
|
|
|
|
|
filename => $file, |
33
|
|
|
|
|
|
|
line => $token->{line}, |
34
|
10
|
|
|
|
|
41
|
description => DESC, |
35
|
|
|
|
|
|
|
explanation => EXPL, |
36
|
|
|
|
|
|
|
policy => __PACKAGE__, |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
4
|
|
|
|
|
17
|
return \@violations; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|