GitGot/Command/remove.pm

filter: Statementstmt 100% 38 / 38 Branchbran 87.5% 7 / 8 Conditioncond 55.5% 5 / 9 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 10 / 10 Podpod 50.0% 1 / 2 totaltotal 86.1% 62 / 72 CC 9 SCAR 16.4
CC
9
Cov
91%
_execute
9.3
BEGIN
1.0
BEGIN
1.0
CRAP 5.1
« GitGot/Command/tag.pm ↑ Summary GitGot/Command/push.pm »
1 package App::GitGot::Command::remove;
2 16 our $AUTHORITY = 'cpan:GENEHACK';
3 16 $App::GitGot::Command::remove::VERSION = '1.339';
4 # ABSTRACT: remove a managed repository from your config
5 16 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 16 ▶use List::Util qw/ any /;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 16 ▶use App::GitGot -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 16 extends 'App::GitGot::Command';
13 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 45 ▶sub command_names { qw/ remove rm / }
Subroutine command_names: called CC=1 SCAR=0.0
Pod documented
16  
17 3 ▶sub options {
Subroutine options: called CC=1 SCAR=0.0
Pod undocumented
18 3 my( $class , $app ) = @_;
19 return (
20 3 [ 'force' => 'FIXME' ] ,
21 );
22 }
23  
24 3 ▶sub _use_io_page { 0 }
Subroutine _use_io_page: called CC=1 SCAR=0.0
25  
26 3 ▶sub _execute {
Subroutine _execute: called CC=9 SCAR=22.3
27 3 my( $self, $opt, $args ) = @_;
28  
29 3 ▶ unless ( $self->active_repos and @$args or $self->tags) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->active_repos and @$args or $self->tags) 1 2 3
Condition66%4/6
$self->active_repos and @$args or $self->tags
l!l&&r!l&&!r
201
$self->active_repos and @$args
!ll&&!rl&&r
012
MC/DC33%1/3
$self->active_repos and @$args or $self->tags
$self->active_repos @$args $self->tags
Truth table40%2/5
A and B or C
A= $self->active_reposB= @$argsC= $self->tags
ABCresult
11X1
0X11
1011
0X00
1000
30 1 say STDERR "ERROR: You need to select one or more repos to remove";
31 1 exit(1);
32 }
33  
34 2 my @new_repo_list;
35  
36 2 REPO: for my $repo ( $self->all_repos ) {
37 7 my $number = $repo->number;
38  
39 7 ▶ if ( any { $number == $_->number } $self->active_repos ) {
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $number == $_->number; } , $self->active_repos)) 2 5 7
40 2 my $name = $repo->label;
41  
42 2 ▶ if ( $self->opt->force or $self->prompt_yn( "got rm: remove '$name'?" )) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->opt->force or $self->prompt_yn("got rm: remove '${name}'?")) 2 0 2
Condition33%1/3
$self->opt->force or $self->prompt_yn("got rm: remove '${name}'?")
l!l&&r!l&&!r
200
MC/DC0%0/2
$self->opt->force or $self->prompt_yn("got rm: remove '${name}'?")
$self->opt->force $self->prompt_yn("got rm: remove '${name}'?")
Truth table33%1/3
A or B
A= $self->opt->forceB= $self->prompt_yn("got rm: remove '${name}'?")
ABresult
1X1
011
000
43 2 ▶ say "Removed repo '$name'" if $self->verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 1 1 2
44 2 next REPO;
45 }
46 }
47 5 push @new_repo_list , $repo;
48 }
49  
50 2 $self->set_full_repo_list( \@new_repo_list );
51 2 $self->write_config();
52 }
53  
54 16 1;
55  
56 ## FIXME docs
57  
58 __END__
« GitGot/Command/tag.pm ↑ Summary GitGot/Command/push.pm »