Tangerine/hook/moduleruntime.pm

filter: Statementstmt 100% 41 / 41 Branchbran 90.0% 9 / 10 Conditioncond 66.6% 8 / 12 MC/DCmcdc 42.8% 3 / 7 Subroutinesub 100% 12 / 12 Podpod 100% 1 / 1 totaltotal 89.1% 74 / 83 CC 10 SCAR 16.4
CC
10
Cov
92%
run
10.2
__ANON__
1.0
__ANON__
1.0
CRAP 5.2
« Tangerine/hook/xxx.pm ↑ Summary Tangerine/hook/prefixedlist.pm »
1 package Tangerine::hook::moduleruntime;
2 15 $Tangerine::hook::moduleruntime::VERSION = '0.22';
3 15 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 15 ▶use parent 'Tangerine::Hook';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 15 ▶use Tangerine::HookData;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 15 ▶use Tangerine::Occurence;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use Tangerine::Utils qw(any none stripquotelike);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub run {
12 137 ▶ my ($self, $s) = @_;
Subroutine run: called CC=10 SCAR=23.2
Pod documented
13 137 my @routines = qw(require_module use_module use_package_optimistically);
14 137 ▶ if ((any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 1 &&
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 1 and $s->[1] eq "Module::Runtime") 2 135 137
Condition83%5/6
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 1 and $s->[1] eq "Module::Runtime"
!ll&&!rl&&r
58772
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 1
!ll&&!rl&&r
58079
MC/DC66%2/3
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 1 and $s->[1] eq "Module::Runtime"
&any(sub { $s->[0] eq $_; } , "use", "no") scalar @$s > 1 $s->[1] eq "Module::Runtime"
Truth table75%3/4
A and B and C
A= &any(sub { $s->[0] eq $_; } , "use", "no")B= scalar @$s > 1C= $s->[1] eq "Module::Runtime"
ABCresult
0XX0
10X0
1100
1111
15 $s->[1] eq 'Module::Runtime') {
16 2 return Tangerine::HookData->new( hooks => [
17 Tangerine::hook::moduleruntime->new(type => 'runtime') ] );
18 }
19 # NOTE: For the sake of simplicity, we only check for one subroutine
20 # call per statement.
21 135 ▶ if ($self->type eq 'runtime' && any { my $f = $_; any { $_ eq $f } @$s }
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if ($self->type eq "runtime" and &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)) 3 132 135
Condition66%2/3
$self->type eq "runtime" and &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)
!ll&&!rl&&r
13203
MC/DC50%1/2
$self->type eq "runtime" and &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)
$self->type eq "runtime" &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)
Truth table66%2/3
A and B
A= $self->type eq "runtime"B= &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)
ABresult
0X0
100
111
22 @routines) {
23 3 ▶ while (none { $s->[0] eq $_ } @routines) {
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&none(sub { $s->[0] eq $_; } , @routines)) 3 3 6
24 3 shift @$s;
25 }
26 3 ▶ for (my $clip = 0; $clip <= $#$s && $clip < 3; $clip++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($clip <= $s->$#* and $clip < 3) 9 0 9
Condition33%1/3
$clip <= $s->$#* and $clip < 3
!ll&&!rl&&r
009
MC/DC0%0/2
$clip <= $s->$#* and $clip < 3
$clip <= $s->$#* $clip < 3
Truth table33%1/3
A and B
A= $clip <= $s->$#*B= $clip < 3
ABresult
0X0
100
111
27 9 ▶ if (any { $s->[$clip] eq $_ } qw(-> ;)) {
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $s->[$clip] eq $_; } , "->", ";")) 3 6 9
28 3 @$s = @$s[0..$clip-1];
29 last
30 3 }
31 }
32 3 my @args = stripquotelike(@$s[1..$#$s]);
33 3 return Tangerine::HookData->new(
34 modules => {
35 $args[0] => Tangerine::Occurence->new(
36 version => $args[1]
37 ),
38 },
39 );
40 }
41 }
42  
43 15 1;
44  
45 __END__
« Tangerine/hook/xxx.pm ↑ Summary Tangerine/hook/prefixedlist.pm »