blib/lib/Pinto/Action/Stacks.pm

filter: Statementstmt 63.8% 23 / 36 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 50.8% 29 / 57 CC 7 SCAR 34.2
CC
7
Cov
50%
execute
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 30.6
« blib/lib/Pinto/Action/Update.pm ↑ Summary blib/lib/Pinto/Action/Revert.pm »
1 # ABSTRACT: List known stacks in the repository
2  
3 package Pinto::Action::Stacks;
4  
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use MooseX::Types::Moose qw(Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use MooseX::MarkAsMethods ( autoclean => 1 );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use List::Util qw(max);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Pinto::Constants qw(:color);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 #------------------------------------------------------------------------------
15  
16 1 our $VERSION = '0.14'; # VERSION
17  
18 #------------------------------------------------------------------------------
19  
20 1 extends 'Pinto::Action';
21  
22 #------------------------------------------------------------------------------
23  
24 1 has format => (
25 is => 'ro',
26 isa => Str,
27 );
28  
29 #------------------------------------------------------------------------------
30  
31 0 ▶sub execute {
Subroutine execute: not called CC=7 SCAR=40.3
Pod undocumented
32 0 my ($self) = @_;
33  
34 0 my @stacks = sort { $a cmp $b } $self->repo->get_all_stacks;
35  
36 0 ▶ my $max_name = max( map { length( $_->name ) } @stacks ) || 0;
Condition0%0/2
&max(map({length $_->name;} @stacks)) || 0
l!l
00
MC/DC0%0/1
&max(map({length $_->name;} @stacks)) || 0
&max(map({length $_->name;} @stacks))
Truth table0%0/2
A
A= &max(map({length $_->name;} @stacks))
Aresult
11
00
37 0 ▶ my $max_user = max( map { length( $_->head->username ) } @stacks ) || 0;
Condition0%0/2
&max(map({length $_->head->username;} @stacks)) || 0
l!l
00
MC/DC0%0/1
&max(map({length $_->head->username;} @stacks)) || 0
&max(map({length $_->head->username;} @stacks))
Truth table0%0/2
A
A= &max(map({length $_->head->username;} @stacks))
Aresult
11
00
38  
39 0 ▶ my $format = $self->format || "%M%L %-${max_name}k %u %-{$max_user}j %i: %{40}T";
Condition0%0/2
$self->format || "%M%L %-${max_name}k %u %-{$max_user}j %i: %{40}T"
l!l
00
MC/DC0%0/1
$self->format || "%M%L %-${max_name}k %u %-{$max_user}j %i: %{40}T"
$self->format
Truth table0%0/2
A
A= $self->format
Aresult
11
00
40  
41 0 for my $stack (@stacks) {
42 0 my $string = $stack->to_string($format);
43  
44 0 ▶ my $color =
Branch: 2 branches
BranchTrueFalseTotal
$stack->is_default ? : 0 0 0
$stack->is_locked ? : 0 0 0
45 $stack->is_default ? $PINTO_PALETTE_COLOR_0
46 : $stack->is_locked ? $PINTO_PALETTE_COLOR_2
47 : undef;
48  
49 0 $self->show( $string, { color => $color } );
50 }
51  
52 0 return $self->result;
53 }
54  
55 #------------------------------------------------------------------------------
56  
57 1 __PACKAGE__->meta->make_immutable;
58  
59 #------------------------------------------------------------------------------
60  
61 1 1;
62  
63 __END__
« blib/lib/Pinto/Action/Update.pm ↑ Summary blib/lib/Pinto/Action/Revert.pm »