App/Plugin/Depends/Meta/Class.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 6 / 6 Conditioncond 44.4% 4 / 9 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 79.0% 34 / 43 CC 9 SCAR 20.8
CC
9
Cov
86%
__ANON__
9.5
BEGIN
1.0
BEGIN
1.0
CRAP 8.0
« App/Plugin/ConfigHome/Meta/Class.pm ↑ Summary App/Utils.pm »
1 # ============================================================================
2 package MooseX::App::Plugin::Depends::Meta::Class;
3 # ============================================================================
4  
5 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 8 ▶around 'command_check_attributes' => sub {
Subroutine __ANON__: called CC=9 SCAR=22.5
9 8 my ($orig, $self, $command_meta, $errors, $params) = @_;
10 8 ▶ $command_meta ||= $self;
Condition33%1/3
$command_meta ||= $self
l!l&&r!l&&!r
800
MC/DC0%0/2
$command_meta ||= $self
$command_meta $self
Truth table33%1/3
A ||= B
A= $command_metaB= $self
ABresult
1X1
011
000
11  
12 ATTR:
13 8 foreach my $attribute ( $self->command_usage_attributes($command_meta, 'all') ) {
14 next ATTR
15 30 ▶ unless defined $params->{ $attribute->cmd_name_primary };
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$params{$attribute->cmd_name_primary} 17 13 30
16 next ATTR
17 unless $attribute->can('depends')
18 && ref($attribute->depends) eq 'ARRAY'
19 13 ▶ && scalar @{ $attribute->depends } > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless $attribute->can("depends") and ref $attribute->depends eq "ARRAY" and scalar @{$attribute->depends;} > 0 5 8 13
Condition50%3/6
$attribute->can("depends") and ref $attribute->depends eq "ARRAY" and scalar @{$attribute->depends;} > 0
!ll&&!rl&&r
058
$attribute->can("depends") and ref $attribute->depends eq "ARRAY"
!ll&&!rl&&r
0013
MC/DC33%1/3
$attribute->can("depends") and ref $attribute->depends eq "ARRAY" and scalar @{$attribute->depends;} > 0
$attribute->can("depends") ref $attribute->depends eq "ARRAY" scalar @{$attribute->depends;} > 0
Truth table50%2/4
A and B and C
A= $attribute->can("depends")B= ref $attribute->depends eq "ARRAY"C= scalar @{$attribute->depends;} > 0
ABCresult
0XX0
10X0
1100
1111
20  
21 OPT:
22 8 foreach my $required_option ( @{ $attribute->depends } ) {
23 next OPT
24 8 ▶ if defined $params->{$required_option};
Branch: 1 branch
BranchTrueFalseTotal
if defined $params->{$required_option} 4 4 8
25  
26 4 my $error_msg = "Option "
27 . "'" . $attribute->cmd_name_primary . "'"
28 . " requires '$required_option' to be defined";
29  
30 4 push @$errors,
31 $self->command_message(
32 header => $error_msg,
33 type => 'error',
34 );
35 }
36 }
37  
38 8 return $self->$orig($command_meta, $errors, $params);
39 3 };
40  
41 3 1;
« App/Plugin/ConfigHome/Meta/Class.pm ↑ Summary App/Utils.pm »