Branch Coverage

blib/lib/Perl/Critic/Utils.pm
Criterion Covered Total %
branch 193 246 78.4


line true false branch
339 1 4 unless $nodes_ref
341 3 1 @matches ? :
349 62 3703 if (&blessed($elem) and $elem->isa("PPI::Statement::Sub"))
363 0 415 unless $elem
377 0 1691 unless $elem
408 0 853 unless $elem
420 0 1580 unless $elem
675 0 62 unless $elem
691 0 0 unless $name
700 0 612 unless $elem
701 386 226 ref $elem ? :
708 0 4499 unless $elem
712 586 3913 if $sib and $sib->isa("PPI::Structure::List")
716 0 3913 unless $parent
718 0 3913 unless $grandparent
719 50 3863 if $grandparent->isa("PPI::Structure::Subscript")
723 22 3801 if $sib and $sib->isa("PPI::Token::Operator") and $sib eq "=>"
732 0 1788 unless $elem
734 0 1788 unless $stmnt
735 1662 126 unless $stmnt->isa("PPI::Statement::Include")
743 0 9659 unless defined $value
752 0 1493 unless $elem
755 0 1493 unless $statement
756 1463 30 unless $statement->isa("PPI::Statement::Break")
759 22 8 unless $psib
769 0 2142 unless $elem
778 0 1551 unless $elem
788 1633 2073 unless $elem
797 0 1686 unless $elem
799 0 1686 unless $stmnt
800 1686 0 unless $stmnt->isa("PPI::Statement::Package")
808 0 1724 unless $elem
810 1289 435 unless $sib
812 0 435 unless $stmnt
819 0 1653 unless my $elem = shift()
821 73 1580 if is_perl_bareword($elem)
822 0 1580 if is_perl_filehandle($elem)
823 0 1580 if is_package_declaration($elem)
824 4 1576 if is_included_module_name($elem)
825 25 1551 if is_method_call($elem)
826 13 1538 if is_class_name($elem)
827 45 1493 if is_subroutine_name($elem)
828 1 1492 if is_label_pointer($elem)
829 30 1462 if is_hash_key($elem)
844 0 8 if &blessed($doc) and $doc->isa("Perl::Critic::Document")
847 5 3 if shebang_line($doc)
848 1 2 if _is_PL_file($doc)
856 0 3 unless $doc->can("filename")
858 1 0 if $filename =~ /[.] PL \z/msx
868 19 46 if $token->sprevious_sibling
871 46 0 if ($parent)
872 12 34 if $parent->isa("PPI::Structure::List")
873 0 34 if $parent->isa("PPI::Structure::For")
874 4 30 if $parent->isa("PPI::Structure::Condition")
875 4 26 if $parent->isa("PPI::Structure::Constructor")
876 2 24 if $parent->isa("PPI::Structure::Subscript")
879 2 22 if $parent->isa("PPI::Structure::Block") and $token->statement->snext_sibling
884 10 12 if ($grand_parent)
886 2 8 if $parent->isa("PPI::Structure::Block") and not $grand_parent->isa("PPI::Statement::Compound")
898 3102 26403 unless ($policy_name =~ / \A $POLICY_NAMESPACE /msx)
917 6 225 unless $sib
919 15 210 if ($sib->isa("PPI::Structure::List"))
922 6 9 unless $expr
923 9 0 $expr->isa('PPI::Statement') ? :
934 4 441 unless $sib
936 191 250 if ($sib->isa('PPI::Structure::List')) { }
940 2 189 unless @list_contents
944 189 0 if (is_ppi_expression_or_generic_statement($item)) { }
965 177 894 if $iter->isa("PPI::Token::Structure") and $iter eq $SCOLON
966 65 829 if $iter->isa("PPI::Token::Operator") and $MIN_PRECEDENCE_TO_TERMINATE_PARENLESS_ARG_LIST <= precedence_of($iter)
983 547 1133 if ($node->isa('PPI::Token::Operator') and $node eq $COMMA || $node eq $FATCOMMA) { }
25 1108 elsif ($node->isa('PPI::Token::QuoteLike::Words')) { }
987 546 1 if (@node_stacks)
1037 1 19 unless defined $verbosity
1038 2 17 if is_integer($verbosity)
1059 865 6 if is_integer($severity)
1062 1 5 unless (defined $severity_number)
1071 0 865 $s > $SEVERITY_HIGHEST ? :
1072 0 865 $s < $SEVERITY_LOWEST ? :
1091 0 163 if (-d $_ and $SKIP_DIR{$_}) { }
145 18 elsif (-f $_ and not _is_backup($_) and _is_perl($_)) { }
1106 0 145 'File::Spec'->file_name_is_absolute($_) ? :
1116 3 149 if $file =~ / (?: [.] swp | [.] bak | ~ ) \z/msx
1117 1 148 if $file =~ / \A [#] .+ [#] \z/msx
1130 150 15 if $file =~ / [.] (?: PL | p[lm] | psgi | t ) \z/msx
1133 6 9 unless open my $fh, "<", $file
1135 0 9 unless close $fh
1137 6 3 if defined $first and $first =~ / \A [#]!.*perl /msx
1146 0 2797 unless $first_element
1147 2750 47 unless $first_element->isa("PPI::Token::Comment")
1149 0 47 unless $location
1152 0 47 if $location->[0] != 1
1153 0 47 if $location->[1] != 1
1155 20 27 unless $shebang =~ / \A [#]! /msx
1182 2 165 unless is_function_call($elem)
1185 68 97 if (my $sib = $elem->sprevious_sibling)
1186 68 0 if $sib
1190 97 0 if (my $statement = $elem->statement)
1199 589 68 unless $elem->isa("PPI::Token::Operator")
1200 41 27 if $elem ne "or" and $elem ne "||"
1204 27 70 if $statement->find($or_operators)
1207 70 0 if (my $parent = $elem->statement->parent)
1210 4 66 if $parent->isa("PPI::Structure::Condition")
1213 0 66 if $parent->isa("PPI::Structure::Constructor")
1216 6 60 if ($parent->isa("PPI::Structure::List"))
1217 1 5 if (my $uncle = $parent->sprevious_sibling)
1218 1 0 if $uncle
1224 35 30 if _is_fatal($elem, $autodie_modules)
1328 0 65 unless $top->isa("PPI::Document")
1331 20 45 unless $includes
1334 2 47 if "use" ne $include->type
1336 18 29 if ('Fatal' eq $include->module) { }
6 23 elsif ('Fatal::Exception' eq $include->module) { }
19 4 elsif ($include->pragma eq 'autodie' or &any(sub {
1338 18 0 if $_->[0]->isa("PPI::Token::Quote")
14 4 if &any(sub {
1343 6 0 if $_->[0]->isa("PPI::Token::Quote")
6 0 if &any(sub {
1345 0 5 unless $autodie_modules
1362 2 17 if ($first_arg and $first_arg->isa("PPI::Token::Number"))
1364 9 10 if (@args) { }
1372 5 5 if $builtins and $builtins->{$elem_content}
1379 10 0 if $builtins and $$builtins{$elem->content}