« blib/lib/Perl/Lint/Policy/ValuesAndExpressions/RequireNumberSeparators.pm
↑ Summary
blib/lib/Perl/Lint/Policy/ValuesAndExpressions/RequireUpperCaseHeredocTerminator.pm »
| 1 | package Perl::Lint::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Perl::Lint::Constants::Type; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 5 | use parent "Perl::Lint::Policy"; | ||
| 6 | |||
| 7 | use constant { | ||
| 8 | DESC => 'Heredoc terminator must be quoted', | ||
| 9 | EXPL => [64], | ||
| 10 | }; | ||
| 11 | |||
| 12 | sub evaluate { | ||
| 13 | my ($class, $file, $tokens, $src, $args) = @_; | ||
| 14 | |||
| 15 | my @violations; | ||
| 16 | for (my $i = 0, my $token_type; my $token = $tokens->[$i]; $i++) { | ||
| 17 | $token_type = $token->{type}; | ||
| 18 | |||
| 19 | if ($token_type == HERE_DOCUMENT_BARE_TAG) { | ||
| 20 | push @violations, { | ||
| 21 | filename => $file, | ||
| 22 | line => $token->{line}, | ||
| 23 | description => DESC, | ||
| 24 | explanation => EXPL, | ||
| 25 | policy => __PACKAGE__, | ||
| 26 | }; | ||
| 27 | } | ||
| 28 | } | ||
| 29 | |||
| 30 | return \@violations; | ||
| 31 | } | ||
| 32 | |||
| 33 | 1; | ||
| 34 | |||