blib/lib/WWW/Shopify/Liquid/Exception.pm

filter: Statementstmt 65.2% 94 / 144 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 21 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 48.4% 31 / 64 Podpod 0.0% 0 / 6 totaltotal 46.9% 125 / 266 CC 18 SCAR 23.6
CC
18
Cov
51%
new
72.0
line
20.0
column
20.0
CRAP 10.6
« blib/lib/WWW/Shopify/Liquid/Filter.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Filter/DateMath.pm »
1  
2 30 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 30 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package WWW::Shopify::Liquid::Exception;
6 30 ▶use Devel::StackTrace;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 use overload
8 fallback => 1,
9 30 ▶ '""' => sub { return $_[0]->english . ($_[0]->line ? " on line " . $_[0]->line . ", character " . $_[0]->{line}->[1] . ($_[0]->{line}->[3] ? ", file " . $_[0]->{line}->[3] : '') : ''); };
Subroutine BEGIN: called CC=1 SCAR=2.2
Subroutine __ANON__: not called CC=3 SCAR=16.5
Branch: 2 branches
BranchTrueFalseTotal
$_[0]->line ? : 0 0 0
$_[0]{'line'}[3] ? : 0 0 0
10 0 ▶sub line { return $_[0]->{line} ? (ref($_[0]->{line}) && ref($_[0]->{line}) eq "ARRAY" ? $_[0]->{line}->[0] : $_[0]->{line}) : undef; }
Subroutine line: not called CC=4 SCAR=30.0
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
$_[0]{'line'} ? : 0 0 0
ref $_[0]{'line'} && ref $_[0]{'line'} eq 'ARRAY' ? : 0 0 0
Condition0%0/3
ref $_[0]{"line"} and ref $_[0]{"line"} eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
ref $_[0]{"line"} and ref $_[0]{"line"} eq "ARRAY"
ref $_[0]{"line"} ref $_[0]{"line"} eq "ARRAY"
Truth table0%0/3
A and B
A= ref $_[0]{"line"}B= ref $_[0]{"line"} eq "ARRAY"
ABresult
0X0
100
111
11 0 ▶sub column { return $_[0]->{line} && ref($_[0]->{line}) && ref($_[0]->{line}) eq "ARRAY" ? $_[0]->{line}->[1] : undef; }
Subroutine column: not called CC=4 SCAR=30.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{'line'} && ref $_[0]{'line'} && ref $_[0]{'line'} eq 'ARRAY' ? : 0 0 0
Condition0%0/6
$_[0]{"line"} and ref $_[0]{"line"} and ref $_[0]{"line"} eq "ARRAY"
!ll&&!rl&&r
000
$_[0]{"line"} and ref $_[0]{"line"}
!ll&&!rl&&r
000
MC/DC0%0/3
$_[0]{"line"} and ref $_[0]{"line"} and ref $_[0]{"line"} eq "ARRAY"
$_[0]{"line"} ref $_[0]{"line"} ref $_[0]{"line"} eq "ARRAY"
Truth table0%0/4
A and B and C
A= $_[0]{"line"}B= ref $_[0]{"line"}C= ref $_[0]{"line"} eq "ARRAY"
ABCresult
0XX0
10X0
1100
1111
12 0 ▶sub stack { return $_[0]->{stack}; }
Subroutine stack: not called CC=1 SCAR=6.9
Pod undocumented
13 0 ▶sub english { return $_[0]->{error} ? $_[0]->{error} : "Unknown Error"; }
Subroutine english: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
$_[0]{'error'} ? : 0 0 0
14 0 ▶sub error { return $_[0]->{error}; }
Subroutine error: not called CC=1 SCAR=6.9
Pod undocumented
15  
16 30 ▶use Devel::StackTrace;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 30 ▶use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 sub new {
20 0 ▶ my ($package, $line, $message) = @_;
Subroutine new: not called CC=8 SCAR=42.8
Pod undocumented
21 0 my $self = bless {
22 error => $message,
23 stack => Devel::StackTrace->new,
24 }, $package;
25 0 ▶ if (blessed($line)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($line)) 0 0 0
26 0 ▶ if ($line->isa('WWW::Shopify::Liquid::Tag') || $line->isa('WWW::Shopify::Liquid::Token') || $line->isa('WWW::Shopify::Liquid::Operator') || $line->isa('WWW::Shopify::Liquid::Filter')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line->isa("WWW::Shopify::Liquid::Tag") or $line->isa("WWW::Shopify::Liquid::Token") or $line->isa("WWW::Shopify::Liquid::Operator") or $line->isa("WWW::Shopify::Liquid::Filter")) 0 0 0
Condition0%0/9
$line->isa("WWW::Shopify::Liquid::Tag") or $line->isa("WWW::Shopify::Liquid::Token") or $line->isa("WWW::Shopify::Liquid::Operator") or $line->isa("WWW::Shopify::Liquid::Filter")
l!l&&r!l&&!r
000
$line->isa("WWW::Shopify::Liquid::Tag") or $line->isa("WWW::Shopify::Liquid::Token") or $line->isa("WWW::Shopify::Liquid::Operator")
l!l&&r!l&&!r
000
$line->isa("WWW::Shopify::Liquid::Tag") or $line->isa("WWW::Shopify::Liquid::Token")
l!l&&r!l&&!r
000
MC/DC0%0/4
$line->isa("WWW::Shopify::Liquid::Tag") or $line->isa("WWW::Shopify::Liquid::Token") or $line->isa("WWW::Shopify::Liquid::Operator") or $line->isa("WWW::Shopify::Liquid::Filter")
$line->isa("WWW::Shopify::Liquid::Tag") $line->isa("WWW::Shopify::Liquid::Token") $line->isa("WWW::Shopify::Liquid::Operator") $line->isa("WWW::Shopify::Liquid::Filter")
Truth table0%0/5
A or B or C or D
A= $line->isa("WWW::Shopify::Liquid::Tag")B= $line->isa("WWW::Shopify::Liquid::Token")C= $line->isa("WWW::Shopify::Liquid::Operator")D= $line->isa("WWW::Shopify::Liquid::Filter")
ABCDresult
1XXX1
01XX1
001X1
00011
00000
27 0 $self->{token} = $line;
28 0 $line = $line->{line};
29 }
30 }
31 0 ▶ if (defined $line && ref($line) ne "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $line and ref $line ne "ARRAY") 0 0 0
Condition0%0/3
defined $line and ref $line ne "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $line and ref $line ne "ARRAY"
defined $line ref $line ne "ARRAY"
Truth table0%0/3
A and B
A= defined $lineB= ref $line ne "ARRAY"
ABresult
0X0
100
111
32 0 print STDERR $self->stack->as_string . "\n";
33 0 die "Improper exception.";
34 }
35 0 $self->{line} = $line;
36 0 return $self;
37 }
38  
39 package WWW::Shopify::Liquid::Exception::Timeout;
40 30 ▶use base 'WWW::Shopify::Liquid::Exception';
Subroutine BEGIN: called CC=1 SCAR=0.0
41  
42 package WWW::Shopify::Liquid::Exception::Control;
43 30 ▶use base 'WWW::Shopify::Liquid::Exception';
Subroutine BEGIN: called CC=1 SCAR=0.0
44 0 ▶sub english { return "Control exception"; }
Subroutine english: not called CC=1 SCAR=6.9
45  
46 0 ▶sub initial_render { my $self = shift; $self->{initial_render} = \@_ if int(@_) > 0; return $self->{initial_render}; }
Subroutine initial_render: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if int @_ > 0 0 0 0
47  
48 package WWW::Shopify::Liquid::Exception::Control::Continue;
49 30 ▶use base 'WWW::Shopify::Liquid::Exception::Control';
Subroutine BEGIN: called CC=1 SCAR=0.0
50 0 ▶sub english { return "Continue exception"; }
Subroutine english: not called CC=1 SCAR=6.9
51  
52 package WWW::Shopify::Liquid::Exception::Control::Break;
53 30 ▶use base 'WWW::Shopify::Liquid::Exception::Control';
Subroutine BEGIN: called CC=1 SCAR=0.0
54 0 ▶sub english { return "Break exception"; }
Subroutine english: not called CC=1 SCAR=6.9
55  
56 package WWW::Shopify::Liquid::Exception::Lexer;
57 30 ▶use base 'WWW::Shopify::Liquid::Exception';
Subroutine BEGIN: called CC=1 SCAR=0.0
58 0 ▶sub english { return "Lexer exception"; }
Subroutine english: not called CC=1 SCAR=6.9
59  
60 package WWW::Shopify::Liquid::Exception::Lexer::UnbalancedBrace;
61 30 ▶use base 'WWW::Shopify::Liquid::Exception::Lexer';
Subroutine BEGIN: called CC=1 SCAR=0.0
62 0 ▶sub english { return "Unbalanced brace found"; }
Subroutine english: not called CC=1 SCAR=6.9
63  
64 package WWW::Shopify::Liquid::Exception::Lexer::UnbalancedSingleQuote;
65 30 ▶use base 'WWW::Shopify::Liquid::Exception::Lexer';
Subroutine BEGIN: called CC=1 SCAR=0.0
66 0 ▶sub english { return "Unbalanced single quote found"; }
Subroutine english: not called CC=1 SCAR=6.9
67  
68 package WWW::Shopify::Liquid::Exception::Lexer::UnbalancedDoubleQuote;
69 30 ▶use base 'WWW::Shopify::Liquid::Exception::Lexer';
Subroutine BEGIN: called CC=1 SCAR=0.0
70 0 ▶sub english { return "Unbalanced double quote found"; }
Subroutine english: not called CC=1 SCAR=6.9
71  
72 package WWW::Shopify::Liquid::Exception::Lexer::UnbalancedTag;
73 30 ▶use base 'WWW::Shopify::Liquid::Exception::Lexer';
Subroutine BEGIN: called CC=1 SCAR=0.0
74 0 ▶sub english { return "Unbalanced tag found"; }
Subroutine english: not called CC=1 SCAR=6.9
75  
76 package WWW::Shopify::Liquid::Exception::Lexer::UnbalancedOutputTag;
77 30 ▶use base 'WWW::Shopify::Liquid::Exception::Lexer';
Subroutine BEGIN: called CC=1 SCAR=0.0
78 0 ▶sub english { return "Unbalanced output tag found"; }
Subroutine english: not called CC=1 SCAR=6.9
79  
80 package WWW::Shopify::Liquid::Exception::Lexer::UnbalancedLexingHalt;
81 30 ▶use base 'WWW::Shopify::Liquid::Exception::Lexer';
Subroutine BEGIN: called CC=1 SCAR=0.0
82 0 ▶sub english { return "Unbalanced lexing halter found"; }
Subroutine english: not called CC=1 SCAR=6.9
83  
84 package WWW::Shopify::Liquid::Exception::Lexer::InvalidSeparator;
85 30 ▶use base 'WWW::Shopify::Liquid::Exception::Lexer';
Subroutine BEGIN: called CC=1 SCAR=0.0
86 0 ▶sub english { return "Invalid separator during array/hash construction."; }
Subroutine english: not called CC=1 SCAR=6.9
87  
88 package WWW::Shopify::Liquid::Exception::Lexer::Tag;
89 30 ▶use base 'WWW::Shopify::Liquid::Exception::Lexer';
Subroutine BEGIN: called CC=1 SCAR=0.0
90 0 ▶sub english { return "Malformed tag " . $_[0]->{message}; }
Subroutine english: not called CC=1 SCAR=6.9
91  
92  
93 package WWW::Shopify::Liquid::Exception::Parser;
94 30 ▶use base 'WWW::Shopify::Liquid::Exception';
Subroutine BEGIN: called CC=1 SCAR=0.0
95 0 ▶sub english { return "Parser exception"; }
Subroutine english: not called CC=1 SCAR=6.9
96  
97 package WWW::Shopify::Liquid::Exception::Parser::NoClose;
98 30 ▶use base 'WWW::Shopify::Liquid::Exception::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
99 0 ▶sub english { return "Unable to find closing tag for '" . $_[0]->{token}->stringify . "'"; }
Subroutine english: not called CC=1 SCAR=6.9
100  
101 package WWW::Shopify::Liquid::Exception::Parser::Operands;
102 30 ▶use base 'WWW::Shopify::Liquid::Exception::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
103  
104 sub new {
105 0 ▶ my $package = shift;
Subroutine new: not called CC=1 SCAR=6.9
106 0 my $self = $package->SUPER::new(@_);
107 0 my ($token, $op1, $op, $op2) = @_;
108 0 $self->{operands} = [$op1, $op, $op2];
109 0 return $self;
110 }
111  
112 0 ▶sub english { return "All operands inside an expression must be joined by operators, under most conditions."; }
Subroutine english: not called CC=1 SCAR=6.9
113  
114 package WWW::Shopify::Liquid::Exception::Parser::NoOpen;
115 30 ▶use base 'WWW::Shopify::Liquid::Exception::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
116 0 ▶sub english { return "Unable to find opening tag for '" . $_[0]->{token}->stringify . "'"; }
Subroutine english: not called CC=1 SCAR=6.9
117  
118 package WWW::Shopify::Liquid::Exception::Parser::Arguments;
119 30 ▶use base 'WWW::Shopify::Liquid::Exception::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
120 0 ▶sub english { return "Invalid arguments"; }
Subroutine english: not called CC=1 SCAR=6.9
121  
122 package WWW::Shopify::Liquid::Exception::Parser::UnknownTag;
123 30 ▶use base 'WWW::Shopify::Liquid::Exception::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
124 0 ▶sub english { return "Unknown tag '" . $_[0]->{token}->stringify . "'"; }
Subroutine english: not called CC=1 SCAR=6.9
125  
126 package WWW::Shopify::Liquid::Exception::Parser::NakedInnerTag;
127 30 ▶use base 'WWW::Shopify::Liquid::Exception::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
128 0 ▶sub english { return "Inner tag " . $_[0]->{token}->stringify . " found without enclosing statement"; }
Subroutine english: not called CC=1 SCAR=6.9
129  
130 package WWW::Shopify::Liquid::Exception::Parser::UnknownFilter;
131 30 ▶use base 'WWW::Shopify::Liquid::Exception::Parser';
Subroutine BEGIN: called CC=1 SCAR=0.0
132 0 ▶sub english { return "Unknown filter '" . $_[0]->{token}->stringify . "'"; }
Subroutine english: not called CC=1 SCAR=6.9
133  
134 package WWW::Shopify::Liquid::Exception::Optimizer;
135 30 ▶use base 'WWW::Shopify::Liquid::Exception';
Subroutine BEGIN: called CC=1 SCAR=0.0
136 0 ▶sub english { return "Optimizer exception"; }
Subroutine english: not called CC=1 SCAR=6.9
137  
138 package WWW::Shopify::Liquid::Exception::Renderer;
139 30 ▶use base 'WWW::Shopify::Liquid::Exception';
Subroutine BEGIN: called CC=1 SCAR=0.0
140 0 ▶sub english { return "Rendering exception"; }
Subroutine english: not called CC=1 SCAR=6.9
141  
142 package WWW::Shopify::Liquid::Exception::Renderer::Unimplemented;
143 30 ▶use base 'WWW::Shopify::Liquid::Exception::Renderer';
Subroutine BEGIN: called CC=1 SCAR=0.0
144 0 ▶sub english { return "Unimplemented method"; }
Subroutine english: not called CC=1 SCAR=6.9
145  
146 package WWW::Shopify::Liquid::Exception::Renderer::Arguments;
147 30 ▶use base 'WWW::Shopify::Liquid::Exception::Renderer';
Subroutine BEGIN: called CC=1 SCAR=0.0
148 0 ▶sub english { print STDERR $_[0]->stack->as_string; return "Wrong type? Number of arguments."; }
Subroutine english: not called CC=1 SCAR=6.9
149  
150 30 1;
« blib/lib/WWW/Shopify/Liquid/Filter.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Filter/DateMath.pm »