| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::ValuesAndExpressions::ProhibitVersionStrings; |
|
2
|
133
|
|
|
133
|
|
67084
|
use strict; |
|
|
133
|
|
|
|
|
174
|
|
|
|
133
|
|
|
|
|
3096
|
|
|
3
|
133
|
|
|
133
|
|
427
|
use warnings; |
|
|
133
|
|
|
|
|
160
|
|
|
|
133
|
|
|
|
|
2396
|
|
|
4
|
133
|
|
|
133
|
|
763
|
use Perl::Lint::Constants::Type; |
|
|
133
|
|
|
|
|
146
|
|
|
|
133
|
|
|
|
|
59577
|
|
|
5
|
133
|
|
|
133
|
|
541
|
use parent "Perl::Lint::Policy"; |
|
|
133
|
|
|
|
|
155
|
|
|
|
133
|
|
|
|
|
578
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
|
8
|
133
|
|
|
|
|
26048
|
DESC => 'Version string used', |
|
9
|
|
|
|
|
|
|
EXPL => 'Use a real number instead', |
|
10
|
133
|
|
|
133
|
|
6661
|
}; |
|
|
133
|
|
|
|
|
174
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
|
13
|
5
|
|
|
5
|
0
|
11
|
my ($class, $file, $tokens, $args) = @_; |
|
14
|
|
|
|
|
|
|
|
|
15
|
5
|
|
|
|
|
3
|
my @violations; |
|
16
|
5
|
|
|
|
|
20
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
|
17
|
200
|
|
|
|
|
143
|
my $token_type = $token->{type}; |
|
18
|
|
|
|
|
|
|
|
|
19
|
200
|
100
|
100
|
|
|
1090
|
if ( |
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$token_type == USE_DECL || |
|
21
|
|
|
|
|
|
|
$token_type == USED_NAME || |
|
22
|
|
|
|
|
|
|
$token_type == NAMESPACE || |
|
23
|
|
|
|
|
|
|
$token_type == REQUIRE_DECL || |
|
24
|
|
|
|
|
|
|
$token_type == REQUIRED_NAME |
|
25
|
|
|
|
|
|
|
) { |
|
26
|
62
|
|
|
|
|
53
|
$token_type = $tokens->[$i+1]->{type}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
62
|
100
|
|
|
|
122
|
if ($token_type == DOUBLE) { |
|
|
|
100
|
|
|
|
|
|
|
29
|
17
|
|
|
|
|
14
|
$token_type = $tokens->[$i+2]->{type}; |
|
30
|
17
|
100
|
|
|
|
25
|
if ($token_type == DOUBLE) { |
|
31
|
|
|
|
|
|
|
push @violations, { |
|
32
|
|
|
|
|
|
|
filename => $file, |
|
33
|
|
|
|
|
|
|
line => $token->{line}, |
|
34
|
11
|
|
|
|
|
42
|
description => DESC, |
|
35
|
|
|
|
|
|
|
explanation => EXPL, |
|
36
|
|
|
|
|
|
|
policy => __PACKAGE__, |
|
37
|
|
|
|
|
|
|
}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
elsif ($token_type == VERSION_STRING) { |
|
41
|
|
|
|
|
|
|
push @violations, { |
|
42
|
|
|
|
|
|
|
filename => $file, |
|
43
|
|
|
|
|
|
|
line => $token->{line}, |
|
44
|
12
|
|
|
|
|
39
|
description => DESC, |
|
45
|
|
|
|
|
|
|
explanation => EXPL, |
|
46
|
|
|
|
|
|
|
policy => __PACKAGE__, |
|
47
|
|
|
|
|
|
|
}; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
5
|
|
|
|
|
16
|
return \@violations; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
|
57
|
|
|
|
|
|
|
|