Qless/Utils.pm

filter: Statementstmt 61.1% 11 / 18 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 43.7% 14 / 32 CC 4 SCAR 24.7
CC
4
Cov
44%
fix_empty_array
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 11.9
« Qless/Lua.pm ↑ Summary Qless/Job.pm »
1 package Qless::Utils;
2 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 our @EXPORT_OK = qw(fix_empty_array);
6  
7 # Because of how Lua parses JSON, empty arrays comes through as {}
8 0 ▶sub fix_empty_array {
Subroutine fix_empty_array: not called CC=4 SCAR=30.0
Pod undocumented
9 0 my $val = shift;
10  
11 0 ▶ if (!$val) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($val) 0 0 0
12 0 return [];
13 }
14  
15 0 ▶ if (ref $val eq 'HASH' && !scalar keys %{ $val }) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val eq "HASH" and not scalar keys %{$val;}) 0 0 0
Condition0%0/3
ref $val eq "HASH" and not scalar keys %{$val;}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $val eq "HASH" and not scalar keys %{$val;}
ref $val eq "HASH" not scalar keys %{$val;}
Truth table0%0/3
A and not(B)
A= ref $val eq "HASH"B= not scalar keys %{$val;}
ABresult
0X0
100
111
16 0 return [];
17 }
18  
19 0 return $val;
20 }
21  
22 1 1;
« Qless/Lua.pm ↑ Summary Qless/Job.pm »