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   95505 use strict;
  133         271  
  133         4904  
3 133     133   598 use warnings;
  133         207  
  133         4569  
4 133     133   1209 use Perl::Lint::Constants::Type;
  133         217  
  133         84947  
5 133     133   763 use parent "Perl::Lint::Policy";
  133         221  
  133         867  
6              
7             use constant {
8 133         24985 DESC => 'Heredoc terminator must be quoted',
9             EXPL => [64],
10 133     133   9003 };
  133         259  
11              
12             sub evaluate {
13 6     6 0 10 my ($class, $file, $tokens, $src, $args) = @_;
14              
15 6         6 my @violations;
16 6         21 for (my $i = 0, my $token_type; my $token = $tokens->[$i]; $i++) {
17 43         37 $token_type = $token->{type};
18              
19 43 100       100 if ($token_type == HERE_DOCUMENT_BARE_TAG) {
20 2         12 push @violations, {
21             filename => $file,
22             line => $token->{line},
23             description => DESC,
24             explanation => EXPL,
25             policy => __PACKAGE__,
26             };
27             }
28             }
29              
30 6         141 return \@violations;
31             }
32              
33             1;
34