Branch Coverage

blib/lib/Perl/Critic/Utils.pm
Criterion Covered Total %
branch 189 240 78.7


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
758 1235 258 unless $psib
768 0 2142 unless $elem
777 0 1551 unless $elem
787 1633 2073 unless $elem
796 0 1686 unless $elem
798 0 1686 unless $stmnt
799 1686 0 unless $stmnt->isa("PPI::Statement::Package")
807 0 1724 unless $elem
809 1289 435 unless $sib
811 0 435 unless $stmnt
818 0 1653 unless my $elem = shift()
820 73 1580 if is_perl_bareword($elem)
821 0 1580 if is_perl_filehandle($elem)
822 0 1580 if is_package_declaration($elem)
823 4 1576 if is_included_module_name($elem)
824 25 1551 if is_method_call($elem)
825 13 1538 if is_class_name($elem)
826 45 1493 if is_subroutine_name($elem)
827 1 1492 if is_label_pointer($elem)
828 30 1462 if is_hash_key($elem)
843 0 8 if &blessed($doc) and $doc->isa("Perl::Critic::Document")
846 5 3 if shebang_line($doc)
847 1 2 if _is_PL_file($doc)
855 0 3 unless $doc->can("filename")
857 1 0 if $filename =~ /[.] PL \z/msx
867 19 46 if $token->sprevious_sibling
870 46 0 if ($parent)
871 12 34 if $parent->isa("PPI::Structure::List")
872 0 34 if $parent->isa("PPI::Structure::For")
873 4 30 if $parent->isa("PPI::Structure::Condition")
874 4 26 if $parent->isa("PPI::Structure::Constructor")
875 2 24 if $parent->isa("PPI::Structure::Subscript")
878 2 22 if $parent->isa("PPI::Structure::Block") and $token->statement->snext_sibling
883 10 12 if ($grand_parent)
885 2 8 if $parent->isa("PPI::Structure::Block") and not $grand_parent->isa("PPI::Statement::Compound")
897 3102 26403 unless ($policy_name =~ / \A $POLICY_NAMESPACE /msx)
916 6 225 unless $sib
918 15 210 if ($sib->isa("PPI::Structure::List"))
921 6 9 unless $expr
922 9 0 $expr->isa('PPI::Statement') ? :
933 4 441 unless $sib
935 191 250 if ($sib->isa('PPI::Structure::List')) { }
939 2 189 unless @list_contents
943 189 0 if (is_ppi_expression_or_generic_statement($item)) { }
964 177 894 if $iter->isa("PPI::Token::Structure") and $iter eq $SCOLON
965 65 829 if $iter->isa("PPI::Token::Operator") and $MIN_PRECEDENCE_TO_TERMINATE_PARENLESS_ARG_LIST <= precedence_of($iter)
982 547 1133 if ($node->isa('PPI::Token::Operator') and $node eq $COMMA || $node eq $FATCOMMA) { }
25 1108 elsif ($node->isa('PPI::Token::QuoteLike::Words')) { }
986 546 1 if (@node_stacks)
1036 1 19 unless defined $verbosity
1037 2 17 if is_integer($verbosity)
1058 865 6 if is_integer($severity)
1061 1 5 unless (defined $severity_number)
1070 0 865 $s > $SEVERITY_HIGHEST ? :
1071 0 865 $s < $SEVERITY_LOWEST ? :
1090 0 163 if (-d $_ and $SKIP_DIR{$_}) { }
145 18 elsif (-f $_ and not _is_backup($_) and _is_perl($_)) { }
1105 0 145 'File::Spec'->file_name_is_absolute($_) ? :
1115 3 149 if $file =~ / (?: [.] swp | [.] bak | ~ ) \z/msx
1116 1 148 if $file =~ / \A [#] .+ [#] \z/msx
1129 150 15 if $file =~ / [.] (?: PL | p[lm] | psgi | t ) \z/msx
1132 6 9 unless open my $fh, "<", $file
1134 0 9 unless close $fh
1136 6 3 if defined $first and $first =~ / \A [#]!.*perl /msx
1145 0 2797 unless $first_element
1146 2750 47 unless $first_element->isa("PPI::Token::Comment")
1148 0 47 unless $location
1151 0 47 if $location->[0] != 1
1152 0 47 if $location->[1] != 1
1154 20 27 unless $shebang =~ / \A [#]! /msx
1181 2 165 unless is_function_call($elem)
1184 68 97 if (my $sib = $elem->sprevious_sibling)
1185 68 0 if $sib
1189 97 0 if (my $statement = $elem->statement)
1198 589 68 unless $elem->isa("PPI::Token::Operator")
1199 41 27 if $elem ne "or" and $elem ne "||"
1203 27 70 if $statement->find($or_operators)
1206 70 0 if (my $parent = $elem->statement->parent)
1209 4 66 if $parent->isa("PPI::Structure::Condition")
1212 0 66 if $parent->isa("PPI::Structure::Constructor")
1215 6 60 if ($parent->isa("PPI::Structure::List"))
1216 1 5 if (my $uncle = $parent->sprevious_sibling)
1217 1 0 if $uncle
1223 35 30 if _is_fatal($elem, $autodie_modules)
1327 0 65 unless $top->isa("PPI::Document")
1330 20 45 unless $includes
1333 2 47 if "use" ne $include->type
1335 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 14 4 if $arg->[0]->isa("PPI::Token::Quote") and $elem eq $arg->[0]->string
1345 6 0 if $arg->[0]->isa("PPI::Token::Quote") and $elem eq $arg->[0]->string
1348 0 5 unless $autodie_modules
1365 2 17 if ($first_arg and $first_arg->isa("PPI::Token::Number"))
1367 9 10 if (@args) { }
1374 5 5 if $builtins and $$builtins{$elem->content}
1381 10 0 if $builtins and $$builtins{$elem->content}