« Perl/Lint/Policy/ValuesAndExpressions/RequireNumberSeparators.pm
↑ Summary
Perl/Lint/Policy/ClassHierarchies/ProhibitAutoloading.pm »
| 1 | package Perl::Lint::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use Perl::Lint::Constants::Type; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use parent "Perl::Lint::Policy"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use constant { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 3 | DESC => 'Heredoc terminator must be quoted', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | EXPL => [64], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | sub evaluate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
evaluate: called CC=8 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | my ($class, $file, $tokens, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | my @violations; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | for (my $i = 0; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 51 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # XXX workaround | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # Compiler::Lexer cannot recognize heredoc tag as bare word and lowercase | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # https://github.com/goccy/p5-Compiler-Lexer/issues/37 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # e.g. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # <<endquote | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 51 | my $is_before_left_shift = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 51 | ▶ | if ($token_type == LEFT_SHIFT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $token = $tokens->[++$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | $is_before_left_shift = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 51 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$token_type == 176 or $token_type == 177 or $is_before_left_shift and $token_type == 122
$token_type == 176 or $token_type == 177
$is_before_left_shift and $token_type == 122
MC/DC0%0/4
$token_type == 176 or $token_type == 177 or $is_before_left_shift and $token_type == 122
$token_type == 176
$token_type == 177
$is_before_left_shift
$token_type == 122
Truth table20%1/5
A or B or C and D
A= $token_type == 176B= $token_type == 177C= $is_before_left_shiftD= $token_type == 122
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | $token_type == HERE_DOCUMENT_TAG || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | $token_type == HERE_DOCUMENT_RAW_TAG || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | ($is_before_left_shift && $token_type == KEY) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ($token->{data} =~ /[a-z]/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | push @violations, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | filename => $file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | line => $token->{line}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | description => DESC, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | explanation => EXPL, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 2 | return \@violations; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||