line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::ValuesAndExpressions::ProhibitConstantPragma; |
2
|
133
|
|
|
133
|
|
67178
|
use strict; |
|
133
|
|
|
|
|
188
|
|
|
133
|
|
|
|
|
3160
|
|
3
|
133
|
|
|
133
|
|
405
|
use warnings; |
|
133
|
|
|
|
|
161
|
|
|
133
|
|
|
|
|
2448
|
|
4
|
133
|
|
|
133
|
|
737
|
use Perl::Lint::Constants::Type; |
|
133
|
|
|
|
|
162
|
|
|
133
|
|
|
|
|
60034
|
|
5
|
133
|
|
|
133
|
|
589
|
use parent "Perl::Lint::Policy"; |
|
133
|
|
|
|
|
154
|
|
|
133
|
|
|
|
|
574
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
133
|
|
|
|
|
20453
|
DESC => 'Pragma "constant" used', |
9
|
|
|
|
|
|
|
EXPL => [55], |
10
|
133
|
|
|
133
|
|
6757
|
}; |
|
133
|
|
|
|
|
482
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
3
|
|
|
3
|
0
|
5
|
my ($class, $file, $tokens, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
3
|
my @violations; |
16
|
3
|
|
|
|
|
20
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
17
|
50
|
|
|
|
|
31
|
my $token_type = $token->{type}; |
18
|
|
|
|
|
|
|
|
19
|
50
|
100
|
|
|
|
86
|
if ($token_type == USE_DECL) { |
20
|
7
|
|
|
|
|
10
|
my $next_token = $tokens->[++$i]; |
21
|
7
|
50
|
33
|
|
|
23
|
if ($next_token->{type} == USED_NAME && $next_token->{data} eq 'constant') { |
22
|
|
|
|
|
|
|
push @violations, { |
23
|
|
|
|
|
|
|
filename => $file, |
24
|
|
|
|
|
|
|
line => $token->{line}, |
25
|
7
|
|
|
|
|
26
|
description => DESC, |
26
|
|
|
|
|
|
|
explanation => EXPL, |
27
|
|
|
|
|
|
|
policy => __PACKAGE__, |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
9
|
return \@violations; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
|