Branch Coverage

blib/lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMagicNumbers.pm
Criterion Covered Total %
branch 8 116 6.9


line true false branch
109 0 91 if ($all_integers_allowed)
112 0 0 if (%{$allowed_values;})
134 2 89 if (defined $config_string) { }
139 0 4 if ($value_string eq 'all_integers') { }
4 0 elsif ($value_string =~ / \A $SIGNED_NUMBER \z /msx) { }
0 0 elsif ($value_string =~ /$RANGE/msx) { }
165 0 2 if ($all_integers_allowed) { }
174 91 0 unless ($all_integers_allowed)
201 0 24 if ($allowed_type eq "Exp")
217 0 0 if ($self->{'_allow_to_the_right_of_a_fat_comma'})
218 0 0 if _element_is_to_the_right_of_a_fat_comma($elem)
221 0 0 if _element_is_in_an_include_readonly_or_version_statement($self, $elem)
224 0 0 if _element_is_in_a_plan_statement($elem)
225 0 0 if _element_is_in_a_constant_subroutine($elem)
226 0 0 if _element_is_a_package_statement_version_number($elem)
229 0 0 if (defined $literal and not $self->{'_all_integers_allowed'} && int $literal == $literal and not defined $self->{'_allowed_values'}{$literal} and not _element_is_sole_component_of_a_subscript($elem) && $literal == $SPECIAL_ARRAY_SUBSCRIPT_EXEMPTION)
255 0 0 if ($elem->isa($number_type))
271 0 0 unless my $previous = $elem->sprevious_sibling
273 0 0 unless $previous->isa("PPI::Token::Operator")
282 0 0 if ($parent and $parent->isa("PPI::Statement::Expression"))
283 0 0 if ($parent->schildren > 1)
288 0 0 if ($grandparent and $grandparent->isa("PPI::Structure::Subscript"))
304 0 0 if ($parent->isa("PPI::Statement"))
305 0 0 if $parent->isa("PPI::Statement::Include")
307 0 0 if ($parent->isa("PPI::Statement::Variable"))
308 0 0 if ($parent->type eq "our")
310 0 0 if (scalar @variables == 1 and $variables[0] eq "\$VERSION")
322 0 0 if ($first_token->isa('PPI::Token::Word')) { }
0 0 elsif ($parent->isa('PPI::Structure::Block')) { }
323 0 0 if ($self->{'_constant_creator_subroutines'}{$first_token->content})
346 0 0 unless $parent
348 0 0 unless $parent->isa("PPI::Statement")
351 0 0 if @children < $PLAN_STATEMENT_MINIMUM_TOKENS
353 0 0 unless $children[0]->isa("PPI::Token::Word")
354 0 0 if $children[0]->content ne "plan"
356 0 0 unless $children[1]->isa("PPI::Token::Word")
357 0 0 if $children[1]->content ne "tests"
359 0 0 unless $children[2]->isa("PPI::Token::Operator")
360 0 0 if $children[2]->content ne "=>"
369 0 0 unless $parent
371 0 0 unless $parent->isa("PPI::Statement")
374 0 0 if ($following)
375 0 0 unless $following->isa("PPI::Token::Structure")
376 0 0 if $following->content ne $Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers::SCOLON
377 0 0 if $following->snext_sibling
381 0 0 if ($preceding)
382 0 0 unless $preceding->isa("PPI::Token::Word")
383 0 0 if $preceding->content ne "return"
384 0 0 if $preceding->sprevious_sibling
387 0 0 if $parent->snext_sibling
388 0 0 if $parent->sprevious_sibling
391 0 0 unless $grandparent
393 0 0 unless $grandparent->isa("PPI::Structure::Block")
396 0 0 unless $greatgrandparent
397 0 0 unless $greatgrandparent->isa("PPI::Statement::Sub")
405 0 0 unless my $parent = $elem->statement
408 0 0 unless $parent->isa("PPI::Statement::Package")
411 0 0 unless my $version = $parent->schild(2)