Conformance/Snapshot/Tree.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 4 / 6 Podpod 100% 2 / 2 totaltotal 47.5% 19 / 40 CC 6 SCAR 23.9
CC
6
Cov
42%
content
20.0
new
12.0
BEGIN
1.0
CRAP 10.9
« Conformance/Source/Git.pm ↑ Summary Conformance/Check/DataSchema.pm »
1 package Dist::Conformance::Snapshot::Tree 0.006;
2  
3 # ABSTRACT: A snapshot from a tree listing and a callback that fetches one file
4  
5 1 ▶use 5.040;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use re '/aasx';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Mojo::Base 'Dist::Conformance::Snapshot', -signatures;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 1 has 'paths';
12 1 has 'fetch';
13  
14  
15 0 ▶sub new ( $class, @args ) {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
16 0 my $self = $class->SUPER::new(@args);
17 0 ▶ die "paths must be a hash reference of path => blob SHA\n" if ref $self->paths ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->paths ne "HASH" 0 0 0
18 0 ▶ die "fetch must be a code reference\n" if ref $self->fetch ne 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->fetch ne "CODE" 0 0 0
19 0 return $self;
20 }
21  
22  
23 0 ▶sub content ( $self, $path ) {
Subroutine content: not called CC=4 SCAR=30.0
Pod documented
24 0 ▶ return undef if !$self->contains($path);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->contains($path) 0 0 0
25 0 ▶ my $fetched = $self->{fetched} //= {};
Condition0%0/2
$self->{"fetched"} //= {}
l!l
00
MC/DC0%0/1
$self->{"fetched"} //= {}
$self->{"fetched"}
Truth table0%0/2
A
A= $self->{"fetched"}
Aresult
11
00
26 0 ▶ $fetched->{$path} = $self->fetch->($path) if !exists $fetched->{$path};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $fetched->{$path} 0 0 0
27 0 return $fetched->{$path};
28 }
29  
30 __END__
« Conformance/Source/Git.pm ↑ Summary Conformance/Check/DataSchema.pm »