BitBucketCli/Command/Projects.pm

filter: Statementstmt 52.9% 18 / 34 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 71.4% 5 / 7 Podpod 100% 2 / 2 totaltotal 39.0% 25 / 64 CC 10 SCAR 42.4
CC
10
Cov
36%
projects
110.0
options
2.0
BEGIN
1.0
CRAP 69.2
« BitBucketCli/Command/PullRequests.pm ↑ Summary BitBucketCli/Command/Repositories.pm »
1 package App::BitBucketCli::Command::Projects;
2  
3 # Created on: 2018-06-07 08:23:20
4 # Create by: Ivan Wills
5 # $Id$
6 # $Revision$, $HeadURL$, $Date$
7 # $Revision$, $Source$, $Date$
8  
9 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Data::Dumper qw/Dumper/;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use English qw/ -no_match_vars /;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 extends 'App::BitBucketCli';
16  
17 1 our $VERSION = 0.009;
18  
19 0 ▶sub options {
Subroutine options: not called CC=1 SCAR=6.9
Pod documented
20 0 return [qw/
21 colors|c=s%
22 force|f!
23 long|l
24 project|p=s
25 regexp|R
26 remote|m=s
27 repository|r=s
28 sleep|s=i
29 /]
30 }
31  
32 0 ▶sub projects {
Subroutine projects: not called CC=10 SCAR=47.0
Pod documented
33 0 my ($self) = @_;
34  
35 my @projects = sort {
36 0 lc $a->name cmp lc $b->name;
37 }
38 $self->core->projects();
39  
40 0 my %len;
41 0 for my $project (@projects) {
42 0 ▶ $len{name} = length $project->name if !$len{name} || $len{name} < length $project->name;
Branch: 1 branch
BranchTrueFalseTotal
if not $len{"name"} or $len{"name"} < length $project->name 0 0 0
Condition0%0/3
not $len{"name"} or $len{"name"} < length $project->name
l!l&&r!l&&!r
000
MC/DC0%0/2
not $len{"name"} or $len{"name"} < length $project->name
not $len{"name"} $len{"name"} < length $project->name
Truth table0%0/3
not(A) or B
A= not $len{"name"}B= $len{"name"} < length $project->name
ABresult
1X1
011
000
43 0 ▶ $len{key} = length $project->key if !$len{key} || $len{key} < length $project->key;
Branch: 1 branch
BranchTrueFalseTotal
if not $len{"key"} or $len{"key"} < length $project->key 0 0 0
Condition0%0/3
not $len{"key"} or $len{"key"} < length $project->key
l!l&&r!l&&!r
000
MC/DC0%0/2
not $len{"key"} or $len{"key"} < length $project->key
not $len{"key"} $len{"key"} < length $project->key
Truth table0%0/3
not(A) or B
A= not $len{"key"}B= $len{"key"} < length $project->key
ABresult
1X1
011
000
44 }
45 0 for my $project (@projects) {
46 0 ▶ if ( $self->opt->long ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->opt->long) { } 0 0 0
47 0 ▶ my $desc = $project->description || '';
Condition0%0/2
$project->description || ''
l!l
00
MC/DC0%0/1
$project->description || ''
$project->description
Truth table0%0/2
A
A= $project->description
Aresult
11
00
48 0 ▶ if ( $desc ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($desc) 0 0 0
49 0 $desc =~ s/^\s+//xms;
50  
51 0 $desc = join "\n" . ' ' x ( $len{name} + $len{key} + 2 ),
52 split /\r?\n/, $desc;
53 }
54  
55 0 printf "%-$len{name}s %-$len{key}s %s\n", $project->name, $project->key, $desc;
56 }
57 else {
58 0 print $project->name . "\n";
59 }
60 }
61 }
62  
63 1 1;
64  
65 __END__
« BitBucketCli/Command/PullRequests.pm ↑ Summary BitBucketCli/Command/Repositories.pm »