line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::ValuesAndExpressions::ProhibitSpecialHeredocTerminator; |
2
|
134
|
|
|
134
|
|
69500
|
use strict; |
|
134
|
|
|
|
|
173
|
|
|
134
|
|
|
|
|
3138
|
|
3
|
134
|
|
|
134
|
|
417
|
use warnings; |
|
134
|
|
|
|
|
148
|
|
|
134
|
|
|
|
|
2393
|
|
4
|
134
|
|
|
134
|
|
813
|
use Perl::Lint::Constants::Type; |
|
134
|
|
|
|
|
161
|
|
|
134
|
|
|
|
|
60642
|
|
5
|
134
|
|
|
134
|
|
620
|
use parent "Perl::Lint::Policy"; |
|
134
|
|
|
|
|
159
|
|
|
134
|
|
|
|
|
573
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
134
|
|
|
|
|
22570
|
DESC => 'Heredoc terminator must not be a special literal', |
9
|
|
|
|
|
|
|
EXPL => 'Used "%s" as heredoc terminator', |
10
|
134
|
|
|
134
|
|
6762
|
}; |
|
134
|
|
|
|
|
176
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
6
|
|
|
6
|
0
|
11
|
my ($class, $file, $tokens, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
6
|
|
|
|
|
7
|
my @violations; |
16
|
6
|
|
|
|
|
23
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
17
|
194
|
|
|
|
|
122
|
my $token_type = $token->{type}; |
18
|
194
|
100
|
100
|
|
|
799
|
if ($token_type == HERE_DOCUMENT_TAG || $token_type == HERE_DOCUMENT_RAW_TAG || $token_type == HERE_DOCUMENT_BARE_TAG) { |
|
|
|
100
|
|
|
|
|
19
|
13
|
|
|
|
|
15
|
my $token_data = $token->{data}; |
20
|
13
|
100
|
100
|
|
|
72
|
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
|
|
|
|
|
67
|
description => DESC, |
31
|
|
|
|
|
|
|
explanation => sprintf(EXPL, $token_data), |
32
|
|
|
|
|
|
|
policy => __PACKAGE__, |
33
|
|
|
|
|
|
|
}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
6
|
|
|
|
|
18
|
return \@violations; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|