« Perl/Lint/Policy/Variables/ProhibitAugmentedAssignmentInDeclaration.pm
↑ Summary
Perl/Lint/Policy/BuiltinFunctions/ProhibitUniversalCan.pm »
| 1 | package Perl::Lint::Policy::Variables::RequireLexicalLoopIterators; | ||||||||||||||||||||||||||||||||||||||||||||||
| 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 => 'Loop iterator is not lexical', | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | EXPL => [108], | ||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub evaluate { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
evaluate: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my ($class, $file, $tokens, $src, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my $perl_version_threshold = 5.003; | |||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my $perl_version = 6; # to hit always on default. Yes, this is Perl6 :) | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | my @violations; | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | for (my $i = 0, my $token_type; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$token_type == 133 or $token_type == 134 and $perl_version > $perl_version_threshold
$token_type == 134 and $perl_version > $perl_version_threshold
MC/DC0%0/3
$token_type == 133 or $token_type == 134 and $perl_version > $perl_version_threshold
$token_type == 133
$token_type == 134
$perl_version > $perl_version_threshold
Truth table0%0/4
A or B and C
A= $token_type == 133B= $token_type == 134C= $perl_version > $perl_version_threshold
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | $token_type == FOR_STATEMENT || | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ($token_type == FOREACH_STATEMENT && $perl_version > $perl_version_threshold) | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | $token = $tokens->[++$i]; | |||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | if ($token_type != VAR_DECL && $token_type != LEFT_PAREN) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$token_type != 62 and $token_type != 107
MC/DC0%0/2
$token_type != 62 and $token_type != 107
$token_type != 62
$token_type != 107
Truth table0%0/3
A and B
A= $token_type != 62B= $token_type != 107
| |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | push @violations, { | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | filename => $file, | ||||||||||||||||||||||||||||||||||||||||||||||
| 32 | line => $token->{line}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | description => DESC, | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | explanation => EXPL, | ||||||||||||||||||||||||||||||||||||||||||||||
| 35 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ▶ | elsif ($token_type == USE_DECL || $token_type == REQUIRE_DECL) { | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$token_type == 93 or $token_type == 71
MC/DC0%0/2
$token_type == 93 or $token_type == 71
$token_type == 93
$token_type == 71
Truth table0%0/3
A or B
A= $token_type == 93B= $token_type == 71
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | $token = $tokens->[++$i]; | |||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if ($token->{type} == DOUBLE) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $perl_version = $token->{data}; | |||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | return \@violations; | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||