Branch Coverage

blib/lib/Perl/Critic/Policy/Variables/ProhibitUnusedVarsStricter.pm
Criterion Covered Total %
branch 226 300 75.3


line true false branch
197 60 0 if (my $token = $document->last_token)
208 0 60 if $self->{'_dump'}
226 0 0 if (defined $fn) { }
254 2 58 if $self->{'_check_catch'}
284 0 9 ($code = $doc->can('ppix_regexp_from_element')) ? :
301 0 74 unless my $ppi = $ppix_elem->ppi
315 213 42 if (my $parent = $elem->parent) { }
328 0 86 unless my $outer_top = $outer_elem->top
331 0 120 unless my $inner_top = $inner_elem->top
333 82 38 if $inner_top == $outer_top
335 4 34 unless $inner_elem = $self->_get_parent_element($inner_top)
346 43 54 unless $document->find("PPI::Statement::Variable")
349 561 21 unless $document->find($class)
350 0 31 unless my $str = $self->_get_ppix_quotelike($elem)
352 7 24 unless $str->find("PPIx::QuoteLike::Token::Interpolation")
354 0 28 unless my $ppi = $self->_get_derived_ppi_document($code, $elem)
362 284 7 unless $document->find($class)
363 0 9 unless my $pre = $self->_get_ppix_regexp($elem)
365 0 9 unless $pre->find("PPIx::Regexp::Token::Code")
367 0 9 unless my $ppi = $self->_get_derived_ppi_document($code, $elem)
385 0 2 unless $document->find("PPI::Token::Word")
386 5 2 unless $CATCH eq $word->content
388 0 2 unless my $list = $word->snext_sibling
390 0 2 unless $list->isa("PPI::Structure::List")
392 0 2 unless my $block = $list->snext_sibling
394 0 2 unless $block->isa("PPI::Structure::Block")
396 0 2 unless $list->find("PPI::Token::Symbol")
414 57 3 unless $document->find("PPI::Structure::Signature")
425 4 1 if ($elem->isa('PPI::Token::Symbol')) { }
1 0 elsif ($elem->isa('PPI::Token::Operator')) { }
426 3 1 if ($declaration)
428 3 0 if length $elem->content > 1
433 0 1 if $IS_COMMA{$elem->content}
451 0 102 unless my $elem = $declaration->schild(0)
468 275 126 unless $elem->isa("PPI::Token::Word")
471 22 104 unless defined(my $is_global = $GLOBAL_DECLARATION{$elem->content})
474 2 102 unless $elem = $elem->snext_sibling
483 93 9 if ($elem->isa('PPI::Token::Symbol')) { }
9 0 elsif ($elem->isa('PPI::Structure::List')) { }
487 0 9 unless $elem->find("PPI::Token::Symbol")
498 88 21 if ($assign)
499 0 88 unless $symbol->logical_line_number < $assign->logical_line_number or $symbol->logical_line_number == $assign->logical_line_number and $symbol->column_number < $assign->column_number
520 100 299 unless $elem and $elem = $elem->snext_sibling
546 18 97 unless $elem->isa("PPI::Token::Operator")
549 4 93 if $IS_COMMA{$content}
551 86 7 if ($Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter::EQUAL eq $content) { }
4 3 elsif ($IS_INC_DEC{$content}) { }
599 105 15 unless $document->find($class)
602 0 27 unless my $type = $declaration->schild(0)
607 13 14 if ($info->{'want'}{$type_str})
609 0 13 unless my $sib = $type->snext_sibling
613 5 8 unless $sib->isa("PPI::Token::Word")
616 0 8 unless defined(my $is_global = $GLOBAL_DECLARATION{$sib_content})
619 0 8 unless my $symbol = $sib->snext_sibling
621 0 8 unless $symbol->isa("PPI::Token::Symbol")
646 0 86 unless my $next_sib = $elem->snext_sibling
648 13 73 if ($next_sib->isa('PPI::Token::Word')) { }
9 64 elsif ($next_sib->isa('PPI::Token::Symbol')) { }
652 1 12 if $self->{'_allow_if_computed_by'}{$content}
657 0 12 unless $next_sib = $next_sib->snext_sibling
659 10 2 unless $next_sib->isa("PPI::Token::Operator") and $next_sib->content eq $DEREF
664 0 2 unless $next_sib = $next_sib->snext_sibling
666 0 2 unless $next_sib->isa("PPI::Token::Word")
670 1 1 if $self->{'_allow_if_computed_by'}{$content}
676 0 9 unless $next_sib = $next_sib->snext_sibling
678 8 1 unless $next_sib->isa("PPI::Token::Operator") and "->" eq $next_sib->content
681 0 1 unless $next_sib = $next_sib->snext_sibling
684 1 0 if $self->{'_allow_if_computed_by'}{$content}
709 84 2 unless (defined $type)
710 0 84 unless $declaration->can("type")
717 79 7 unless "state" eq $type
725 2 12 if $next_sib->isa("PPI::Token::Operator") and $LOW_PRECEDENCE_BOOLEAN{$next_sib->content}
736 18 9 unless my $sib = $elem->$method
738 1 8 if $sib->isa("PPI::Token::Operator")
754 0 102 unless my $parent = $self->_get_parent_element($elem)
758 12 90 if ($parent->isa('PPI::Structure::List')) { }
25 65 elsif ($parent->isa('PPI::Structure::Block')) { }
760 1 11 unless $cast = $parent->sprevious_sibling
765 11 14 unless my $prev = $parent->sprevious_sibling
768 1 13 unless $prev->isa("PPI::Token::Word")
770 9 4 unless "do" eq $prev->content
778 67 13 unless $cast
779 7 6 unless $cast->isa("PPI::Token::Cast")
788 0 102 unless my $parent = $self->_get_parent_element($elem)
790 64 38 unless my $stmt = $parent->statement
792 34 4 unless $stmt->isa("PPI::Statement::Break")
794 0 4 unless my $kind = $stmt->schild(0)
814 2 95 unless $document->find("PPI::Token::Symbol")
816 122 93 if $self->{$PACKAGE}{'is_declaration'}{builtin::refaddr($symbol)}
828 96 1 unless $document->find("PPI::Token::ArrayIndex")
832 0 1 unless $name =~ s/ \A \$ [#] /\@/msx
852 152 42 unless $document->find($class)
854 8 56 unless $LEFT_BRACE eq $elem->start
856 12 44 unless my $previous = $elem->sprevious_sibling
858 40 4 unless $previous->isa("PPI::Token::Cast") or $previous->isa("PPI::Token::Magic")
862 0 4 unless my $sigil = $CAST_FOR_BARE_BRACKETED_VARIABLE{$previous->content}
866 0 4 unless 1 == @kids
868 0 4 unless $kids[0]->isa("PPI::Statement")
872 0 4 unless 1 == @grand_kids
877 3 1 unless $grand_kids[0]->isa("PPI::Token::Word") or $grand_kids[0]->isa("PPI::Token::Number::Version")
924 76 698 unless exists $arg{$key}
927 0 129 if ($self->{'_trace'}{$sym_name})
948 93 2 unless defined $symbol_name
951 24 71 unless ($declaration = $self->{$PACKAGE}{'declared'}{$symbol_name})
955 6 18 unless my $prev = $symbol->sprevious_sibling
957 8 10 unless $prev->isa("PPI::Token::Word")
960 3 7 unless exists $GLOBAL_DECLARATION{$type}
967 0 7 unless ($cast)
969 0 0 if $parent = $self->_get_parent_element($prev)
989 33 38 if (delete $self->{$PACKAGE}{'need_sort'})
1000 0 14 unless $Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter::b->[1][3] <=> $Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter::a->[1][3]
1013 16 70 unless $self->_derived_element_is_in_lexical_scope_after_statement_containing($symbol, $decl_scope->{'declaration'})
1015 0 70 if ($self->{'_trace'}{$symbol_name})
1030 0 1 if ($self->{'_trace'}{$symbol_name})
1046 4 82 unless my $effective_inner = $self->_get_lowest_in_same_doc($inner_elem, $outer_elem)
1070 561 21 unless $document->find($class)
1073 0 31 unless my $str = $self->_get_ppix_quotelike($double_quotish)
1077 7 24 unless $str->find("PPIx::QuoteLike::Token::Interpolation")
1079 0 28 unless my $subdoc = $self->_get_derived_ppi_document($interp, $double_quotish)
1100 284 7 unless $document->find($class)
1102 0 9 unless my $pre = $self->_get_ppix_regexp($regex)
1106 0 9 unless $pre->find("PPIx::Regexp::Token::Code")
1131 1 128 if $declaration->{'is_global'}
1133 62 66 if $declaration->{'used'}
1135 3 63 if $declaration->{'is_allowed_computation'}
1138 4 3 if $declaration->{'is_state_in_expression'} and $self->{'_allow_state_in_expression'}
1141 4 55 if $declaration->{'taking_reference'} and not $self->{'_prohibit_reference_only_variables'}
1144 4 51 if $declaration->{'returned_lexical'} and not $self->{'_prohibit_returned_lexicals'}
1147 6 4 if $declaration->{'is_unpacking'} and $self->{'_allow_unused_subroutine_arguments'}
1156 0 23 unless $a->logical_line_number <=> $b->logical_line_number
1183 0 82 unless $inner_elem->top == $outer_elem->top
1190 6 76 if ($outer_elem->scope)
1201 0 76 unless my $stmt = $outer_elem->statement
1206 0 78 unless $last_elem = $last_elem->last_element
1210 0 76 unless my $stmt_loc = $last_elem->location
1213 0 76 unless my $inner_loc = $inner_elem->location
1216 0 76 if $stmt_loc->[0] > $inner_loc->[0]
1218 5 71 if $stmt_loc->[0] == $inner_loc->[0] and $stmt_loc->[1] >= $inner_loc->[1]
1234 0 80 if _inner_is_defined_by_outer($inner_elem, $parent) and _location_is_in_right_hand_side_of_assignment($parent, $inner_elem)
1238 0 80 unless $parent = $parent->parent
1255 43 37 unless $outer_elem->isa("PPI::Statement::Variable") and $inner_elem->isa("PPI::Token::Symbol")
1272 0 6 unless $outer_elem->scope
1274 0 6 unless $inner_elem->descendant_of($outer_elem)
1276 6 0 if ($outer_elem->isa("PPI::Statement::Compound"))
1277 0 6 unless my $first = $outer_elem->schild(0)
1279 6 0 if ({"for", 1, "foreach", 1}->{$first->content})
1282 12 6 unless $next->isa("PPI::Structure::List")
1302 86 28 unless $kid->isa("PPI::Token::Operator") and "=" eq $kid->content
1306 0 28 if $l->[0] > $inner_loc->[0]
1308 0 28 if $l->[0] == $inner_loc->[0] and $l->[1] >= $inner_loc->[1]