Branch Coverage

blib/lib/Perl/Critic/Utils.pm
Criterion Covered Total %
branch 144 220 65.4


line true false branch
339 1 4 unless $nodes_ref
341 3 1 @matches ? :
349 17 965 if (&blessed($elem) and $elem->isa("PPI::Statement::Sub"))
406 0 64 unless $elem
672 0 41 unless $elem
703 0 710 unless $elem
707 47 663 if $sib and $sib->isa("PPI::Structure::List")
711 0 663 unless $parent
713 0 663 unless $grandparent
714 2 661 if $grandparent->isa("PPI::Structure::Subscript")
728 0 362 unless $elem
730 0 362 unless $stmnt
731 248 114 unless $stmnt->isa("PPI::Statement::Include")
739 0 1731 unless defined $value
748 0 279 unless $elem
751 0 279 unless $statement
752 265 14 unless $statement->isa("PPI::Statement::Break")
795 0 329 unless $elem
797 0 329 unless $stmnt
798 329 0 unless $stmnt->isa("PPI::Statement::Package")
806 0 349 unless $elem
809 280 69 unless $sib
810 47 22 if $sib ne "sub"
813 0 22 unless $stmnt
820 0 364 unless my $elem = shift()
822 64 300 if is_perl_bareword($elem)
823 0 300 if is_perl_filehandle($elem)
824 0 300 if is_package_declaration($elem)
825 0 300 if is_included_module_name($elem)
826 0 300 if is_method_call($elem)
827 0 300 if is_class_name($elem)
828 21 279 if is_subroutine_name($elem)
829 0 279 if is_label_pointer($elem)
830 0 279 if is_hash_key($elem)
845 0 8 if &blessed($doc) and $doc->isa("Perl::Critic::Document")
848 5 3 if shebang_line($doc)
849 1 2 if _is_PL_file($doc)
857 0 3 unless $doc->can("filename")
859 1 0 if $filename =~ /[.] PL \z/msx
869 0 0 if $token->sprevious_sibling
872 0 0 if ($parent)
873 0 0 if $parent->isa("PPI::Structure::List")
874 0 0 if $parent->isa("PPI::Structure::For")
875 0 0 if $parent->isa("PPI::Structure::Condition")
876 0 0 if $parent->isa("PPI::Structure::Constructor")
877 0 0 if $parent->isa("PPI::Structure::Subscript")
880 0 0 if $parent->isa("PPI::Structure::Block") and $token->statement->snext_sibling
885 0 0 if ($grand_parent)
887 0 0 if $parent->isa("PPI::Structure::Block") and not $grand_parent->isa("PPI::Statement::Compound")
899 460 26403 unless ($policy_name =~ / \A $POLICY_NAMESPACE /msx)
918 0 15 unless $sib
920 2 13 if ($sib->isa("PPI::Structure::List"))
923 1 1 unless $expr
924 1 0 $expr->isa('PPI::Statement') ? :
935 0 23 unless $sib
937 3 20 if ($sib->isa('PPI::Structure::List')) { }
941 0 3 unless @list_contents
945 3 0 if (is_ppi_expression_or_generic_statement($item)) { }
966 20 27 if $iter->isa("PPI::Token::Structure") and $iter eq $SCOLON
967 0 27 if $iter->isa("PPI::Token::Operator") and $MIN_PRECEDENCE_TO_TERMINATE_PARENLESS_ARG_LIST <= precedence_of($iter)
985 8 34 if ($node->isa('PPI::Token::Operator') and $node_content eq $COMMA || $node_content eq $FATCOMMA) { }
7 27 elsif ($node->isa('PPI::Token::QuoteLike::Words')) { }
989 8 0 if (@node_stacks)
1039 1 19 unless defined $verbosity
1040 2 17 if is_integer($verbosity)
1061 865 6 if is_integer($severity)
1064 1 5 unless (defined $severity_number)
1073 0 865 $s > $SEVERITY_HIGHEST ? :
1074 0 865 $s < $SEVERITY_LOWEST ? :
1093 0 163 if (-d $_ and $SKIP_DIR{$_}) { }
145 18 elsif (-f $_ and not _is_backup($_) and _is_perl($_)) { }
1108 0 145 'File::Spec'->file_name_is_absolute($_) ? :
1118 3 149 if $file =~ / (?: [.] swp | [.] bak | ~ ) \z/msx
1119 1 148 if $file =~ / \A [#] .+ [#] \z/msx
1132 150 15 if $file =~ / [.] (?: PL | p[lm] | psgi | t ) \z/msx
1135 6 9 unless open my $fh, "<", $file
1137 0 9 unless close $fh
1139 6 3 if defined $first and $first =~ / \A [#]!.*perl /msx
1148 0 157 unless $first_element
1149 123 34 unless $first_element->isa("PPI::Token::Comment")
1151 0 34 unless $location
1154 0 34 if $location->[0] != 1
1155 0 34 if $location->[1] != 1
1157 18 16 unless $shebang =~ / \A [#]! /msx
1184 0 16 unless is_function_call($elem)
1187 2 14 if $elem->sprevious_sibling
1189 14 0 if (my $statement = $elem->statement)
1202 1 13 if $statement->find($or_operators)
1204 13 0 if (my $parent = $elem->statement->parent)
1207 0 13 if $parent->isa("PPI::Structure::Condition")
1210 0 13 if $parent->isa("PPI::Structure::Constructor")
1213 6 7 if ($parent->isa("PPI::Structure::List"))
1214 1 5 if (my $uncle = $parent->sprevious_sibling)
1215 1 0 if $uncle
1221 7 5 if _is_fatal($elem, $autodie_modules)
1325 0 12 unless $top->isa("PPI::Document")
1328 2 10 unless $includes
1331 2 12 if "use" ne $include->type
1333 2 10 if ('Fatal' eq $include->module) { }
2 8 elsif ('Fatal::Exception' eq $include->module) { }
4 4 elsif ($include->pragma eq 'autodie' or &any(sub {
1335 2 0 if $_->[0]->isa("PPI::Token::Quote")
2 0 if &any(sub {
1340 2 0 if $_->[0]->isa("PPI::Token::Quote")
2 0 if &any(sub {
1342 0 4 unless $autodie_modules
1359 0 4 if ($first_arg and $first_arg->isa("PPI::Token::Number"))
1363 3 1 if (@args) { }
1371 2 2 if $builtins and $builtins->{$elem_content}
1378 1 0 if $builtins and $$builtins{$elem->content}