Branch Coverage

blib/lib/Perl/Critic/Policy/Variables/RequireNegativeIndices.pm
Criterion Covered Total %
branch 59 80 73.7


line true false branch
30 5 39 if $elem->braces ne "[]"
32 14 25 unless $name
33 12 13 unless _is_array_name($elem, $name, $isref)
44 0 39 if @children != 1
45 0 39 unless $children[0]->isa("PPI::Statement::Expression")
49 0 39 if not @expr or @expr > $MAX_EXPRESSION_COMPLEXETY
51 14 25 unless $name
52 1 24 if not @expr and $isindex
53 0 24 unless _is_minus_number(@expr)
61 6 33 if ($expr->[0]->isa('PPI::Token::ArrayIndex')) { }
14 19 elsif ($expr->[0]->isa('PPI::Token::Cast')) { }
13 6 elsif ($expr->[0]->isa('PPI::Token::Symbol')) { }
81 6 0 if ($arrindex->content =~ /\A \$[#] (.*) \z /msx)
91 14 0 if ($cast eq "\$#" or $cast eq "\@")
92 9 5 $cast eq '$#' ? :
94 8 6 if ($arrvar->isa('PPI::Structure::Block')) { }
6 0 elsif ($arrvar->isa('PPI::Token::Symbol')) { }
97 0 8 if @blockchildren != 1
98 0 8 unless $blockchildren[0]->isa("PPI::Statement")
100 2 6 if @ggg != 1
101 0 6 unless $ggg[0]->isa("PPI::Token::Symbol")
102 6 0 if ($ggg[0] =~ /\A \$ (.*) \z/msx)
108 6 0 if ($arrvar =~ /\A \$ (.*) \z/msx)
120 7 6 if ($arrvar =~ /\A \@ (.*) \z/msx)
129 0 24 unless @expr
131 0 24 if @expr != 2
134 0 24 unless $op->isa("PPI::Token::Operator")
135 0 24 if $op ne "-"
138 0 24 unless $number->isa("PPI::Token::Number")
147 0 25 unless $sib
149 8 17 if ($sib->isa("PPI::Token::Operator") and $sib eq "->")
150 3 5 unless $isref
153 0 5 unless $sib
156 1 21 unless $sib->isa("PPI::Token::Symbol")
157 4 17 unless $sib =~ /\A \$ \Q$name\E \z/msx
160 4 13 if $isref ^ _is_dereferencer($cousin)
161 0 13 if $isref and _is_dereferencer($cousin->sprevious_sibling)
169 15 6 unless $elem
170 0 6 if $elem->isa("PPI::Token::Operator") and $elem eq "->"
171 5 1 if $elem->isa("PPI::Token::Cast")