Branch Coverage

blib/lib/App/perlimports/Document.pm
Criterion Covered Total %
branch 103 140 73.5


line true false branch
324 1 1762 if $_[1]->isa("PPI::Statement::Package")
326 31 1 if (not $pkgs or $pkgs->[0]->namespace eq "main")
338 0 1 unless $notional_file eq $provided_file
397 13 408 if $self->is_sub_name("$word")
401 4 404 if not $isa_symbol and is_method_call($word)
404 6 398 if (not $isa_symbol || $word->statement && $word->statement->isa('PPI::Statement::Variable') and is_hash_key($word))
462 62 2 unless exists $imports{$pkg}
470 29 35 if ($found_for_include)
471 2 27 if ($imports{$pkg}) { }
492 31 1 unless @{$sub_ex;}
498 1 2 if ($arg->isa("PPI::Structure::Constructor"))
501 1 0 if (XXX)
502 1 0 if (XXX)
519 14 388 if ($child->isa("PPI::Structure::List") and not defined $imports)
523 351 8 unless ($child->isa("PPI::Token::QuoteLike::Words") or $child->isa("PPI::Token::Quote::Single"))
527 4 47 if (defined $imports) { }
539 0 15 unless defined $snippet
546 1 14 unless defined $doc
549 8 6 unless $doc->find("PPI::Token::Symbol")
557 2 3 if $cast eq "\\"
563 2 1 unless $cast_as_doc->find("PPI::Token::Symbol")
568 1 2 if ($words and scalar @$words == 1 and $full_cast =~ /([\$\@\%])\{$words->[0]}/)
577 2 1 if is_function_call($word)
589 3 9 if (not $token->isa("PPI::Token::Quote") or $token->isa("PPI::Token::Quote::Single"))
597 1 8 unless $doc
600 5 3 unless $quotes
618 1791 0 unless $_[1]->isa("PPI::Token::Quote") and not $_[1]->isa("PPI::Token::Quote::Single") or $_[1]->isa("PPI::Token::Quote::Interpolate") or $_[1]->isa("PPI::Token::QuoteLike::Regexp")
625 25 8 unless $self->ppi_document->find(sub {
628 1 8 if ($token->isa("PPI::Token::Regexp") or $token->isa("PPI::Token::QuoteLike::Regexp"))
649 31 2 unless $self->ppi_document->find(sub {
653 1 2 if $heredoc =~ /'/
663 31 2 unless $self->ppi_document->find(sub {
666 0 2 unless ($cast->snext_sibling and $cast->snext_sibling->isa("PPI::Structure::Block"))
673 2 0 if ($sibling =~ /{(\w+)}/)
701 0 36 if ($self->_has_never_export_modules)
719 26 8 unless $self->ppi_document->find(sub {
723 11 0 if ($children[0] eq "sub" and $children[1]->isa("PPI::Token::Word"))
748 1 53 if (exists $self->original_imports->{$module_name} and &any(sub {
750 28 26 unless $self->original_imports->{$module_name}
769 2429 1 unless $_[1]->isa("PPI::Token::Word") and $_[1]->content =~ /\A$module_name::[a-zA-Z0-9_]*\z/ || $_[1]->content eq $module_name && $_[1]->snext_sibling eq '->'
779 9 4 if $self->ppi_document->find(sub {
785 1 0 if $key =~ /\A[*\$\@\%]+$module_name::[a-zA-Z0-9_]+\z/
788 0 0 if $key =~ /\A$module_name::[a-zA-Z0-9_]+\z/
816 0 196 if $module eq "Exporter"
818 130 66 if ($self->_has_inspector_for($module))
822 0 66 if ($self->_cache)
827 0 0 if (-e $file)
835 0 0 if ($inspector)
881 1 41 if (not $self->_preserve_duplicates and exists $processed{$include->module})
884 0 1 if ($self->lint)
923 0 41 unless $elem
927 15 26 unless ($self->_preserve_unused)
930 2 12 if ($args[0] and $args[0] eq "()" and not $self->_is_used_fully_qualified($include->module))
934 0 2 if ($self->lint)
955 1 38 if (my $err = App::perlimports::Sandbox::eval_pkg($elem->module, "$elem"))
968 0 38 if (not $inserted) { }
974 2 36 if ($self->lint)
979 2 0 if ($before ne $after)
997 0 36 if (not $doc) { }
1017 1 41 $self->lint ? :
1031 0 2 if ($self->json) { }
1037 0 0 if ($lines[0] =~ /[^\s]/)
1060 0 2 if $after_deleted
1070 0 2 if ($self->json) { }
1084 0 2 unless ($next->isa("PPI::Token::Whitespace") or $next->isa("PPI::Token::Comment"))
1089 3 4 if $next eq "\n"
1098 0 0 defined $ENV{'HOME'} && -d path($ENV{'HOME'}, '.cache') ? :
1116 42 0 unless $self->_cache
1120 0 0 unless @names
1129 0 0 if -e $file