Branch Coverage

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


line true false branch
109 7 208 if ($all_integers_allowed)
112 2 5 if (%{$allowed_values;})
134 31 184 if (defined $config_string) { }
139 7 33 if ($value_string eq 'all_integers') { }
25 8 elsif ($value_string =~ / \A $SIGNED_NUMBER \z /msx) { }
8 0 elsif ($value_string =~ /$RANGE/msx) { }
165 7 24 if ($all_integers_allowed) { }
174 208 7 unless ($all_integers_allowed)
201 2 142 if ($allowed_type eq "Exp")
217 276 18 if ($self->{'_allow_to_the_right_of_a_fat_comma'})
218 23 253 if _element_is_to_the_right_of_a_fat_comma($elem)
221 95 176 if _element_is_in_an_include_readonly_or_version_statement($self, $elem)
224 0 176 if _element_is_in_a_plan_statement($elem)
225 2 174 if _element_is_in_a_constant_subroutine($elem)
226 2 172 if _element_is_a_package_statement_version_number($elem)
229 37 124 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 10 642 if ($elem->isa($number_type))
271 63 213 unless my $previous = $elem->sprevious_sibling
273 9 204 unless $previous->isa("PPI::Token::Operator")
282 13 25 if ($parent and $parent->isa("PPI::Statement::Expression"))
283 11 2 if ($parent->schildren > 1)
288 2 0 if ($grandparent and $grandparent->isa("PPI::Structure::Subscript"))
304 492 396 if ($parent->isa("PPI::Statement"))
305 22 470 if $parent->isa("PPI::Statement::Include")
307 58 412 if ($parent->isa("PPI::Statement::Variable"))
308 58 0 if ($parent->type eq "our")
310 57 1 if (scalar @variables == 1 and $variables[0] eq "\$VERSION")
322 48 364 if ($first_token->isa('PPI::Token::Word')) { }
0 364 elsif ($parent->isa('PPI::Structure::Block')) { }
323 16 32 if ($self->{'_constant_creator_subroutines'}{$first_token->content})
346 0 176 unless $parent
348 0 176 unless $parent->isa("PPI::Statement")
351 37 139 if @children < $PLAN_STATEMENT_MINIMUM_TOKENS
353 132 7 unless $children[0]->isa("PPI::Token::Word")
354 7 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 176 unless $parent
371 0 176 unless $parent->isa("PPI::Statement")
374 148 28 if ($following)
375 80 68 unless $following->isa("PPI::Token::Structure")
376 0 68 if $following->content ne $Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers::SCOLON
377 0 68 if $following->snext_sibling
381 92 4 if ($preceding)
382 88 4 unless $preceding->isa("PPI::Token::Word")
383 2 2 if $preceding->content ne "return"
384 0 2 if $preceding->sprevious_sibling
387 0 6 if $parent->snext_sibling
388 1 5 if $parent->sprevious_sibling
391 0 5 unless $grandparent
393 3 2 unless $grandparent->isa("PPI::Structure::Block")
396 0 2 unless $greatgrandparent
397 0 2 unless $greatgrandparent->isa("PPI::Statement::Sub")
405 0 174 unless my $parent = $elem->statement
408 170 4 unless $parent->isa("PPI::Statement::Package")
411 0 4 unless my $version = $parent->schild(2)