Branch Coverage

blib/lib/Perl/Critic/Policy/RegularExpressions/ProhibitCaptureWithoutTest.pm
Criterion Covered Total %
branch 71 90 78.8


line true false branch
42 17 59 unless $elem =~ /\A \$[1-9] \z/msx
43 8 51 if _is_in_conditional_expression($elem)
44 39 12 if $self->_is_in_conditional_structure($elem)
55 24 81 if ($psib->isa("PPI::Token::Operator"))
57 12 12 if ($CONDITIONAL_OPERATOR{$op})
60 8 4 if $psib->isa("PPI::Token::Regexp::Match")
61 4 0 if $psib->isa("PPI::Token::Regexp::Substitute")
81 0 67 unless $stmt
86 35 8 if ($psib->isa("PPI::Node") and my $match = _find_exposed_match_or_substitute($psib))
97 8 35 if ($parent->isa('PPI::Statement::Compound') or $parent->isa('PPI::Statement::When')) { }
20 15 elsif ($parent->isa('PPI::Structure')) { }
103 4 16 if _is_in_conditional_expression($parent)
104 5 11 if $self->_is_in_conditional_structure($parent)
122 26 9 unless my $prev = $match->sprevious_sibling
125 5 8 unless $prev = $prev->sprevious_sibling
130 0 4 unless my $parent = $prev->parent
131 0 4 unless my $first = $parent->schild(0)
132 0 4 if (my $method = _get_method_name($first))
147 2 29 unless my $oper = $match->snext_sibling
151 3 26 unless "or" eq $oper_content or "||" eq $oper_content
154 0 26 unless my $next = $oper->snext_sibling
155 1 25 if (my $method = _get_method_name($next))
173 5 38 unless $elem->find(sub {
176 3 7 if $parent->isa("PPI::Structure::Block")
178 0 7 unless $parent = $parent->parent
192 0 30 unless $elem
194 0 29 unless $elem->isa("PPI::Token::Symbol") and "\$" eq $elem->raw_type or $elem->isa("PPI::Token::Word") and $elem->content =~ / \A [\w:]+ \z /msx
202 0 30 unless my $next = $elem->snext_sibling
207 0 1 unless $next = $next->snext_sibling
210 0 1 unless $prior and $prior->isa("PPI::Token::Operator") and "->" eq $prior->content
216 0 1 unless $next->isa("PPI::Token::Word")
231 11 8 if $UNAMBIGUOUS_CONTROL_TRANSFER{$content}
235 7 1 if "goto" eq $content
251 0 7 unless my $target = $xfer->snext_sibling
254 1 6 if $target->isa("PPI::Token::Symbol") and "&" eq $target->raw_type
261 5 1 if ($target->isa("PPI::Token::Word"))
268 3 7 if $container->isa("PPI::Structure::Block")
278 0 5 unless $xfer->location
279 0 5 unless defined $start_line
280 0 5 unless $elem->location
282 2 3 unless $container->find("PPI::Token::Label")
284 0 3 unless $label->content =~ /$looking_for/msx
285 0 3 unless $label->location
286 1 2 if $line < $start_line or $line == $start_line and $char < $start_char
289 1 1 if $line > $end_line or $line == $end_line and $char > $end_char