File Coverage

blib/lib/Perl/Lint/Policy/ValuesAndExpressions/RequireQuotedHeredocTerminator.pm
Criterion Covered Total %
statement 22 22 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Perl::Lint::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator;
2 133     133   70103 use strict;
  133         168  
  133         3065  
3 133     133   406 use warnings;
  133         166  
  133         2409  
4 133     133   786 use Perl::Lint::Constants::Type;
  133         153  
  133         60215  
5 133     133   553 use parent "Perl::Lint::Policy";
  133         151  
  133         566  
6              
7             use constant {
8 133         18941 DESC => 'Heredoc terminator must be quoted',
9             EXPL => [64],
10 133     133   6565 };
  133         155  
11              
12             sub evaluate {
13 6     6 0 10 my ($class, $file, $tokens, $src, $args) = @_;
14              
15 6         5 my @violations;
16 6         20 for (my $i = 0, my $token_type; my $token = $tokens->[$i]; $i++) {
17 43         31 $token_type = $token->{type};
18              
19 43 100       75 if ($token_type == HERE_DOCUMENT_BARE_TAG) {
20             push @violations, {
21             filename => $file,
22             line => $token->{line},
23 2         11 description => DESC,
24             explanation => EXPL,
25             policy => __PACKAGE__,
26             };
27             }
28             }
29              
30 6         18 return \@violations;
31             }
32              
33             1;
34