lib/WWW/Shopify/Liquid/Operator/Regex.pm

filter: Statementstmt 69.5% 16 / 23 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 3 totaltotal 48.8% 21 / 43 CC 4 SCAR 20.9
CC
4
Cov
53%
operate
20.0
symbol
2.0
priority
2.0
CRAP 8.1
« lib/WWW/Shopify/Liquid/Tag/RemoveKey.pm ↑ Summary lib/WWW/Shopify/Liquid/Dialect/Shopify/Filter/Money.pm »
1 #!/usr/bin/perl
2 38 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 38 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5  
6 package WWW::Shopify::Liquid::Operator::Regex;
7 38 ▶use base 'WWW::Shopify::Liquid::Operator';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 0 ▶sub symbol { return '=~'; }
Subroutine symbol: not called CC=1 SCAR=6.9
Pod undocumented
9 0 ▶sub priority { return 5; }
Subroutine priority: not called CC=1 SCAR=6.9
Pod undocumented
10  
11 # Ensures that regexes can't be used maliciously.
12 38 ▶no re 'eval';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 38 ▶use re::engine::RE2 (-strict => 1, -max_mem => (2**24));
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 0 ▶sub operate {
Subroutine operate: not called CC=4 SCAR=30.0
Pod undocumented
16 0 my ($self, $hash, $action, $op1, $op2) = @_;
17 0 ▶ return undef unless defined $op1 && defined $op2;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $op1 and defined $op2 0 0 0
Condition0%0/3
defined $op1 and defined $op2
!ll&&!rl&&r
000
MC/DC0%0/2
defined $op1 and defined $op2
defined $op1 defined $op2
Truth table0%0/3
A and B
A= defined $op1B= defined $op2
ABresult
0X0
100
111
18 0 my @groups = ($op1 =~ m/$op2/);
19 0 ▶ return undef if (int(@groups) == 0);
Branch: 1 branch
BranchTrueFalseTotal
if int @groups == 0 0 0 0
20 0 return \@groups;
21 }
22  
23 38 1;
« lib/WWW/Shopify/Liquid/Tag/RemoveKey.pm ↑ Summary lib/WWW/Shopify/Liquid/Dialect/Shopify/Filter/Money.pm »