Tangerine/hook/inline.pm

filter: Statementstmt 98.4% 62 / 63 Branchbran 78.5% 11 / 14 Conditioncond 81.8% 9 / 11 MC/DCmcdc 50.0% 3 / 6 Subroutinesub 100% 11 / 11 Podpod 100% 1 / 1 totaltotal 91.5% 97 / 106 CC 12 SCAR 19.7
CC
12
Cov
93%
run
12.3
__ANON__
1.0
BEGIN
1.0
CRAP 7.1
« Tangerine/hook/mooselike.pm ↑ Summary Tangerine/hook/moduleruntime.pm »
1 package Tangerine::hook::inline;
2 15 $Tangerine::hook::inline::VERSION = '0.21';
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 List::Util 1.33 qw(any);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 15 ▶use Tangerine::HookData;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use Tangerine::Occurence;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 15 ▶use Tangerine::Utils qw(stripquotelike $vre);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 my %langmap = (
13 105 (map { $_ => 'ASM' } qw/nasm NASM gasp GASP as AS asm/),
14 30 (map { $_ => 'Awk' } qw/AWK awk/),
15 basic => 'Basic',
16 30 (map { $_ => 'BC' } qw/bc Bc/),
17 60 (map { $_ => 'Befunge' } qw/befunge BEFUNGE bef BEF/),
18 c => 'C',
19 105 (map { $_ => 'CPP' } qw/cpp C++ c++ Cplusplus cplusplus CXX cxx/),
20 GUILE => 'Guile',
21 30 (map { $_ => 'Java' } qw/JAVA java/),
22 lua => 'Lua',
23 MZSCHEME => 'MzScheme',
24 nouse => 'Nouse',
25 octave => 'Octave',
26 30 (map { $_ => 'Pdlpp' } qw/pdlpp PDLPP/),
27 perl => 'Perl',
28 45 (map { $_ => 'Python' } qw/py python PYTHON/),
29 45 (map { $_ => 'Ruby' } qw/rb ruby RUBY/),
30 30 (map { $_ => 'SLang' } qw/sl slang/),
31 30 (map { $_ => 'SMITH' } qw/Smith smith/),
32 30 (map { $_ => 'Tcl' } qw/tcl tk/),
33 15 (map { $_ => 'TT' } qw/tt template/),
34 webchat => 'WebChat',
35 );
36  
37 sub run {
38 132 ▶ my ($self, $s) = @_;
Subroutine run: called CC=12 SCAR=25.1
Pod documented
39 132 ▶ 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 $s->[1] eq "Inline") 10 122 132
Condition100%6/6
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2 and $s->[1] eq "Inline"
!ll&&!rl&&r
596310
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2
!ll&&!rl&&r
55473
MC/DC100%3/3
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 2 and $s->[1] eq "Inline"
&any(sub { $s->[0] eq $_; } , "use", "no") scalar @$s > 2 $s->[1] eq "Inline"
Truth table100%4/4
A and B and C
A= &any(sub { $s->[0] eq $_; } , "use", "no")B= scalar @$s > 2C= $s->[1] eq "Inline"
ABCresult
0XX0
10X0
1100
1111
40 $s->[1] eq 'Inline') {
41 10 my ($version) = $s->[2] =~ $vre;
42 10 ▶ $version //= '';
Condition50%1/2
$version //= ""
l!l
010
MC/DC0%0/1
$version //= ""
$version
Truth table50%1/2
A
A= $version
Aresult
11
00
43 10 ▶ my $voffset = $version ? 3 : 2;
Branch: 1 branch
BranchTrueFalseTotal
$version ? : 0 10 10
44 10 my @args;
45 10 ▶ if (scalar(@$s) > $voffset) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$s > $voffset) 10 0 10
46 10 ▶ return if $s->[$voffset] eq ';';
Branch: 1 branch
BranchTrueFalseTotal
if $s->[$voffset] eq ";" 1 9 10
47 9 @args = @$s;
48 9 @args = @args[($voffset) .. $#args];
49 9 @args = stripquotelike(@args);
50 }
51 9 my @modules;
52 9 ▶ if ($args[0] =~ /config/io) {
Branch: 2 branches
BranchTrueFalseTotal
if ($args[0] =~ /config/io) { } 1 8 9
elsif ($args[0] =~ /with/io) { } 3 5 8
53 return
54 1 } elsif ($args[0] =~ /with/io) {
55 3 shift @args;
56 3 push @modules, @args;
57 } else {
58 5 ▶ push @modules, 'Inline::'.($langmap{$args[0]} // $args[0])
Condition66%2/3
$langmap{$args[0]} // $args[0]
l!l&&r!l&&!r
230
MC/DC0%0/2
$langmap{$args[0]} // $args[0]
$langmap{$args[0]} $args[0]
Truth table66%2/3
A // B
A= $langmap{$args[0]}B= $args[0]
ABresult
1X1
011
000
59 }
60 8 ▶ if (any { $_ eq 'FILTERS' } @args) {
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $_ eq "FILTERS"; } , @args)) 0 8 8
61 0 push @modules, 'Inline::Filters'
62 }
63 return Tangerine::HookData->new(
64 modules => {
65 map {
66 8 ( $_ => Tangerine::Occurence->new() )
67 } @modules,
68 },
69 );
70 }
71 122 return;
72 }
73  
74 15 1;
75  
76 __END__
« Tangerine/hook/mooselike.pm ↑ Summary Tangerine/hook/moduleruntime.pm »