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