lib/Reaction/UI/ViewPort/Role/FieldArgs.pm

filter: Statementstmt 29.7% 14 / 47 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 21 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 22.2% 2 / 9 Podpod n/a totaltotal 17.9% 16 / 89 CC 10 SCAR 32.2
CC
10
Cov
20%
_build_computed_field_order
56.0
_build_field_labels
12.0
__ANON__
6.0
CRAP 25.0
« lib/Reaction/UI/ViewPort/Role/Actions.pm ↑ Summary lib/Reaction/UI/ViewPort/Field/TimeRange.pm »
1 package Reaction::UI::ViewPort::Role::FieldArgs;
2  
3 5 ▶use Reaction::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use namespace::clean -except => [ qw(meta) ];
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 5 has field_order => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
7 5 has excluded_fields => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
8 5 has included_fields => ( is => 'ro', isa => 'ArrayRef', lazy_build => 1);
9 5 has computed_field_order => (is => 'ro', isa => 'ArrayRef', lazy_build => 1);
10  
11 has _raw_field_labels => (
12 is => 'rw',
13 isa => 'HashRef',
14 init_arg => 'field_labels',
15 0 ▶ default => sub { {} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
16 5 );
17  
18 5 has field_labels => (
19 is => 'ro',
20 isa => 'HashRef',
21 lazy_build => 1,
22 init_arg => undef,
23 );
24  
25 0 ▶sub _build_field_labels {
Subroutine _build_field_labels: not called CC=3 SCAR=24.8
26 0 my $self = shift;
27 0 my %labels = %{$self->_raw_field_labels};
28 0 for my $field ( @{$self->computed_field_order}) {
29 0 ▶ next if defined $labels{$field};
Branch: 1 branch
BranchTrueFalseTotal
if defined $labels{$field} 0 0 0
30 0 $labels{$field} = join(' ', map{ ucfirst } split('_', $field));
31 }
32 0 return \%labels;
33 }
34  
35 0 ▶sub _build_field_order { [] }
Subroutine _build_field_order: not called CC=1 SCAR=6.9
36  
37 0 ▶sub _build_excluded_fields { [] }
Subroutine _build_excluded_fields: not called CC=1 SCAR=6.9
38  
39 0 ▶sub _build_included_fields { [] }
Subroutine _build_included_fields: not called CC=1 SCAR=6.9
40  
41 #this is a total clusterfuck and it sucks we should just eliminate it and have
42 # the grid members not render ArrayRef or Collection fields
43 0 ▶sub _build_computed_field_order {
Subroutine _build_computed_field_order: not called CC=7 SCAR=40.3
44 0 my ($self) = @_;
45 0 my %excluded = map { $_ => undef } @{ $self->excluded_fields };
46 0 my %included = map { $_ => undef } @{ $self->included_fields };
47 #treat _$field_name as private and exclude fields with no reader
48 my @names = grep { $_ !~ /^_/ && (!%included || exists( $included{$_}) )
49 0 ▶ && !exists($excluded{$_})} map { $_->name }
Condition0%0/9
!($_ =~ /^_/) && (!%included || exists $included{$_}) && !exists $excluded{$_}
!ll&&!rl&&r
000
not $_ =~ /^_/ and !%included || exists $included{$_}
!ll&&!rl&&r
000
not %included or exists $included{$_}
l!l&&r!l&&!r
000
MC/DC0%0/4
!($_ =~ /^_/) && (!%included || exists $included{$_}) && !exists $excluded{$_}
not $_ =~ /^_/ not %included exists $included{$_} !exists $excluded{$_}
Truth table0%0/6
not(A) and not(B) or C && not(D)
A= not $_ =~ /^_/B= not %includedC= exists $included{$_}D= !exists $excluded{$_}
ABCDresult
0XXX0
100X0
11X00
10100
11X11
10111
50 grep {
51 !($_->has_type_constraint &&
52 ($_->type_constraint->is_a_type_of('ArrayRef') ||
53 0 eval {$_->type_constraint->name->isa('Reaction::InterfaceModel::Collection')} ||
54 0 ▶ eval { $_->_isa_metadata->isa('Reaction::InterfaceModel::Collection') }
Condition0%0/9
$_->has_type_constraint && ($_->type_constraint->is_a_type_of('ArrayRef') || eval { do { $_->type_constraint->name->isa('Reaction::InterfaceModel::Collection') } } || eval { do { $_->_isa_metadata->isa('Reaction::InterfaceModel::Collection') } })
!ll&&!rl&&r
000
$_->type_constraint->is_a_type_of("ArrayRef") or eval { do { $_->type_constraint->name->isa("Reaction::InterfaceModel::Collection") } } or eval { do { $_->_isa_metadata->isa("Reaction::InterfaceModel::Collection") } }
l!l&&r!l&&!r
000
$_->type_constraint->is_a_type_of("ArrayRef") or eval { do { $_->type_constraint->name->isa("Reaction::InterfaceModel::Collection") } }
l!l&&r!l&&!r
000
MC/DC0%0/4
$_->has_type_constraint && ($_->type_constraint->is_a_type_of('ArrayRef') || eval { do { $_->type_constraint->name->isa('Reaction::InterfaceModel::Collection') } } || eval { do { $_->_isa_metadata->isa('Reaction::InterfaceModel::Collection') } })
$_->has_type_constraint $_->type_constraint->is_a_type_of("ArrayRef") eval { do { $_->type_constraint->name->isa("Reaction::InterfaceModel::Collection") } } eval { do { $_->_isa_metadata->isa("Reaction::InterfaceModel::Collection") } }
Truth table0%0/5
A && B or C or D
A= $_->has_type_constraintB= $_->type_constraint->is_a_type_of("ArrayRef")C= eval { do { $_->type_constraint->name->isa("Reaction::InterfaceModel::Collection") } }D= eval { do { $_->_isa_metadata->isa("Reaction::InterfaceModel::Collection") } }
ABCDresult
0XXX0
10000
11XX1
101X1
10011
55 )
56 ) }
57 0 grep { defined $_->get_read_method }
58 $self->current_collection->member_type->parameter_attributes;
59  
60 0 return $self->sort_by_spec($self->field_order, \@names);
61 }
62  
63 0 ▶around _build_members => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
64 0 my $orig = shift;
65 0 my $self = shift;
66 0 ▶ $self->member_args->{computed_field_order} ||= $self->computed_field_order;
Condition0%0/3
$self->member_args->{"computed_field_order"} ||= $self->computed_field_order
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->member_args->{"computed_field_order"} ||= $self->computed_field_order
$self->member_args->{"computed_field_order"} $self->computed_field_order
Truth table0%0/3
A ||= B
A= $self->member_args->{"computed_field_order"}B= $self->computed_field_order
ABresult
1X1
011
000
67 0 my $members = $self->$orig(@_);
68  
69 0 return $members;
70 5 };
71  
72 5 1;
73  
74 __END__;
« lib/Reaction/UI/ViewPort/Role/Actions.pm ↑ Summary lib/Reaction/UI/ViewPort/Field/TimeRange.pm »