lib/Mite/App/Command.pm

filter: Statementstmt 97.0% 33 / 34 Branchbran 100% 6 / 6 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 4 totaltotal 84.1% 53 / 63 CC 6 SCAR 9.8
CC
6
Cov
93%
should_exit_quietly
5.0
command_name
2.1
abstract
2.0
CRAP 2.7
« lib/Mite/Trait/HasConstructor.pm ↑ Summary lib/Mite/Class.pm »
1 24 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 24 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Mite::App::Command;
6 24 ▶use Mite::Miteception -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 24 our $AUTHORITY = 'cpan:TOBYINK';
9 24 our $VERSION = '0.013000';
10  
11 24 has app => (
12 is => ro,
13 isa => Object,
14 required => true,
15 weak_ref => true,
16 handles => [ 'config', 'project', 'kingpin' ],
17 );
18  
19 24 has kingpin_command => (
20 is => lazy,
21 isa => Object,
22 );
23  
24 240 ▶sub command_name {
Subroutine command_name: called CC=2 SCAR=7.4
Pod undocumented
25 240 my $self = shift;
26 240 ▶ my $class = ref($self) || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
24000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
27  
28 240 my ( $part ) = ( $class =~ /::(\w+)$/ );
29  
30 240 return $part;
31 }
32  
33 0 ▶sub abstract {
Subroutine abstract: not called CC=1 SCAR=6.9
Pod undocumented
34 0 return '???';
35 }
36  
37 120 ▶sub BUILD {
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
38 120 my ( $self, $app ) = @_;
39  
40 120 my $name = $self->command_name;
41 120 $self->app->commands->{$name} = $self;
42  
43 120 $self->kingpin_command; # force build
44  
45 120 return;
46 }
47  
48 120 ▶sub _build_kingpin_command {
Subroutine _build_kingpin_command: called CC=1 SCAR=0.0
49 120 my ( $self ) = @_;
50  
51 120 return $self->kingpin->command( $self->command_name, $self->abstract );
52 }
53  
54 14 ▶sub should_exit_quietly {
Subroutine should_exit_quietly: called CC=5 SCAR=16.1
Pod undocumented
55 14 my $self = shift;
56  
57 14 my $config = $self->config;
58  
59 14 ▶ return false
Branch: 1 branch
BranchTrueFalseTotal
unless $self->app->get_flag_value("exit-if-no-mite-dir") 4 10 14
60 unless $self->app->get_flag_value( 'exit-if-no-mite-dir' );
61  
62 10 ▶ return true
Branch: 1 branch
BranchTrueFalseTotal
unless $self->app->get_flag_value("search-mite-dir") or $config->dir_has_mite(".") 5 5 10
Condition100%3/3
$self->app->get_flag_value("search-mite-dir") or $config->dir_has_mite(".")
l!l&&r!l&&!r
145
MC/DC100%2/2
$self->app->get_flag_value("search-mite-dir") or $config->dir_has_mite(".")
$self->app->get_flag_value("search-mite-dir") $config->dir_has_mite(".")
Truth table100%3/3
A or B
A= $self->app->get_flag_value("search-mite-dir")B= $config->dir_has_mite(".")
ABresult
1X1
011
000
63 if !$self->app->get_flag_value( 'search-mite-dir' )
64 && !$config->dir_has_mite(".");
65  
66 5 ▶ return true
Branch: 1 branch
BranchTrueFalseTotal
unless $config->find_mite_dir 1 4 5
67 if !$config->find_mite_dir;
68  
69 4 return false;
70 }
71  
72 24 1;
« lib/Mite/Trait/HasConstructor.pm ↑ Summary lib/Mite/Class.pm »