line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::InputOutput::ProhibitBarewordFileHandles; |
2
|
133
|
|
|
133
|
|
88518
|
use strict; |
|
133
|
|
|
|
|
335
|
|
|
133
|
|
|
|
|
4641
|
|
3
|
133
|
|
|
133
|
|
575
|
use warnings; |
|
133
|
|
|
|
|
218
|
|
|
133
|
|
|
|
|
3071
|
|
4
|
133
|
|
|
133
|
|
949
|
use Perl::Lint::Constants::Type; |
|
133
|
|
|
|
|
196
|
|
|
133
|
|
|
|
|
81384
|
|
5
|
133
|
|
|
133
|
|
1426
|
use Perl::Lint::Constants::Kind; |
|
133
|
|
|
|
|
261
|
|
|
133
|
|
|
|
|
9503
|
|
6
|
133
|
|
|
133
|
|
693
|
use parent "Perl::Lint::Policy"; |
|
133
|
|
|
|
|
277
|
|
|
133
|
|
|
|
|
845
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use constant { |
9
|
133
|
|
|
|
|
30720
|
DESC => 'Bareword file handle opened', |
10
|
|
|
|
|
|
|
EXPL => [202, 204], |
11
|
133
|
|
|
133
|
|
9441
|
}; |
|
133
|
|
|
|
|
250
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub evaluate { |
14
|
4
|
|
|
4
|
0
|
7
|
my ($class, $file, $tokens, $src, $args) = @_; |
15
|
|
|
|
|
|
|
|
16
|
4
|
|
|
|
|
5
|
my @violations; |
17
|
4
|
|
|
|
|
18
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
18
|
178
|
|
|
|
|
139
|
my $token_type = $token->{type}; |
19
|
178
|
|
|
|
|
133
|
my $token_data = $token->{data}; |
20
|
|
|
|
|
|
|
|
21
|
178
|
100
|
100
|
|
|
436
|
if ($token_type == BUILTIN_FUNC && $token_data eq 'open') { |
22
|
21
|
|
|
|
|
16
|
$token = $tokens->[++$i]; |
23
|
21
|
|
|
|
|
20
|
$token_type = $token->{type}; |
24
|
|
|
|
|
|
|
|
25
|
21
|
100
|
|
|
|
28
|
if ($token_type == LEFT_PAREN) { |
26
|
13
|
|
|
|
|
14
|
$token = $tokens->[++$i]; |
27
|
13
|
|
|
|
|
16
|
$token_type = $token->{type}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
21
|
100
|
|
|
|
40
|
if ($token_type == KEY) { |
31
|
10
|
|
|
|
|
40
|
push @violations, { |
32
|
|
|
|
|
|
|
filename => $file, |
33
|
|
|
|
|
|
|
line => $token->{line}, |
34
|
|
|
|
|
|
|
description => DESC, |
35
|
|
|
|
|
|
|
explanation => EXPL, |
36
|
|
|
|
|
|
|
policy => __PACKAGE__, |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
4
|
|
|
|
|
28
|
return \@violations; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|