Branch Coverage

blib/lib/PLS/Parser/Document.pm
Criterion Covered Total %
branch 99 438 22.6


line true false branch
67 48 3 if (length $args{'uri'}) { }
2 1 elsif (length $args{'path'}) { }
79 1 50 unless length $path and length $uri
88 2 48 unless ref $document eq "PPI::Document"
124 0 0 if $_->lsp_column_number < $column_number
140 0 0 if not builtin::blessed($list) or not $list->isa("PLS::Parser::Element") and $list->type eq "PPI::Structure::List"
150 0 0 unless builtin::blessed($word) and $word->isa("PLS::Parser::Element") and $word->element->isa("PPI::Token::Word")
158 0 0 if (scalar @parts and $parts[-1] ne 'SUPER') { }
168 0 0 if wantarray
185 0 0 if (ref $self->{'index'} ne "PLS::Parser::Index")
193 0 0 if (my($package, $subroutine) = $match->subroutine_package_and_name)
195 0 0 if ($match->cursor_on_package($column_number))
197 0 0 if (ref $self->{'index'} eq 'PLS::Parser::Index') { }
203 0 0 if ref $this_files_package eq "PLS::Parser::Element::Package" and $this_files_package->name eq $package
206 0 0 if ref $external eq "HASH"
210 0 0 if (length $package)
212 0 0 if (ref $self->{'index'} eq 'PLS::Parser::Index') { }
215 0 0 if ref $results eq "ARRAY" and scalar @{$results;}
219 0 0 if (ref $this_files_package eq "PLS::Parser::Element::Package" and $this_files_package->name eq $package)
222 0 0 if builtin::blessed($found) and $found->isa("PLS::Parser::Element")
227 0 0 if ref $external eq "HASH"
230 0 0 if (ref $self->{'index'} eq "PLS::Parser::Index")
233 0 0 if ref $results eq "ARRAY" and scalar @{$results;}
239 0 0 if builtin::blessed($found) and $found->isa("PLS::Parser::Element")
241 0 0 if (my($class, $method) = $match->class_method_package_and_name)
243 0 0 if (ref $self->{'index'} eq 'PLS::Parser::Index') { }
248 0 0 if ref $results eq "ARRAY" and scalar @{$results;}
253 0 0 if builtin::blessed($found) and $found->isa("PLS::Parser::Element")
257 0 0 if ref $external eq "HASH"
259 0 0 if (my $method = $match->method_name)
261 0 0 if (ref $self->{'index'} eq 'PLS::Parser::Index') { }
268 0 0 if builtin::blessed($found) and $found->isa("PLS::Parser::Element")
271 0 0 if (my($package, $import) = $match->package_name($column_number))
273 0 0 if (length $import) { }
275 0 0 if (ref $self->{'index'} eq 'PLS::Parser::Index') { }
282 0 0 if ref $external eq "HASH"
287 0 0 if (ref $self->{'index'} eq 'PLS::Parser::Index') { }
294 0 0 if ref $external eq "HASH"
298 0 0 if (my $variable = $match->variable_name)
305 0 0 if (my $link = $self->pod_link($line_number, $column_number))
311 0 0 if (ref $self->{'index'} eq 'PLS::Parser::Index') { }
314 0 0 if ref $package eq "ARRAY" and scalar @{$package;}
316 0 0 if length $package_name
322 0 0 if ref $external eq "HASH"
325 0 0 if ref $external eq "HASH"
349 0 0 unless $element->isa("PPI::Token::Pod")
350 0 0 if $element->line_number > $line_number
351 0 0 if $element->line_number + scalar($element->lines) < $line_number
356 0 0 unless scalar $find->in($self->{'document'})
358 0 0 unless open my $fh, "<", $self->get_full_text
362 0 0 unless $. == $line_number
385 0 0 if $start > $column_number or $column_number > $end
415 0 0 if (($package, $import) = $element->package_name($column_number))
420 0 0 if (length $import)
422 0 0 if ($import =~ /^[\$\@\%]/) { }
438 0 0 if $ok
440 0 0 if (($package, $subroutine) = $element->class_method_package_and_name)
450 0 0 if $ok
452 0 0 if ($subroutine = $element->method_name)
461 0 0 if $ok
463 0 0 if (($package, $subroutine) = $element->subroutine_package_and_name)
465 0 0 length $package ? :
477 0 0 if $ok
479 0 0 if ($variable = $element->variable_name)
488 0 0 if $ok
490 0 0 if ($element->type eq "PPI::Token::Operator" and $element->content =~ /^-[rwxoRWXOezsfdlpSbctugkTBMAC]$/)
499 0 0 if $ok
511 45 0 if $self->{'one_line'}
517 0 204 unless $element->line_number == $line_number
518 12 192 if $element->column_number > $column_number
519 35 157 if $element->column_number + length($element->content) < $column_number
544 0 0 if ref $package ne "Module::Metadata"
547 0 0 if ref $doc ne "PLS::Parser::Document"
551 0 0 unless $subroutine->name eq $subroutine_name
573 0 0 unless length $package_name
578 0 0 if ref $metadata ne "Module::Metadata"
581 0 0 if ref $document ne "PLS::Parser::Document"
585 0 0 unless $package->name eq $package_name
621 0 0 unless builtin::blessed($cursor)
623 0 0 if ($cursor->isa('PPI::Structure::Block') or $cursor->isa('PPI::Document')) { }
0 0 elsif ($cursor->isa('PPI::Statement::Compound')) { }
627 0 0 if $child == $prev_cursor
628 0 0 unless builtin::blessed($child)
630 0 0 if ($child->isa("PPI::Statement::Variable") and &any(sub {
635 0 0 if ($child->isa("PPI::Statement::Include") and $child->type eq "use" and $child->pragma eq "vars")
639 0 0 if $1 ne $variable
648 0 0 if ($cursor->type eq 'foreach') { }
652 0 0 if $child == $prev_cursor
653 0 0 unless builtin::blessed($child)
655 0 0 if ($child->isa("PPI::Token::Word") and $child =~ /^my|our|local|state$/)
657 0 0 if (builtin::blessed($child->snext_sibling) and $child->snext_sibling->isa("PPI::Token::Symbol") and $child->snext_sibling->symbol eq $variable)
669 0 0 unless builtin::blessed($condition) and $condition->isa("PPI::Structure::Condition")
673 0 0 if $child == $prev_cursor
674 0 0 unless builtin::blessed($child)
676 0 0 if ($child->isa("PPI::Statement::Variable") and &any(sub {
685 0 0 if $cursor == $document
688 0 0 unless builtin::blessed($declaration) and $declaration->isa("PPI::Element")
710 0 3 unless $args{'languageId'} eq "perl"
743 0 0 if ref $file ne "SCALAR"
749 0 0 if (ref $change->{'range'} eq 'HASH') { }
761 0 0 if ($#lines >= $change->{'range'}{'start'}{'line'})
771 0 0 if ($#lines >= $change->{'range'}{'end'}{'line'})
782 0 0 if (length $starting_text)
784 0 0 length $replacement[0] ? :
786 0 0 if (length $ending_text)
788 0 0 if (scalar @replacement) { }
844 0 0 if $_[0]->isa("PPI::Statement::Sub") and not $_[0]->isa("PPI::Statement::Scheduled")
864 0 0 if (ref $element eq 'PPI::Statement::Include') { }
874 0 0 unless $element->isa("PPI::Statement::Include")
875 0 0 unless $element->type eq "use"
889 0 0 if (ref $constructor eq 'PPI::Structure::Constructor') { }
931 0 0 if (builtin::blessed($element) and $element->isa('PPI::Statement::Variable')) { }
968 0 0 if ref $text ne "SCALAR"
969 0 0 if ref $text ne "SCALAR"
981 0 0 unless length $lvalue
986 0 0 unless length $variable
1007 0 0 if ref $text ne "SCALAR"
1008 0 0 if ref $text ne "SCALAR"
1017 0 0 unless length $package
1036 0 0 if ref $text ne "SCALAR"
1037 0 0 if ref $text ne "SCALAR"
1065 0 0 if ref $text ne "SCALAR"
1066 0 0 if ref $text ne "SCALAR"
1081 0 0 unless length $constant
1091 0 0 unless length $constant
1104 0 2 if ref $text ne "SCALAR"
1105 0 2 if ref $text ne "SCALAR"
1116 10 0 if ($use =~ /$identifier_rx/)
1121 4 6 if lc $module eq $module
1140 0 0 unless ref $args{'formatting_options'} eq "HASH"
1144 0 0 if (ref $text ne "SCALAR")
1152 0 0 if (ref $range eq 'HASH') { }
1156 0 0 if $range->{'end'}{'character'} == 0
1190 0 0 if (length $args{'formatting_options'}{'tabSize'})
1192 0 0 $args{'formatting_options'}{'insertSpaces'} ? :
1198 0 0 unless (length $perltidyrc)
1203 0 0 unless length $perltidyrc and -f $perltidyrc and -r $perltidyrc
1212 0 0 if $whole_file and $lines > $range->{'end'}{'line'}
1214 0 0 if $args{'formatting_options'}{'trimTrailingWhitespace'}
1216 0 0 if ($args{'formatting_options'}{'insertFinalNewline'})
1218 0 0 unless $formatted =~ /\n$/
1220 0 0 if ($args{'formatting_options'}{'trimFinalNewlines'})
1230 0 0 if $error == 1 or length $stderr
1279 5 0 if (ref $FILES{$uri} eq 'SCALAR') { }
1286 0 0 unless open my $fh, "<", $file->file
1312 0 50 if ($args{'text'}) { }
50 0 elsif (length $args{'uri'}) { }
1318 45 5 if (ref $FILES{$args{'uri'}} eq 'SCALAR') { }
1328 46 4 if (length $args{'line'})
1331 45 1 if (ref $file eq 'SCALAR') { }
1 0 elsif (open $fh, '<', $file) { }
1338 45 0 if (length $text)
1348 1 0 if (length $text[$args{'line'}])
1357 2 48 unless builtin::blessed($document) and $document->isa("PPI::Document")
1374 0 0 unless $element->isa("PPI::Token::Word")
1375 0 0 unless ref $_->snext_sibling eq "PPI::Token::Operator"
1406 260 23 if $_->lsp_column_number <= $character
1408 99 12 unless $_->type eq "PPI::Token::Word" or $_->type eq "PPI::Token::Label" or $_->type eq "PPI::Token::Symbol" or $_->type eq "PPI::Token::Magic" or $_->type eq "PPI::Token::Quote::Double" or $_->type eq "PPI::Token::Quote::Interpolate" or $_->type eq "PPI::Token::QuoteLike::Regexp" or $_->type eq "PPI::Token::QuoteLike::Command"
1418 31 36 unless &$predicate()
1422 6 36 if (builtin::blessed($element) and $element->isa("PLS::Parser::Element") and $element->type eq "PPI::Token::Operator")
1424 0 0 if (!builtin::blessed($element->element->previous_sibling) || $element->element->previous_sibling->isa('PPI::Token::Whitespace') and not builtin::blessed($element->previous_sibling) && $element->previous_sibling->isa('PLS::Parser::Element') && $element->previous_sibling->element->isa('PPI::Token::Word') && $element->previous_sibling->name eq 'sub' and $element->content eq "-")
1444 13 16 if (builtin::blessed($element) and $element->isa("PLS::Parser::Element") and $element->type eq 'PPI::Token::Quote::Double' || $element->type eq 'PPI::Token::Quote::Interpolate' || $element->type eq 'PPI::Token::QuoteLike::Regexp' || $element->type eq 'PPI::Token::QuoteLike::Command' || $element->element->isa('PPI::Token::Regexp'))
1457 0 21 if $string_start <= 0
1461 2 19 if ($string =~ /^"/) { }
14 5 elsif ($string =~ /^(q[qrx]|[ysm]|tr)(\S)/ or $string =~ m[^()(/)]) { }
1470 2 12 if $delimiter eq "{"
1471 2 12 if $delimiter eq "("
1472 2 12 if $delimiter eq "<"
1473 2 12 if $delimiter eq "["
1475 14 0 if ($string =~ /\Q$end_delimiter\E$/) { }
1487 16 5 if ($string =~ /$var_rx/)
1505 13 16 unless (builtin::blessed($element) and $element->isa("PLS::Parser::Element"))
1509 1 0 if (builtin::blessed($regexp) and $regexp->type eq 'PPI::Token::Regexp::Match' && $regexp->content eq 'm' || $regexp->type eq 'PPI::Token::Regexp::Substitute' && $regexp->content eq 's' || $regexp->type eq 'PPI::Token::Regexp::Transliterate' && ($regexp->content eq 'tr' || $regexp->content eq 'y'))
1520 11 18 unless (builtin::blessed($element) and $element->isa("PLS::Parser::Element"))
1529 1 10 if (builtin::blessed($literal) and $literal->element->content eq 'q') { }
1 9 elsif (builtin::blessed($interpolate) and $interpolate->element->content eq 'qq') { }
1 8 elsif (builtin::blessed($qr) and $qr->element->content eq 'qr') { }
1 7 elsif (builtin::blessed($qw) and $qw->element->content eq 'qw') { }
1 12 elsif (builtin::blessed($qx) and $qx->element->content eq 'qx') { }
1551 6 23 unless (builtin::blessed($element) and $element->isa("PLS::Parser::Element"))
1556 1 5 if (builtin::blessed($cast) and $cast->isa("PLS::Parser::Element"))
1562 5 0 if (not builtin::blessed($element) && $element->isa('PLS::Parser::Element') and builtin::blessed($closest_operator) and $closest_operator->isa("PLS::Parser::Element") and $closest_operator->name eq "->" and $closest_operator->lsp_column_number + length($closest_operator->content) == $character)
1579 2 3 if (builtin::blessed($closest_operator->previous_sibling) and $closest_operator->previous_sibling->isa('PLS::Parser::Element') and $closest_operator->previous_sibling->type eq 'PPI::Token::Word' and not builtin::blessed($closest_operator->previous_sibling->element->previous_sibling) && $closest_operator->previous_sibling->element->previous_sibling->isa('PPI::Token::Operator') && $closest_operator->previous_sibling->element->previous_sibling eq '->') { }
1596 0 23 unless builtin::blessed($element) and $element->isa("PLS::Parser::Element")
1598 4 19 if ($element->type eq "PPI::Token::Magic")
1600 4 0 if ($element->name =~ /^[\$\@\%]/)
1612 1 0 if ($element->type eq "PPI::Token::Symbol" and $element->lsp_column_number == $character and builtin::blessed($element->previous_sibling) and $element->previous_sibling->isa("PLS::Parser::Element"))
1619 19 0 if builtin::blessed($parent) and ref $parent eq "PLS::Parser::Element"
1620 0 9 if $element->type eq "PPI::Token::Word" and builtin::blessed($parent) and $parent->isa("PLS::Parser::Element") and $parent->type eq "PPI::Structure::Subscript"
1623 5 0 if ($element->type eq "PPI::Token::Word" and builtin::blessed($element->previous_sibling) and $element->previous_sibling->isa("PLS::Parser::Element") and $element->previous_sibling->name eq "->")
1631 5 1 if (builtin::blessed($closest_operator) and $closest_operator->isa("PLS::Parser::Element") and $closest_operator->name eq "->" and $element->type eq "PPI::Token::Word" and $element->parent->element == $closest_operator->parent->element)
1649 5 0 if (builtin::blessed($closest_operator->next_sibling) and $closest_operator->next_sibling->isa("PLS::Parser::Element") and $closest_operator->next_sibling->type eq "PPI::Token::Word" and $closest_operator->ppi_line_number == $closest_operator->next_sibling->ppi_line_number)
1662 2 1 if (builtin::blessed($closest_operator->previous_sibling) and $closest_operator->previous_sibling->isa("PLS::Parser::Element") and $closest_operator->previous_sibling->type eq "PPI::Token::Word" and !(builtin::blessed($closest_operator->previous_sibling->previous_sibling) && $closest_operator->previous_sibling->previous_sibling->isa('PLS::Parser::Element')) || $closest_operator->previous_sibling->previous_sibling->name ne '->')
1680 0 1 if (builtin::blessed($closest_operator) and $closest_operator->isa("PLS::Parser::Element") and $closest_operator->name eq "->" and builtin::blessed($closest_operator->previous_sibling) and $closest_operator->previous_sibling->isa("PLS::Parser::Element") and $closest_operator->previous_sibling->element == $element->element)
1697 0 0 if ($element->name eq ":" and builtin::blessed($element->previous_sibling) and $element->previous_sibling->isa("PLS::Parser::Element") and $element->previous_sibling->type eq 'PPI::Token::Word' || $element->previous_sibling->type eq 'PPI::Token::Label' and !(builtin::blessed($element->previous_sibling->previous_sibling) && $element->previous_sibling->previous_sibling->isa('PLS::Parser::Element')) || $element->previous_sibling->previous_sibling->name ne '->')
1718 5 2 if ($element->type eq "PPI::Token::Word" or $element->type eq "PPI::Token::Label" or $element->element->isa("PPI::Token::Quote") or $element->element->isa("PPI::Token::QuoteLike") or $element->element->isa("PPI::Token::Regexp"))
1728 0 14 if builtin::blessed($element->parent) and $element->parent->isa("PLS::Parser::Element") and $element->parent->element->isa("PPI::Statement::Sub")
1751 0 0 if not builtin::blessed($list) && $list->isa('PLS::Parser::Element') or $list->type ne "PPI::Structure::List"
1755 0 0 if $find->start($list->element)
1757 0 0 unless builtin::blessed($expr) and $expr->isa("PPI::Statement::Expression")
1759 0 0 if $_->isa("PPI::Token::Operator")
1761 0 0 unless scalar @commas
1769 0 0 if ($param->column_number <= $character)
1832 0 0 unless $seqno
1833 0 0 if $seqno =~ /E0/
1834 0 0 if $seqno eq 1
1836 0 0 if ($child->isa("PPI::Token::Whitespace"))
1842 0 0 if ($child->pragma eq 'strict' or $child->pragma eq 'warnings') { }
0 0 elsif ($child->pragma eq 'parent' or $child->pragma eq 'base') { }
0 0 elsif ($child->pragma eq 'constant') { }
0 0 elsif (length $child->pragma) { }
1860 0 0 if (Module::CoreList::is_core($child->module) or &any(sub {
1873 0 0 if scalar @special_pragmas
1874 0 0 if scalar @isa_pragmas
1875 0 0 if scalar @pragmas
1876 0 0 if scalar @installed_modules
1877 0 0 if scalar @internal_modules
1878 0 0 if scalar @constant_pragmas
1885 0 0 if (open my $fh, "<", $self->get_full_text)