Branch Coverage

blib/lib/Perl/Critic/Policy/Subroutines/RequireArgUnpacking.pm
Criterion Covered Total %
branch 88 108 81.4


line true false branch
76 1 45 unless $elem->block
81 1 44 unless @statements
88 1 43 if $self->{'_short_subroutine_statements'} >= @statements
103 44 30 if _is_size_check($magic)
105 22 8 if ("unpacking" eq $state)
106 11 11 if ($self->_is_unpack($magic))
115 0 19 if _is_cast_of_array($magic) and _is_postfix_foreach($magic)
120 0 19 if _is_cast_of_scalar($magic)
124 6 13 if $self->_is_delegation($magic)
129 105 11 unless ($saw_unpack)
144 10 12 if ($next and $next->isa("PPI::Structure::Subscript"))
145 6 4 unless $self->{'_allow_subscripts'}
149 11 0 if $prev and $prev->isa("PPI::Token::Operator") and is_assignment_operator($prev->content) and !$next || $next->isa('PPI::Token::Structure') && $Perl::Critic::Policy::Subroutines::RequireArgUnpacking::SCOLON eq $next->content
165 10 64 unless $AT eq $magic->raw_type
170 50 14 if ($prev or $next)
172 40 10 if _legal_before_size_check($prev) and _legal_after_size_check($next)
179 0 40 unless $parent = $parent->parent
183 16 24 unless $prev or $next
188 4 20 if $parent->isa("PPI::Structure::Condition")
204 12 28 unless $next
208 22 6 if $next->isa("PPI::Token::Operator")
211 6 0 if $next->isa("PPI::Token::Structure")
228 12 38 unless $prev
232 31 7 if $prev->isa("PPI::Token::Operator")
235 7 0 if $prev->isa("PPI::Token::Word")
247 0 0 if $sibling->isa("PPI::Token::Word") and $sibling =~ / \A for (?:each)? \z /msx
260 0 8 if $prev and $prev->content eq $AT and $prev->isa("PPI::Token::Cast")
288 7 12 unless $AT_ARG eq $magic->content
289 0 12 unless my $parent = $magic->parent
291 0 12 unless $parent->isa("PPI::Statement::Expression")
293 2 10 unless 1 == $parent->schildren
295 0 10 unless $parent = $parent->parent
297 0 10 unless $parent->isa("PPI::Structure::List")
299 0 10 unless 1 == $parent->schildren
301 0 10 unless my $subroutine_name = $parent->sprevious_sibling
303 6 4 if ($subroutine_name->isa('PPI::Token::Word')) { }
2 4 elsif ($self->{'_allow_closures'} and _is_dereference_operator($subroutine_name)) { }
304 1 5 if $self->{'_allow_delegation_to'}{$subroutine_name}
306 1 4 unless my($subroutine_namespace) = $subroutine_name =~ / \A ( .* ::) \w+ \z /msx
313 0 3 unless $prev_sib = $prev_sib->sprevious_sibling
315 1 2 if $prev_sib->isa("PPI::Structure::Subscript")
326 0 2 unless $elem
328 0 2 unless $elem->isa("PPI::Token::Operator")
337 52 77 unless $statement->find(\&Perl::Critic::Policy::Subroutines::RequireArgUnpacking::_magic_finder)
343 77 1614 if $elem->isa("PPI::Token::Magic")
345 21 1593 if ($elem->isa("PPI::Structure::Block"))
347 1 20 if $elem->statement->isa("PPI::Statement::Sub")
350 5 15 if _is_anon_sub($elem)
363 0 20 unless my $prev = $elem->sprevious_sibling
367 1 19 if $prev->isa("PPI::Token::Word") and "sub" eq $prev->content
382 1 3 unless $prev = $prev->sprevious_sibling
387 1 17 if $prev->isa("PPI::Token::Label") and $prev->content =~ / \A sub \s* : \z /msx
392 0 17 if $prev->isa("PPI::Token::Prototype") and not $prev = $prev->sprevious_sibling
396 3 14 if $prev->isa("PPI::Token::Word") and "sub" eq $prev->content