line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::ValuesAndExpressions::ProhibitSpecialHeredocTerminator; |
2
|
134
|
|
|
134
|
|
68324
|
use strict; |
|
134
|
|
|
|
|
179
|
|
|
134
|
|
|
|
|
3161
|
|
3
|
134
|
|
|
134
|
|
419
|
use warnings; |
|
134
|
|
|
|
|
146
|
|
|
134
|
|
|
|
|
2467
|
|
4
|
134
|
|
|
134
|
|
754
|
use Perl::Lint::Constants::Type; |
|
134
|
|
|
|
|
145
|
|
|
134
|
|
|
|
|
60829
|
|
5
|
134
|
|
|
134
|
|
568
|
use parent "Perl::Lint::Policy"; |
|
134
|
|
|
|
|
201
|
|
|
134
|
|
|
|
|
563
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
134
|
|
|
|
|
22862
|
DESC => 'Heredoc terminator must not be a special literal', |
9
|
|
|
|
|
|
|
EXPL => 'Used "%s" as heredoc terminator', |
10
|
134
|
|
|
134
|
|
6632
|
}; |
|
134
|
|
|
|
|
165
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
6
|
|
|
6
|
0
|
9
|
my ($class, $file, $tokens, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
6
|
|
|
|
|
7
|
my @violations; |
16
|
6
|
|
|
|
|
21
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
17
|
194
|
|
|
|
|
122
|
my $token_type = $token->{type}; |
18
|
194
|
100
|
100
|
|
|
785
|
if ($token_type == HERE_DOCUMENT_TAG || $token_type == HERE_DOCUMENT_RAW_TAG || $token_type == HERE_DOCUMENT_BARE_TAG) { |
|
|
|
100
|
|
|
|
|
19
|
13
|
|
|
|
|
24
|
my $token_data = $token->{data}; |
20
|
13
|
100
|
100
|
|
|
69
|
if ( |
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
21
|
|
|
|
|
|
|
$token_data eq '__FILE__' || |
22
|
|
|
|
|
|
|
$token_data eq '__LINE__' || |
23
|
|
|
|
|
|
|
$token_data eq '__PACKAGE__' || |
24
|
|
|
|
|
|
|
$token_data eq '__END__' || |
25
|
|
|
|
|
|
|
$token_data eq '__DATA__' |
26
|
|
|
|
|
|
|
) { |
27
|
|
|
|
|
|
|
push @violations, { |
28
|
|
|
|
|
|
|
filename => $file, |
29
|
|
|
|
|
|
|
line => $token->{line}, |
30
|
12
|
|
|
|
|
68
|
description => DESC, |
31
|
|
|
|
|
|
|
explanation => sprintf(EXPL, $token_data), |
32
|
|
|
|
|
|
|
policy => __PACKAGE__, |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
6
|
|
|
|
|
33
|
return \@violations; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|