« Perl/Lint/Policy/ClassHierarchies/ProhibitExplicitISA.pm
↑ Summary
Perl/Lint/Policy/ValuesAndExpressions/ProhibitConstantPragma.pm »
| 1 | package Perl::Lint::Policy::Subroutines::ProhibitExplicitReturnUndef; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use Perl::Lint::Constants::Type; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use parent "Perl::Lint::Policy"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use constant { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | DESC => '"return" statement with explicit "undef"', | |||||||||||||||||||||||||||
| 9 | EXPL => [199], | ||||||||||||||||||||||||||||
| 10 | 2 | }; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub evaluate { | ||||||||||||||||||||||||||
|
Subroutine
evaluate: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 0 | my ($class, $file, $tokens, $args) = @_; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | my @violations; | |||||||||||||||||||||||||||
| 16 | 0 | ▶ | for (my $i = 0; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | if ($token_type == RETURN) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 0 | my $next_token = $tokens->[++$i]; | |||||||||||||||||||||||||||
| 21 | 0 | ▶ | if ($next_token->{type} == DEFAULT && $next_token->{data} eq 'undef') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$next_token->{"type"} == 207 and $next_token->{"data"} eq "undef"
MC/DC0%0/2
$next_token->{"type"} == 207 and $next_token->{"data"} eq "undef"
$next_token->{"type"} == 207
$next_token->{"data"} eq "undef"
Truth table0%0/3
A and B
A= $next_token->{"type"} == 207B= $next_token->{"data"} eq "undef"
| |||||||||||||||||||||||||||||
| 22 | push @violations, { | ||||||||||||||||||||||||||||
| 23 | filename => $file, | ||||||||||||||||||||||||||||
| 24 | line => $token->{line}, | ||||||||||||||||||||||||||||
| 25 | 0 | description => DESC, | |||||||||||||||||||||||||||
| 26 | explanation => EXPL, | ||||||||||||||||||||||||||||
| 27 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||
| 28 | }; | ||||||||||||||||||||||||||||
| 29 | 0 | next; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | return \@violations; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 2 | 1; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||