« Perl/Lint/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm
↑ Summary
Perl/Lint/Policy/Subroutines/ProhibitNestedSubs.pm »
| 1 | package Perl::Lint::Policy::Variables::RequireInitializationForLocalVars; | ||||||||||||||
| 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 => '"local" variable not initialized', | |||||||||||||
| 9 | EXPL => [78], | ||||||||||||||
| 10 | 2 | }; | |||||||||||||
| 11 | |||||||||||||||
| 12 | 0 | ▶ | sub evaluate { | ||||||||||||
|
Subroutine
evaluate: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||
| 13 | 0 | my ($class, $file, $tokens, $src, $args) = @_; | |||||||||||||
| 14 | |||||||||||||||
| 15 | 0 | my @violations; | |||||||||||||
| 16 | 0 | ▶ | for (my $i = 0, my $token_type; my $token = $tokens->[$i]; $i++) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 17 | 0 | $token_type = $token->{type}; | |||||||||||||
| 18 | |||||||||||||||
| 19 | 0 | ▶ | if ($token_type == LOCAL_DECL) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 20 | 0 | $token = $tokens->[++$i]; | |||||||||||||
| 21 | 0 | $token_type = $token->{type}; | |||||||||||||
| 22 | |||||||||||||||
| 23 | 0 | ▶ | if ($token_type == LEFT_PAREN) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 24 | 0 | my $left_paren_num = 1; | |||||||||||||
| 25 | 0 | ▶ | for ($i++; $token = $tokens->[$i]; $i++) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 26 | 0 | $token_type = $token->{type}; | |||||||||||||
| 27 | |||||||||||||||
| 28 | 0 | ▶ | if ($token_type == LEFT_PAREN) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 29 | 0 | $left_paren_num++; | |||||||||||||
| 30 | } | ||||||||||||||
| 31 | elsif ($token_type == RIGHT_PAREN) { | ||||||||||||||
| 32 | 0 | ▶ | last if --$left_paren_num <= 0; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 33 | } | ||||||||||||||
| 34 | } | ||||||||||||||
| 35 | } | ||||||||||||||
| 36 | |||||||||||||||
| 37 | 0 | $token = $tokens->[++$i]; | |||||||||||||
| 38 | 0 | $token_type = $token->{type}; | |||||||||||||
| 39 | |||||||||||||||
| 40 | 0 | ▶ | if ($token_type != ASSIGN) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 41 | push @violations, { | ||||||||||||||
| 42 | filename => $file, | ||||||||||||||
| 43 | line => $token->{line}, | ||||||||||||||
| 44 | 0 | description => DESC, | |||||||||||||
| 45 | explanation => EXPL, | ||||||||||||||
| 46 | policy => __PACKAGE__, | ||||||||||||||
| 47 | }; | ||||||||||||||
| 48 | } | ||||||||||||||
| 49 | } | ||||||||||||||
| 50 | } | ||||||||||||||
| 51 | |||||||||||||||
| 52 | 0 | return \@violations; | |||||||||||||
| 53 | } | ||||||||||||||
| 54 | |||||||||||||||
| 55 | 2 | 1; | |||||||||||||
| 56 | |||||||||||||||