Tangerine/hook/inline.pm

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