Branch Coverage

blib/lib/Mail/SpamAssassin/Conf.pm
Criterion Covered Total %
branch 121 398 30.4


line true false branch
225 0 1245 unless (defined $value and not $value =~ /^$/ and scalar @scores == 1 || scalar @scores == 4)
235 9 1803 if (s/^\((-?\d+(?:\.\d+)?)\)$/$1/)
238 0 1812 unless (/^-?\d+(?:\.\d+)?$/)
245 0 1245 if ($relative and not exists $self->{'scoreset'}[0]{$rule})
252 1245 0 if (@scores)
253 1056 189 if (@scores != 4)
260 12 4968 $relative ? :
399 0 0 unless (defined $value and not $value =~ /^$/)
402 0 0 unless ($value =~ /^\S+\s+\S+$/)
415 0 0 unless (defined $value and not $value =~ /^$/)
418 0 0 unless ($value =~ /^\S+\s+\S+$/)
481 0 0 unless (defined $value and not $value =~ /^$/)
484 0 0 unless ($value =~ /^(?:\S+(?:\s+\S+)*)$/)
652 0 0 unless (defined $value and not $value =~ /^$/)
655 0 0 unless ($value =~ /^(?:\S+(?:\s+\S+)*)$/)
706 0 0 unless ($value =~ /^ \( (.+?) \) \s+ (.+) \z/sx)
713 0 0 $host =~ s/^!// ? :
744 0 0 unless ($value =~ /^ (?: \( (.+?) \) \s+ )? (.+) \z/sx)
747 0 0 defined $1 ? :
751 0 0 $host =~ s/^!// ? :
800 0 0 unless ($value =~ /^ \( (.+?) \) \s+ (.+) \z/sx)
825 0 0 $host =~ s/^!// ? :
846 0 0 $host =~ s/^!// ? :
890 0 0 if ($hdr =~ /^$/) { }
0 0 elsif ($hdr =~ /^(?:From|Subject|To)$/) { }
895 0 0 unless (defined $string and $string =~ /\S/)
900 0 0 if ($hdr ne "Subject")
993 0 312 unless ($value =~ /^(ham|spam|all)\s+([A-Za-z0-9_-]+)\s+(.*?)\s*$/)
998 62 250 if ($hline =~ /^"(.*)"$/)
1012 250 62 if ($type eq "ham" or $type eq "all")
1017 312 0 if ($type eq "spam" or $type eq "all")
1045 0 0 unless ($value =~ /^(ham|spam|all)\s+([A-Za-z0-9_-]+)\s*$/)
1050 0 0 if $name eq "Checker-Version"
1053 0 0 if ($type eq "ham" or $type eq "all")
1057 0 0 if ($type eq "spam" or $type eq "all")
1087 0 62 unless (not defined $value or $value eq "")
1092 0 62 !@h ? :
1093 0 62 !@h ? :
1129 0 62 if ($value eq '') { }
0 62 elsif (not $value =~ /^[012]$/) { }
1137 0 62 if (not $self->{'report_safe'} || grep({lc $_->[0] eq 'report';} @{$$self{'headers_spam'};}))
1239 0 0 unless (defined $value and not $value =~ /^$/)
1242 0 0 if (lc $value eq 'yes' or $value eq '1') { }
0 0 elsif (lc $value eq 'no' or $value eq '0') { }
1248 0 0 unless ($] > "5.008004")
1255 0 0 unless (eval {
1260 0 0 unless (eval "require Encode")
1371 0 32 unless (not defined $value or $value eq "")
1425 0 32 unless (not defined $value or $value eq "")
1481 0 32 unless (not defined $value or $value eq "")
1510 0 124 unless (defined $value and not $value =~ /^$/)
1516 248 0 unless grep((lc $_ eq lc $hfname), @{$$self{"originating_ip_headers"};})
1532 0 62 unless (not defined $value or $value eq "")
1606 0 13 if ($value =~ /^test(?::\s*\S.*)?$/) { }
1 12 elsif ($value =~ /^(?:yes|1)$/) { }
12 0 elsif ($value =~ /^(?:no|0)$/) { }
1654 1 0 if ($value =~ /^(?: \[ ([^\]]*) \] | ([^:]*) ) : (\d+) \z/sx) { }
0 0 elsif ($value =~ /^(?: \[ ([^\]]*) \] |
1655 1 0 defined $1 ? :
1658 0 0 defined $1 ? :
1663 0 1 if $address =~ s/ ( % [A-Z0-9._~-]* ) \z//six
1665 1 0 if ($address =~ /$IP_ADDRESS/ and $port >= 1 and $port <= 65535) { }
1666 1 0 unless $self->{'dns_servers'}
1687 0 1 unless (not defined $value or $value eq "")
1731 0 0 if ($range =~ /^(\d{1,5})\z/) { }
0 0 elsif ($range =~ /^(\d{1,5})-(\d{1,5})\z/) { }
1733 0 0 if ($1 < 1 or $1 > 65535)
1736 0 0 if ($1 < 1 or $1 > 65535)
1737 0 0 if ($2 < 1 or $2 > 65535)
1768 0 0 if ($range =~ /^(\d{1,5})\z/) { }
0 0 elsif ($range =~ /^(\d{1,5})-(\d{1,5})\z/) { }
1769 0 0 if ($1 > 65535)
1773 0 0 if ($1 > 65535 or $2 > 65535)
1811 0 0 unless (not defined $value or $value eq "")
1888 0 0 if ($option =~ /^no(rotate|dns0x20)\z/) { }
0 0 elsif ($option =~ /^no(edns)0?\z/) { }
0 0 elsif ($option =~ /^(rotate|dns0x20)\z/) { }
0 0 elsif ($option =~ /^(edns)0? (?: = (\d+) )? \z/x) { }
1904 0 0 if $self->{'dns_options'}{$1} < 512
1954 0 0 unless defined $value and $value =~ s/^(allow|deny)\s+//i
1956 0 0 lc $1 eq 'deny' ? :
1978 0 0 if defined $value and $value ne ""
2102 0 0 if $value eq ""
2106 0 0 if (/^(none|noall)\z/) { }
0 0 elsif ($_ eq 'all') { }
0 0 elsif (/^(no)?(.+)\z/s and exists $all_kw{$2}) { }
2111 0 0 defined $1 ? :
2139 0 0 if ($value eq "")
2456 0 0 unless ($value =~ /^(nfssafe|flock|win32)$/)
2501 0 0 if ($value eq "")
2753 0 0 if ($value eq '') { }
0 0 elsif (not $value =~ /^[01]$/) { }
2761 0 0 $self->{'allow_user_rules'} ? :
2788 0 434 if ($value eq "")
2793 0 434 unless ($rec)
3052 0 2882 unless ($value =~ s/^(\S+)\s+//)
3056 0 2882 if ($value eq "")
3059 2324 558 if ($value =~ /^(?:rbl)?eval:(.*)$/) { }
3061 0 2324 unless ($fn =~ /^\w+\(.*\)$/)
3064 1 2323 if ($fn =~ /^check_(?:rbl|dns)/) { }
3112 0 316 unless ($value =~ s/^(\S+)\s+//)
3116 0 316 if ($value eq "")
3119 84 232 if ($value =~ /^eval:(.*)$/) { }
3121 0 84 unless ($fn =~ /^\w+\(.*\)$/)
3156 0 62 unless ($value =~ s/^(\S+)\s+//)
3160 0 62 if ($value eq "")
3195 0 0 unless ($value =~ s/^(\S+)\s+//)
3199 0 0 if ($value eq "")
3202 0 0 if ($value =~ /^eval:(.*)$/) { }
3204 0 0 unless ($fn =~ /^\w+\(.*\)$/)
3236 0 305 unless ($value =~ s/^(\S+)\s+//)
3240 0 305 if ($value eq "")
3243 305 0 if ($value =~ /^eval:(.*)$/) { }
3245 0 305 unless ($fn =~ /^\w+\(.*\)$/)
3314 0 132 unless ($value =~ s/^(\S+)\s+//)
3318 0 132 if ($value eq "")
3321 0 132 if ($value =~ /\*\s*\*/)
3350 0 61 unless ($value =~ /\s*(\w+)(?:\s+(?:\w+(?:\s+\w+)*))?\s*$/)
3355 0 61 if (not exists $self->{'tests'}{$rule_name})
3495 0 77 unless (defined $priority)
3498 0 77 unless ($rulename =~ /^(?^:[_a-zA-Z][_a-zA-Z0-9]{0,127})$/)
3501 0 77 unless ($priority =~ /^-?\d+$/)
3541 0 0 if ($value eq "")
3547 0 0 if ($_ eq $tag)
3549 0 0 if $tag
3568 1856 0 unless defined $COLLECT_REGRESSION_TESTS
3571 0 0 unless ($value =~ /^(\S+)\s+(ok|fail)\s+(.*)$/)
3644 0 1 unless (defined $value and not $value =~ /^$/)
3648 0 1 unless ($value =~ /^ ( \+? \d+ (?: \. \d*)? [smhdw]? )
3655 0 2 if (defined $_ and s/\s*([smhdw])\z//i)
3660 1 0 if (not defined $zone) { }
3662 0 1 if defined $timeout_min
3669 0 0 if defined $timeout_min
3687 0 10519 unless (defined $value and not $value =~ /^$/)
3690 0 10519 unless ($value =~ /^[^\s.]+(?:\s+[^\s.]+)*$/)
3711 0 36499 unless (defined $value and not $value =~ /^$/)
3714 0 36499 unless ($value =~ /^[^\s.]+\.[^\s.]+(?:\s+[^\s.]+\.[^\s.]+)*$/)
3735 0 3793 unless (defined $value and not $value =~ /^$/)
3738 0 3793 unless ($value =~ /^[^\s.]+\.[^\s.]+\.[^\s.]+(?:\s+[^\s.]+\.[^\s.]+\.[^\s.]+)*$/)
3760 0 79 unless (not defined $value or $value eq "")
3791 0 62 unless (defined $value and not $value =~ /^$/)
3794 0 62 if (-d $value)
3819 0 0 unless ($value =~ /^0?[0-7]{3}$/)
3843 0 6 unless ($value =~ /^([_A-Za-z0-9:]+)$/)
4096 0 5232 if ($value eq "")
4101 5232 0 if ($value =~ /^((?:\w+::){0,10}\w+)(?:\s+(\S+\.pm))?$/i) { }
4122 0 0 if ($value eq "")
4127 0 0 if ($value =~ /^((?:\w+::){0,10}\w+)(?:\s+(\S+\.pm))?$/i) { }
4583 0 0 if (@_)
4624 0 0 if ($test_type eq "rbl_evals")
4628 0 0 if (defined $priority) { }
4644 0 0 if ($test_type eq "rbl_evals")
4648 0 0 if (defined $priority) { }
4653 0 0 if (exists $self->{$test_type}{$pri}{$rulename})
4665 0 0 if ($test_type eq "rbl_evals")
4669 0 0 if (defined $priority) { }
4674 0 0 if (exists $self->{$test_type}{$pri}{$rulename})
4691 0 0 unless ($rec)
4703 0 0 if (@rules_to_keep == 0)
4721 0 0 unless $rules_to_keep_hash{$rulekey}
4736 0 0 if $token eq $meta
4740 0 0 if ($self->get_rule_value("meta_tests", $token))
4752 0 88 if ($test_type eq "rbl_evals")
4753 0 0 unless $self->{$test_type}{$rulename}
4758 0 88 if (defined $priority) { }
4760 0 0 unless $self->{$test_type}{$priority}{$rulename}
4767 88 0 if ($self->{$test_type}{$pri}{$rulename})
4772 0 88 unless $found_p
4785 0 1 if $port_range_lo < 0
4786 0 1 if $port_range_hi > 65535
4787 1 0 if (not defined $$bitset_ref) { }
0 0 elsif ($$bitset_ref eq '') { }
4793 1 0 !$value ? :
4801 0 1 !$value ? :
4824 0 0 if (@_ == 1) { }
4847 91 3 unless (defined $self->{'found_any_rules'})
4870 0 13 if ($rulename =~ /AUTOLEARNTEST/i)
4874 0 13 unless defined $type
4876 9 4 if ($type == $TYPE_HEAD_TESTS or $type == $TYPE_HEAD_EVALS) { }
0 4 elsif ($type == $TYPE_META_TESTS) { }
4882 0 0 if ($tflags =~ /\bnet\b/i) { }
4896 0 4 if ($rulename =~ /AUTOLEARNTEST/i)
4900 0 4 unless defined $type
4902 4 0 if ($type == $TYPE_BODY_TESTS or $type == $TYPE_BODY_EVALS or $type == $TYPE_URI_TESTS or $type == $TYPE_URI_EVALS) { }
0 0 elsif ($type == $TYPE_META_TESTS) { }
4910 0 0 if ($tflags =~ /\bnet\b/i) { }
4942 1 2 unless (defined $source)
4945 2 1 unless (defined $dest)
4993 12 0 if ($i eq 'HASH') { }
0 0 elsif ($i eq 'ARRAY') { }
5008 61 696 if exists $done{$k}
5013 540 156 if ($i eq '') { }
0 156 elsif ($i eq 'SCALAR') { }
27 129 elsif ($i eq 'ARRAY') { }
129 0 elsif ($i eq 'HASH') { }
0 0 elsif ($i eq 'Regexp') { }
5036 645 78 if exists $done{$k}
5063 2 0 if (not $self->{'main'}{'keep_config_parsing_metadata'} || $self->{'allow_user_rules'})
5075 248 124 if ($add_loopback)