Tangerine/hook/list.pm

filter: Statementstmt 100% 64 / 64 Branchbran 92.3% 24 / 26 Conditioncond 92.8% 13 / 14 MC/DCmcdc 87.5% 7 / 8 Subroutinesub 100% 13 / 13 Podpod 100% 1 / 1 totaltotal 96.8% 122 / 126 CC 20 SCAR 25.6
CC
20
Cov
97%
run
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 12.9
« Tangerine/hook/if.pm ↑ Summary Tangerine/hook/testrequires.pm »
1 package Tangerine::hook::list;
2 16 $Tangerine::hook::list::VERSION = '0.23';
3 16 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 ▶use parent 'Tangerine::Hook';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 16 ▶use Tangerine::HookData;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 16 ▶use Tangerine::Occurence;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use Tangerine::Utils qw(any stripquotelike $vre);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 142 ▶sub run {
Subroutine run: called CC=20 SCAR=30.0
Pod documented
12 142 my ($self, $s) = @_;
13 142 ▶ if ((any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 2 &&
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2 and &any(sub { $s->[1] eq $_; } , "aliased", "base", "mixin", "mixin::with", "Mojo::Base", "ok", "parent", "superclass", "Test::Class::Most")) 17 125 142
Condition100%6/6
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2 and &any(sub { $s->[1] eq $_; } , "aliased", "base", "mixin", "mixin::with", "Mojo::Base", "ok", "parent", "superclass", "Test::Class::Most")
!ll&&!rl&&r
616417
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2
!ll&&!rl&&r
57481
MC/DC100%3/3
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2 and &any(sub { $s->[1] eq $_; } , "aliased", "base", "mixin", "mixin::with", "Mojo::Base", "ok", "parent", "superclass", "Test::Class::Most")
&any(sub { $s->[0] eq $_; } , "use", "no") scalar @$s > 2 &any(sub { $s->[1] eq $_; } , "aliased", "base", "mixin", "mixin::with", "Mojo::Base", "ok", "parent", "superclass", "Test::Class::Most")
Truth table100%4/4
A and B and C
A= &any(sub { $s->[0] eq $_; } , "use", "no")B= scalar @$s > 2C= &any(sub { $s->[1] eq $_; } , "aliased", "base", "mixin", "mixin::with", "Mojo::Base", "ok", "parent", "superclass", "Test::Class::Most")
ABCresult
0XX0
10X0
1100
1111
14 657 ▶ (any { $s->[1] eq $_ }
Subroutine __ANON__: called CC=1 SCAR=0.0
15 qw(aliased base mixin mixin::with Mojo::Base ok parent superclass
16 Test::Class::Most))) {
17 17 my ($version) = $s->[2] =~ $vre;
18 17 ▶ $version //= '';
Condition50%1/2
$version //= ""
l!l
017
MC/DC0%0/1
$version //= ""
$version
Truth table50%1/2
A
A= $version
Aresult
11
00
19 17 ▶ my $voffset = $version ? 3 : 2;
Branch: 1 branch
BranchTrueFalseTotal
$version ? : 0 17 17
20 17 my @args;
21 17 ▶ if (scalar(@$s) > $voffset) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$s > $voffset) 17 0 17
22 17 ▶ return if $s->[$voffset] eq ';';
Branch: 1 branch
BranchTrueFalseTotal
if $s->[$voffset] eq ";" 1 16 17
23 16 @args = @$s;
24 16 @args = @args[($voffset) .. $#args];
25 16 @args = stripquotelike(@args);
26 10 @args = grep { !/^-norequire$/ } @args
27 16 ▶ if any { $s->[1] eq $_ } qw/parent superclass/;
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if &any(sub { $s->[1] eq $_; } , "parent", "superclass") 3 13 16
28 16 ▶ @args = grep { !/^-(base|strict)$/ } @args
Branch: 1 branch
BranchTrueFalseTotal
if $s->[1] eq "Mojo::Base" 3 13 16
29 if $s->[1] eq 'Mojo::Base';
30 }
31 @args = $args[0]
32 59 ▶ if $args[0] && any { $s->[1] eq $_ }
Subroutine __ANON__: called CC=1 SCAR=0.0
33 16 ▶ qw/aliased mixin mixin::with Mojo::Base ok/;
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] and &any(sub { $s->[1] eq $_; } , "aliased", "mixin", "mixin::with", "Mojo::Base", "ok") 6 10 16
Condition100%3/3
$args[0] and &any(sub { $s->[1] eq $_; } , "aliased", "mixin", "mixin::with", "Mojo::Base", "ok")
!ll&&!rl&&r
286
MC/DC100%2/2
$args[0] and &any(sub { $s->[1] eq $_; } , "aliased", "mixin", "mixin::with", "Mojo::Base", "ok")
$args[0] &any(sub { $s->[1] eq $_; } , "aliased", "mixin", "mixin::with", "Mojo::Base", "ok")
Truth table100%3/3
A and B
A= $args[0]B= &any(sub { $s->[1] eq $_; } , "aliased", "mixin", "mixin::with", "Mojo::Base", "ok")
ABresult
0X0
100
111
34 16 ▶ if ($s->[1] eq 'Test::Class::Most') {
Branch: 1 branch
BranchTrueFalseTotal
if ($s->[1] eq "Test::Class::Most") 2 14 16
35 2 my $tcmparent;
36 my @results;
37 2 for my $arg (@args) {
38 13 ▶ if ($tcmparent) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tcmparent) { } 5 8 13
39 5 ▶ if (any { $arg eq $_ } qw/attributes is_abstract/) {
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $arg eq $_; } , "attributes", "is_abstract")) 1 4 5
40 1 undef $tcmparent;
41 next
42 1 }
43 4 push @results, $arg
44 } else {
45 8 ▶ if ($arg eq 'parent') {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg eq "parent") 3 5 8
46 3 $tcmparent++;
47 undef @results
48 3 }
49 }
50 }
51 @args = @results
52 2 }
53 16 my %found;
54 16 ▶ for (my $i = 0; $i < scalar(@args); $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @args) 18 16 34
55 18 $found{$args[$i]} = '';
56 18 ▶ if ($args[$i+1] && $args[$i+1] =~ /^v?\d+(?:\.\d+)*$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[$i + 1] and $args[$i + 1] =~ /^v?\d+(?:\.\d+)*$/) 1 17 18
Condition100%3/3
$args[$i + 1] and $args[$i + 1] =~ /^v?\d+(?:\.\d+)*$/
!ll&&!rl&&r
1341
MC/DC100%2/2
$args[$i + 1] and $args[$i + 1] =~ /^v?\d+(?:\.\d+)*$/
$args[$i + 1] $args[$i + 1] =~ /^v?\d+(?:\.\d+)*$/
Truth table100%3/3
A and B
A= $args[$i + 1]B= $args[$i + 1] =~ /^v?\d+(?:\.\d+)*$/
ABresult
0X0
100
111
57 1 $found{$args[$i]} = $args[$i+1];
58 1 $i++
59 }
60 }
61 return Tangerine::HookData->new(
62 modules => {
63 map {
64 16 ( $_ => Tangerine::Occurence->new(version => $found{$_}) )
65 } keys %found,
66 },
67 );
68 }
69 125 return;
70 }
71  
72 16 1;
73  
74 __END__
« Tangerine/hook/if.pm ↑ Summary Tangerine/hook/testrequires.pm »