Branch Coverage

blib/lib/Perl/Critic/Utils.pm
Criterion Covered Total %
branch 146 222 65.7


line true false branch
334 1 4 unless $nodes_ref
336 3 1 @matches ? :
344 17 990 if (builtin::blessed($elem) and $elem->isa("PPI::Statement::Sub"))
401 0 64 unless $elem
667 0 43 unless $elem
698 0 730 unless $elem
702 50 680 if $sib and $sib->isa("PPI::Structure::List")
706 0 680 unless $parent
708 0 680 unless $grandparent
709 5 675 if ($grandparent->isa("PPI::Structure::Subscript"))
712 1 4 if $sib and not $sib->isa('PPI::Token::Operator') && ($sib eq $COMMA || $sib eq $FATCOMMA)
729 0 371 unless $elem
731 0 371 unless $stmnt
732 257 114 unless $stmnt->isa("PPI::Statement::Include")
740 0 1734 unless defined $value
749 0 287 unless $elem
752 0 287 unless $statement
753 273 14 unless $statement->isa("PPI::Statement::Break")
796 0 337 unless $elem
798 0 337 unless $stmnt
799 337 0 unless $stmnt->isa("PPI::Statement::Package")
807 0 357 unless $elem
810 287 70 unless $sib
811 48 22 if $sib ne "sub"
814 0 22 unless $stmnt
821 0 372 unless my $elem = shift()
823 64 308 if is_perl_bareword($elem)
824 0 308 if is_perl_filehandle($elem)
825 0 308 if is_package_declaration($elem)
826 0 308 if is_included_module_name($elem)
827 0 308 if is_method_call($elem)
828 0 308 if is_class_name($elem)
829 21 287 if is_subroutine_name($elem)
830 0 287 if is_label_pointer($elem)
831 0 287 if is_hash_key($elem)
846 0 8 if builtin::blessed($doc) and $doc->isa("Perl::Critic::Document")
849 5 3 if shebang_line($doc)
850 1 2 if _is_PL_file($doc)
858 0 3 unless $doc->can("filename")
860 1 0 if $filename =~ /[.] PL \z/msx
870 0 0 if $token->sprevious_sibling
873 0 0 if ($parent)
874 0 0 if $parent->isa("PPI::Structure::List")
875 0 0 if $parent->isa("PPI::Structure::For")
876 0 0 if $parent->isa("PPI::Structure::Condition")
877 0 0 if $parent->isa("PPI::Structure::Constructor")
878 0 0 if $parent->isa("PPI::Structure::Subscript")
881 0 0 if $parent->isa("PPI::Structure::Block") and $token->statement->snext_sibling
886 0 0 if ($grandparent)
888 0 0 if $parent->isa("PPI::Structure::Block") and not $grandparent->isa("PPI::Statement::Compound")
900 460 26693 unless ($policy_name =~ / \A $POLICY_NAMESPACE /msx)
919 0 15 unless $sib
921 2 13 if ($sib->isa("PPI::Structure::List"))
924 1 1 unless $expr
925 1 0 $expr->isa('PPI::Statement') ? :
936 0 26 unless $sib
938 3 23 if ($sib->isa('PPI::Structure::List')) { }
942 0 3 unless @list_contents
946 3 0 if (is_ppi_expression_or_generic_statement($item)) { }
967 23 35 if $iter->isa("PPI::Token::Structure") and $iter eq $SCOLON
968 0 35 if $iter->isa("PPI::Token::Operator") and $MIN_PRECEDENCE_TO_TERMINATE_PARENLESS_ARG_LIST <= precedence_of($iter)
986 10 40 if ($node->isa('PPI::Token::Operator') and $node_content eq $COMMA || $node_content eq $FATCOMMA) { }
7 33 elsif ($node->isa('PPI::Token::QuoteLike::Words')) { }
990 10 0 if (@node_stacks)
1040 1 19 unless defined $verbosity
1041 2 17 if is_integer($verbosity)
1062 865 6 if is_integer($severity)
1065 1 5 unless (defined $severity_number)
1074 0 865 $s > $SEVERITY_HIGHEST ? :
1075 0 865 $s < $SEVERITY_LOWEST ? :
1094 0 163 if (-d $_ and $SKIP_DIR{$_}) { }
145 18 elsif (-f $_ and not _is_backup($_) and _is_perl($_)) { }
1109 0 145 'File::Spec'->file_name_is_absolute($_) ? :
1119 3 149 if $file =~ / (?: [.] swp | [.] bak | ~ ) \z/msx
1120 1 148 if $file =~ / \A [#] .+ [#] \z/msx
1133 150 15 if $file =~ / [.] (?: PL | p[lm] | psgi | t ) \z/msx
1136 6 9 unless open my $fh, "<", $file
1138 0 9 unless close $fh
1140 6 3 if defined $first and $first =~ / \A [#]!.*perl /msx
1149 0 158 unless $first_element
1150 124 34 unless $first_element->isa("PPI::Token::Comment")
1152 0 34 unless $location
1155 0 34 if $location->[0] != 1
1156 0 34 if $location->[1] != 1
1158 18 16 unless $shebang =~ / \A [#]! /msx
1185 0 17 unless is_function_call($elem)
1188 2 15 if $elem->sprevious_sibling
1190 15 0 if (my $statement = $elem->statement)
1203 1 14 if $statement->find($or_operators)
1205 14 0 if (my $parent = $elem->statement->parent)
1208 0 14 if $parent->isa("PPI::Structure::Condition")
1211 0 14 if $parent->isa("PPI::Structure::Constructor")
1214 6 8 if ($parent->isa("PPI::Structure::List"))
1215 1 5 if (my $uncle = $parent->sprevious_sibling)
1216 1 0 if $uncle
1222 7 6 if _is_fatal($elem, $autodie_modules)
1326 0 13 unless $top->isa("PPI::Document")
1329 3 10 unless $includes
1332 2 12 if "use" ne $include->type
1334 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 {
1336 2 0 if $_->[0]->isa("PPI::Token::Quote")
2 0 if &any(sub {
1341 2 0 if $_->[0]->isa("PPI::Token::Quote")
2 0 if &any(sub {
1343 0 4 unless $autodie_modules
1360 0 4 if ($first_arg and $first_arg->isa("PPI::Token::Number"))
1364 3 1 if (@args) { }
1372 2 2 if $builtins and $builtins->{$elem_content}
1379 1 0 if $builtins and $$builtins{$elem->content}