Gitalist/Head.pm

filter: Statementstmt 100% 38 / 38 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 96.2% 51 / 53 CC 3 SCAR 4.7
CC
3
Cov
98%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« Gitalist/Tag.pm ↑ Summary Gitalist/Types.pm »
1 package Git::Gitalist::Head;
2  
3 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 with 'Git::Gitalist::Serializable';
7  
8 3 ▶use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use MooseX::Types::Moose qw/Maybe/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use Git::Gitalist::Types qw/SHA1/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use MooseX::Types::DateTime qw/DateTime/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 ▶use aliased 'DateTime' => 'DT';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 3 has sha1 => ( isa => SHA1,
16 is => 'ro',
17 required => 1,
18 );
19 3 has name => ( isa => NonEmptySimpleStr,
20 is => 'ro',
21 required => 1,
22 );
23 3 has committer => ( isa => NonEmptySimpleStr,
24 is => 'ro',
25 required => 1,
26 );
27 3 has last_change => ( isa => Maybe[DateTime],
28 is => 'ro',
29 required => 1,
30 );
31  
32 4 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
33 4 my $orig = shift;
34 4 my $class = shift;
35  
36 4 ▶ if ( @_ == 1 && ! ref $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and not ref $_[0]) { } 3 1 4
Condition66%2/3
@_ == 1 and not ref $_[0]
!ll&&!rl&&r
103
MC/DC50%1/2
@_ == 1 and not ref $_[0]
@_ == 1 not ref $_[0]
Truth table66%2/3
A and not(B)
A= @_ == 1B= not ref $_[0]
ABresult
0X0
100
111
37 3 my $line = $_[0];
38 # expects $line to match the output from
39 # for-each-ref --format=%(objectname)%00%(refname)%00%(committer)
40 3 my ($sha1, $name, $commitinfo) = split /\0/, $line, 3;
41 3 $name =~ s!^refs/heads/!!;
42  
43 3 my ($committer, $epoch, $tz) =
44 $commitinfo =~ /(.*)\s(\d+)\s+([+-]\d+)$/;
45 3 my $dt = DT->from_epoch(
46 epoch => $epoch,
47 time_zone => $tz,
48 );
49  
50 3 return $class->$orig(
51 sha1 => $sha1,
52 name => $name,
53 committer => $committer,
54 last_change => $dt,
55 );
56 } else {
57 1 return $class->$orig(@_);
58 }
59 3 };
60  
61 3 1;
« Gitalist/Tag.pm ↑ Summary Gitalist/Types.pm »