line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::Variables::ProtectPrivateVars; |
2
|
133
|
|
|
133
|
|
69533
|
use strict; |
|
133
|
|
|
|
|
178
|
|
|
133
|
|
|
|
|
3121
|
|
3
|
133
|
|
|
133
|
|
428
|
use warnings; |
|
133
|
|
|
|
|
180
|
|
|
133
|
|
|
|
|
2480
|
|
4
|
133
|
|
|
133
|
|
815
|
use Perl::Lint::Constants::Type; |
|
133
|
|
|
|
|
142
|
|
|
133
|
|
|
|
|
58346
|
|
5
|
133
|
|
|
133
|
|
574
|
use parent "Perl::Lint::Policy"; |
|
133
|
|
|
|
|
164
|
|
|
133
|
|
|
|
|
573
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
133
|
|
|
|
|
21414
|
DESC => 'Private variable used', |
9
|
|
|
|
|
|
|
EXPL => 'Use published APIs', |
10
|
133
|
|
|
133
|
|
6447
|
}; |
|
133
|
|
|
|
|
144
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
3
|
|
|
3
|
0
|
5
|
my ($class, $file, $tokens, $src, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
3
|
my @violations; |
16
|
3
|
|
|
|
|
12
|
for (my $i = 0, my $token_type, my $token_data; my $token = $tokens->[$i]; $i++) { |
17
|
87
|
|
|
|
|
67
|
$token_type = $token->{type}; |
18
|
87
|
|
|
|
|
49
|
$token_data = $token->{data}; |
19
|
|
|
|
|
|
|
|
20
|
87
|
100
|
100
|
|
|
204
|
if ($token_type == NAMESPACE && $token_data =~ /\A_/) { |
21
|
|
|
|
|
|
|
push @violations, { |
22
|
|
|
|
|
|
|
filename => $file, |
23
|
|
|
|
|
|
|
line => $token->{line}, |
24
|
11
|
|
|
|
|
38
|
description => DESC, |
25
|
|
|
|
|
|
|
explanation => EXPL, |
26
|
|
|
|
|
|
|
policy => __PACKAGE__, |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
11
|
return \@violations; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|