Branch Coverage

blib/lib/License/Syntax.pm
Criterion Covered Total %
branch 160 218 73.3


line true false branch
78 2 4 if (1 == scalar @_ and not ref $_[0]) { }
84 2 2 ref $_[0] eq 'HASH' ? :
92 0 6 if ($$self{'new'}{'map'})
100 3 3 if $$self{'new'}{'licensemap'}
112 2 1 if $f =~ s/;([\w,;\#\(\)]+)$//
113 1 2 if $f =~ /\.csv$/i
115 0 2 unless $f =~ /\.sql(ite)?$/i
119 2 0 if $suf =~ /^(\w+)/
120 2 0 if $suf =~ /\((\w+)\W(\w+)/
135 772 1608 if ($v eq $k) { }
148 732 40 if $done{$k}
180 0 2 unless open O, '>', $f
182 2 0 unless defined $header_suffix
183 2 0 unless $header_suffix =~ /\n$/s
191 0 2 unless close O
264 0 0 unless $cc
279 130 1353 if defined $from and $from eq $to
283 1472 11 if defined $from
285 856 627 if (defined(my $nn = $$s{'licensemap'}{'ex'}{$to}))
289 0 856 if defined $from and $from eq $nn
293 0 856 if $$s{'debug'}
297 1322 161 if (defined $from and $from ne '')
300 44 1278 if (defined($aa = $$s{'licensemap'}{'ex'}{$from}))
302 1 43 if ($aa eq $from) { }
307 0 1 if $$s{'debug'}
314 1 42 if $$s{'debug'}
320 138 1141 if (scalar(my(@a) = _tokenize_linear($from)) > 1)
327 156 1284 if (scalar(my(@a) = _tokenize_linear($to)) > 1)
354 0 1 unless my $dbh = 'DBI'->connect("dbi:SQLite:dbname=$f", '', '')
356 1 0 if $$s{'new'}{'nofsync'}
358 1 0 if $trunc_flag
379 0 2 unless my $dbh = 'DBI'->connect("dbi:SQLite:dbname=$f", '', '')
426 0 6 unless $text =~ /\w\w/
440 14 78 if (my $m = $$s{'licensemap'}{'tok'}{lc $a[$i]})
447 62 22 if ($a[$i + $j] ne $$m{$k}[$j])
454 0 62 if ($match)
463 6 86 if $a[$i] eq '&'
464 4 88 if $a[$i] eq '|'
469 2 4 if $disambiguate
471 2 4 if $disambiguate
489 14 118 if $a =~ /\(/
490 14 118 if $a =~ /\)/ and $in_parens
491 34 98 if $a =~ /\w/ and not $in_parens
493 0 132 if $$s{'debug'}
497 36 96 if ($a =~ /^(;|\||&|\bor\b|\band\b|<<|)$/i and not $in_parens)
499 0 36 if $$s{'debug'}
500 30 6 if (scalar @$arr)
502 26 4 if ($in_word) { }
507 4 48 if /^(;|\||&|\bor\b|\band\b)$/
513 0 4 unless ($$arr[0] eq '(' and $$arr[-1] eq ')')
517 0 0 if $$s{'debug'}
519 4 0 if $$arr[0] eq '('
520 4 0 if $$arr[-1] eq ')'
521 0 4 if $$s{'debug'}
528 96 36 if ($in_word or $in_parens or $a eq ')') { }
530 0 96 if $$s{'debug'}
531 0 14 if ($a eq ')' and not $in_parens and not @$arr)
535 0 0 if $$s{'debug'}
537 90 6 if length $a
541 0 36 if $$s{'debug'}
542 20 16 if length $a
546 0 10 if ($in_parens)
550 0 0 if $$s{'debug'}
554 4 6 if ($$s{'disambiguate'})
566 0 4 if ($$s{'debug'})
585 8 28 if (defined $a[$i] and $a[$i] eq $tok)
618 12 14 unless defined $new
619 16 10 if defined $new
622 26 0 if $name =~ /^\s*(.*?)\s*(\((.*)\))?\s*$/
623 26 0 unless $name eq 'REJECT'
631 8 18 unless defined $new
632 18 8 if defined $new
642 8 18 unless $$s{'licensemap'}{'lc'}{lc $name}
643 8 18 unless $$s{'licensemap'}{'lc'}{lc $name}
673 4 22 if (($prev_op || '') eq '<<') { }
682 4 18 unless defined $new
683 18 4 if defined $new
686 4 18 if (not defined $mapped) { }
690 4 0 unless $name =~ /^\?/
691 4 0 unless $name =~ /\?$/
699 0 26 if ($name eq 'REJECT' and not $origname =~ /REJECT/)
704 8 18 if $parens
714 8 46 if (ref $a) { }
720 26 20 if ($a =~ /\w\w/ and not $a =~ /^(and|or)$/i) { }
722 14 12 @a ? :
774 3 9 if ($colum_types[$i] eq 's')
776 0 3 if defined $canon_idx
780 0 3 unless defined $canon_idx
782 0 3 unless open my $in, '<', $file
789 3 322 if $csv->eof
790 4 318 unless ($line_no++)
794 4 0 if (my(@err) = $csv->error_diag)
797 1 3 if ($err[0] == 2025) { }
2 1 elsif (defined $line and $line =~ s/^#\s*//) { }
0 1 elsif ($err[0]) { }
800 1 0 if ($opts{'sep_char'} eq ',') { }
830 1 0 if $$row[0] =~ /^(\#|\W*SPDX)/
835 9 309 unless defined $$row[$canon_idx]
840 201 1431 unless defined $$row[$i]
841 162 1269 if $$row[$i] =~ /^[\?\s-]+$/
842 644 625 if ($colum_types[$i] eq 'l' or $colum_types[$i] eq 'a') { }
149 476 elsif ($colum_types[$i] eq 'u') { }
0 476 elsif ($colum_types[$i] eq 'c') { }
857 11 298 unless ($alias_count)
861 0 309 if $csv->eof
870 0 0 unless open IN, '<', $file
875 0 0 if $line =~ /^#/ and not $linecount++
876 0 0 if ($line =~ /^"([^"]*)",\s*"([^"]*)"/ or $line =~ /^([^,"]*),\s*([^,]*)/) { }
0 0 elsif ($line =~ /^("",\s*)?"([^"]*)"\s*$/ or $line =~ /^(,)?([^,"]*)\s*$/) { }