line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::Modules::ProhibitAutomaticExportation; |
2
|
133
|
|
|
133
|
|
67990
|
use strict; |
|
133
|
|
|
|
|
171
|
|
|
133
|
|
|
|
|
2960
|
|
3
|
133
|
|
|
133
|
|
391
|
use warnings; |
|
133
|
|
|
|
|
143
|
|
|
133
|
|
|
|
|
2279
|
|
4
|
133
|
|
|
133
|
|
775
|
use Perl::Lint::Constants::Type; |
|
133
|
|
|
|
|
126
|
|
|
133
|
|
|
|
|
58683
|
|
5
|
133
|
|
|
133
|
|
548
|
use parent "Perl::Lint::Policy"; |
|
133
|
|
|
|
|
1058
|
|
|
133
|
|
|
|
|
529
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
133
|
|
|
|
|
22127
|
DESC => 'Symbols are exported by default', |
9
|
|
|
|
|
|
|
EXPL => 'Use "@EXPORT_OK" or "%EXPORT_TAGS" instead', |
10
|
133
|
|
|
133
|
|
6433
|
}; |
|
133
|
|
|
|
|
174
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
11
|
|
|
11
|
0
|
14
|
my ($class, $file, $tokens, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
11
|
|
|
|
|
12
|
my @violations; |
16
|
11
|
|
|
|
|
30
|
for (my $i = 0, my $next_token, my $token_type, my $token_data; my $token = $tokens->[$i]; $i++) { |
17
|
143
|
|
|
|
|
100
|
$next_token = $tokens->[$i+1]; |
18
|
143
|
|
|
|
|
122
|
$token_type = $token->{type}; |
19
|
143
|
|
|
|
|
107
|
$token_data = $token->{data}; |
20
|
143
|
100
|
100
|
|
|
493
|
if ( |
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
66
|
|
|
|
|
21
|
|
|
|
|
|
|
($token_type == GLOBAL_ARRAY_VAR && $token_data eq '@EXPORT') || |
22
|
|
|
|
|
|
|
($token_type == NAMESPACE && $token_data eq 'EXPORT' && $next_token->{type} == ASSIGN) |
23
|
|
|
|
|
|
|
) { |
24
|
|
|
|
|
|
|
push @violations, { |
25
|
|
|
|
|
|
|
filename => $file, |
26
|
|
|
|
|
|
|
line => $token->{line}, |
27
|
4
|
|
|
|
|
22
|
description => DESC, |
28
|
|
|
|
|
|
|
explanation => EXPL, |
29
|
|
|
|
|
|
|
policy => __PACKAGE__, |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
11
|
|
|
|
|
38
|
return \@violations; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|