Branch Coverage

blib/lib/URI/PackageURL/Type.pm
Criterion Covered Total %
branch 88 108 81.4


line true false branch
27 0 1626 unless $type
43 7 82 unless -e $path
45 0 82 unless open my $fh, "<", $path
57 1537 89 if defined $CACHE{$purl_type}
60 7 82 unless $content
65 0 82 if $@
78 0 19440 unless $self->definition
80 7942 11498 unless defined $sub_property
89 0 0 unless (shift())->_property("examples")
97 243 1339 unless (shift())->component_definition("qualifiers")
108 0 0 unless (shift())->_property((shift()) . '_definition', "normalization_rules")
131 150 1476 if (grep {$_ eq $components{'type'};} "alpm", "apk", "bitbucket", "composer", "deb", "github", "gitlab", "hex", "npm", "oci", "pypi")
135 1330 296 if (defined $components{'namespace'})
137 126 1204 if (grep {$_ eq $components{'type'};} "alpm", "apk", "bitbucket", "composer", "deb", "github", "gitlab", "golang", "hex", "rpm")
143 997 333 if ($components{'type'} eq "cpan")
150 2 1624 if (defined $components{'qualifiers'}{'checksum'} and ref $components{'qualifiers'}{'checksum'} ne "ARRAY")
157 27 1599 if (/huggingface/)
166 27 1572 if (/mlflow/)
172 0 27 unless $components{'qualifiers'}{'repository_url'}
174 17 10 if ($components{'qualifiers'}{'repository_url'} =~ /azuredatabricks/)
180 21 1551 if (/pypi/)
187 1011 540 if (/cpan/)
188 0 1011 if (defined $components{'qualifiers'}{'author'})
198 1626 0 wantarray ? :
222 0 1626 unless $components{'scheme'} eq "pkg"
225 5 1373 if $qualifier =~ /(\s|\%)/
229 7 1614 if (defined $components{'qualifiers'}{'checksum'} and ref $components{'qualifiers'}{'checksum'} eq "ARRAY")
235 10 0 if (defined $ALGO_LENGTH{$algo}) { }
0 0 elsif (not $checksum =~ /^[0-9a-f]{32,}$/) { }
237 10 0 if (length $checksum != $ALGO_LENGTH{$algo})
241 1 9 unless ($checksum =~ /^[0-9a-f]+$/)
257 1614 7 if (%{$self->definition;})
263 1536 4824 unless $self->component_have_definition($component)
266 9 4815 unless $requirement
270 2 4813 if (defined $components{$component} and $self->component_is_prohibited($component))
274 30 4783 if (not defined $components{$component} and $self->component_is_required($component))
298 242 4440 unless $requirement
302 0 4440 if (defined $components{'qualifiers'}{$key} and $requirement eq "prohibited")
306 1 4439 if (not defined $components{'qualifiers'}{$key} and $requirement eq "required")
315 992 381 unless &first(sub { $key eq $_; } , @known_qualifiers)
325 29 1559 if (/conan/)
326 3 26 if (not $components{'namespace'} and defined $components{'qualifiers'}{'channel'})
332 997 562 if (/cpan/)
335 6 991 if ($ENV{'PURL_LEGACY_CPAN_TYPE'})
337 0 6 if (defined $components{'namespace'} and defined $components{'name'} and $components{'namespace'} =~ /\:/)
341 3 3 if (defined $components{'namespace'} and defined $components{'name'} and $components{'name'} =~ /\:/)
345 0 3 if (not defined $components{'namespace'} and $components{'name'} =~ /\-/)
353 2 989 if ($components{'name'} =~ /\:/)
361 19 543 if (/cran/)
362 3 16 unless defined $components{'version'}
366 23 520 if (/swift/)
369 6 17 unless defined $components{'version'}
371 17 0 if (defined $components{'namespace'})
373 4 13 unless $user_org