line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames; |
2
|
133
|
|
|
133
|
|
68000
|
use strict; |
|
133
|
|
|
|
|
161
|
|
|
133
|
|
|
|
|
3097
|
|
3
|
133
|
|
|
133
|
|
404
|
use warnings; |
|
133
|
|
|
|
|
150
|
|
|
133
|
|
|
|
|
2354
|
|
4
|
133
|
|
|
133
|
|
846
|
use Perl::Lint::Constants::Type; |
|
133
|
|
|
|
|
149
|
|
|
133
|
|
|
|
|
61699
|
|
5
|
133
|
|
|
133
|
|
568
|
use parent "Perl::Lint::Policy"; |
|
133
|
|
|
|
|
171
|
|
|
133
|
|
|
|
|
558
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
133
|
|
|
|
|
20494
|
DESC => 'Special block name used as label', |
9
|
|
|
|
|
|
|
EXPL => 'Use a label that cannot be confused with BEGIN, END, CHECK, INIT, or UNITCHECK blocks', |
10
|
133
|
|
|
133
|
|
6608
|
}; |
|
133
|
|
|
|
|
165
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
4
|
|
|
4
|
0
|
5
|
my ($class, $file, $tokens, $src, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
|
|
5
|
my @violations; |
16
|
4
|
|
|
|
|
14
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
17
|
120
|
|
|
|
|
79
|
my $token_type = $token->{type}; |
18
|
|
|
|
|
|
|
|
19
|
120
|
100
|
|
|
|
196
|
if ($token_type == MOD_WORD) { |
20
|
20
|
100
|
|
|
|
34
|
if ($tokens->[++$i]->{type} == COLON) { |
21
|
15
|
50
|
|
|
|
26
|
if ($tokens->[++$i]->{type} == LEFT_BRACE) { |
22
|
|
|
|
|
|
|
push @violations, { |
23
|
|
|
|
|
|
|
filename => $file, |
24
|
|
|
|
|
|
|
line => $token->{line}, |
25
|
15
|
|
|
|
|
49
|
description => DESC, |
26
|
|
|
|
|
|
|
explanation => EXPL, |
27
|
|
|
|
|
|
|
policy => __PACKAGE__, |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
4
|
|
|
|
|
11
|
return \@violations; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|