line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::Miscellanea::ProhibitFormats; |
2
|
133
|
|
|
133
|
|
68572
|
use strict; |
|
133
|
|
|
|
|
202
|
|
|
133
|
|
|
|
|
3285
|
|
3
|
133
|
|
|
133
|
|
432
|
use warnings; |
|
133
|
|
|
|
|
177
|
|
|
133
|
|
|
|
|
2553
|
|
4
|
133
|
|
|
133
|
|
814
|
use Perl::Lint::Constants::Type; |
|
133
|
|
|
|
|
159
|
|
|
133
|
|
|
|
|
59498
|
|
5
|
133
|
|
|
133
|
|
655
|
use parent "Perl::Lint::Policy"; |
|
133
|
|
|
|
|
182
|
|
|
133
|
|
|
|
|
618
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
133
|
|
|
|
|
20145
|
DESC => 'Format used', |
9
|
|
|
|
|
|
|
EXPL => [449], |
10
|
133
|
|
|
133
|
|
6937
|
}; |
|
133
|
|
|
|
|
183
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
3
|
|
|
3
|
0
|
5
|
my ($class, $file, $tokens, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
2
|
my @violations; |
16
|
|
|
|
|
|
|
my $next_token; |
17
|
3
|
|
|
|
|
13
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
18
|
61
|
100
|
|
|
|
116
|
if ($token->{type} == FORMAT_DECL) { |
19
|
6
|
|
|
|
|
8
|
$next_token = $tokens->[$i+1]; |
20
|
6
|
100
|
|
|
|
10
|
if ($next_token->{type} != ARROW) { |
21
|
|
|
|
|
|
|
# XXX workaround for Compiler::Lexer |
22
|
|
|
|
|
|
|
# ref: https://github.com/goccy/p5-Compiler-Lexer/issues/33 |
23
|
|
|
|
|
|
|
push @violations, { |
24
|
|
|
|
|
|
|
filename => $file, |
25
|
|
|
|
|
|
|
line => $token->{line}, |
26
|
5
|
|
|
|
|
22
|
description => DESC, |
27
|
|
|
|
|
|
|
explanation => EXPL, |
28
|
|
|
|
|
|
|
policy => __PACKAGE__, |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
12
|
return \@violations; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|