Branch Coverage

blib/lib/Mail/SpamAssassin/Conf.pm
Criterion Covered Total %
branch 118 388 30.4


line true false branch
225 0 1225 unless (defined $value and not $value =~ /^$/ and scalar @scores == 1 || scalar @scores == 4)
235 9 1774 if (s/^\((-?\d+(?:\.\d+)?)\)$/$1/)
238 0 1783 unless (/^-?\d+(?:\.\d+)?$/)
245 0 1225 if ($relative and not exists $self->{'scoreset'}[0]{$rule})
252 1225 0 if (@scores)
253 1039 186 if (@scores != 4)
260 12 4888 $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+)*)$/)
695 0 0 unless ($value =~ /^ \( (.+?) \) \s+ (.+) \z/sx)
702 0 0 $host =~ s/^!// ? :
733 0 0 unless ($value =~ /^ (?: \( (.+?) \) \s+ )? (.+) \z/sx)
736 0 0 defined $1 ? :
740 0 0 $host =~ s/^!// ? :
789 0 0 unless ($value =~ /^ \( (.+?) \) \s+ (.+) \z/sx)
814 0 0 $host =~ s/^!// ? :
835 0 0 $host =~ s/^!// ? :
879 0 0 if ($hdr =~ /^$/) { }
0 0 elsif ($hdr =~ /^(?:From|Subject|To)$/) { }
884 0 0 unless (defined $string and $string =~ /\S/)
889 0 0 if ($hdr ne 'Subject')
970 0 308 unless ($value =~ /^(ham|spam|all)\s+([A-Za-z0-9_-]+)\s+(.*?)\s*$/)
975 61 247 if ($hline =~ /^"(.*)"$/)
989 247 61 if ($type eq 'ham' or $type eq 'all')
994 308 0 if ($type eq 'spam' or $type eq 'all')
1022 0 0 unless ($value =~ /^(ham|spam|all)\s+([A-Za-z0-9_-]+)\s*$/)
1027 0 0 if $name eq 'Checker-Version'
1030 0 0 if ($type eq 'ham' or $type eq 'all')
1034 0 0 if ($type eq 'spam' or $type eq 'all')
1064 0 61 unless (not defined $value or $value eq '')
1069 0 61 !@h ? :
1070 0 61 !@h ? :
1106 0 61 if ($value eq '') { }
0 61 elsif (not $value =~ /^[012]$/) { }
1114 0 61 if (not $self->{'report_safe'} || grep({lc $_->[0] eq 'report';} @{$$self{'headers_spam'};}))
1216 0 0 unless (defined $value and not $value =~ /^$/)
1219 0 0 if (lc $value eq 'yes' or $value eq '1') { }
0 0 elsif (lc $value eq 'no' or $value eq '0') { }
1225 0 0 unless ($] > 5.008004)
1232 0 0 unless (eval { do { 'HTML::Parser'->VERSION(3.46) } })
1237 0 0 unless (eval 'require Encode')
1378 0 32 unless (not defined $value or $value eq '')
1432 0 32 unless (not defined $value or $value eq '')
1488 0 32 unless (not defined $value or $value eq '')
1517 0 122 unless (defined $value and not $value =~ /^$/)
1523 244 0 unless grep((lc $_ eq lc $hfname), @{$$self{'originating_ip_headers'};})
1539 0 61 unless (not defined $value or $value eq '')
1613 0 13 if ($value =~ /^test(?::\s*\S.*)?$/) { }
1 12 elsif ($value =~ /^(?:yes|1)$/) { }
12 0 elsif ($value =~ /^(?:no|0)$/) { }
1661 1 0 if ($value =~ /^(?: \[ ([^\]]*) \] | ([^:]*) ) : (\d+) \z/sx) { }
0 0 elsif ($value =~ /^(?: \[ ([^\]]*) \] | ([0-9A-F.:]+ (?: %[A-Z0-9._~-]* )? ) ) \z/six) { }
1662 1 0 defined $1 ? :
1665 0 0 defined $1 ? :
1670 0 1 if $address =~ s/ ( % [A-Z0-9._~-]* ) \z//six
1672 1 0 if ($address =~ /$IP_ADDRESS/ and $port >= 1 and $port <= 65535) { }
1673 1 0 unless $self->{'dns_servers'}
1694 0 1 unless (not defined $value or $value eq '')
1738 0 0 if ($range =~ /^(\d{1,5})\z/) { }
0 0 elsif ($range =~ /^(\d{1,5})-(\d{1,5})\z/) { }
1740 0 0 if ($1 < 1 or $1 > 65535)
1743 0 0 if ($1 < 1 or $1 > 65535)
1744 0 0 if ($2 < 1 or $2 > 65535)
1775 0 0 if ($range =~ /^(\d{1,5})\z/) { }
0 0 elsif ($range =~ /^(\d{1,5})-(\d{1,5})\z/) { }
1776 0 0 if ($1 > 65535)
1780 0 0 if ($1 > 65535 or $2 > 65535)
1818 0 0 unless (not defined $value or $value eq '')
1895 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) { }
1911 0 0 if $self->{'dns_options'}{$1} < 512
1961 0 0 unless defined $value and $value =~ s/^(allow|deny)\s+//i
1963 0 0 lc $1 eq 'deny' ? :
1985 0 0 if defined $value and $value ne ''
2109 0 0 if $value eq ''
2113 0 0 if (/^(none|noall)\z/) { }
0 0 elsif ($_ eq 'all') { }
0 0 elsif (/^(no)?(.+)\z/s and exists $all_kw{$2}) { }
2118 0 0 defined $1 ? :
2146 0 0 if ($value eq '')
2463 0 0 unless ($value =~ /^(nfssafe|flock|win32)$/)
2508 0 0 if ($value eq '')
2760 0 0 if ($value eq '') { }
0 0 elsif (not $value =~ /^[01]$/) { }
2768 0 0 $self->{'allow_user_rules'} ? :
2795 0 427 if ($value eq '')
2800 0 427 unless ($rec)
3059 0 2835 unless ($value =~ s/^(\S+)\s+//)
3063 0 2835 if ($value eq '')
3066 2286 549 if ($value =~ /^(?:rbl)?eval:(.*)$/) { }
3068 0 2286 unless ($fn =~ /^\w+\(.*\)$/)
3071 1 2285 if ($fn =~ /^check_(?:rbl|dns)/) { }
3119 0 312 unless ($value =~ s/^(\S+)\s+//)
3123 0 312 if ($value eq '')
3126 83 229 if ($value =~ /^eval:(.*)$/) { }
3128 0 83 unless ($fn =~ /^\w+\(.*\)$/)
3163 0 61 unless ($value =~ s/^(\S+)\s+//)
3167 0 61 if ($value eq '')
3202 0 0 unless ($value =~ s/^(\S+)\s+//)
3206 0 0 if ($value eq '')
3209 0 0 if ($value =~ /^eval:(.*)$/) { }
3211 0 0 unless ($fn =~ /^\w+\(.*\)$/)
3243 0 300 unless ($value =~ s/^(\S+)\s+//)
3247 0 300 if ($value eq '')
3250 300 0 if ($value =~ /^eval:(.*)$/) { }
3252 0 300 unless ($fn =~ /^\w+\(.*\)$/)
3321 0 130 unless ($value =~ s/^(\S+)\s+//)
3325 0 130 if ($value eq '')
3328 0 130 if ($value =~ /\*\s*\*/)
3357 0 60 unless ($value =~ /\s*(\w+)(?:\s+(?:\w+(?:\s+\w+)*))?\s*$/)
3362 0 60 if (not exists $self->{'tests'}{$rule_name})
3534 0 0 if ($value eq '')
3540 0 0 if ($_ eq $tag)
3542 0 0 if $tag
3561 1827 0 unless defined $COLLECT_REGRESSION_TESTS
3564 0 0 unless ($value =~ /^(\S+)\s+(ok|fail)\s+(.*)$/)
3607 0 1 unless (defined $value and not $value =~ /^$/)
3611 0 1 unless ($value =~ /^ ( \+? \d+ (?: \. \d*)? [smhdw]? ) (?: \s+ ( \+? \d+ (?: \. \d*)? [smhdw]? ) )? (?: \s+ (\S* [a-zA-Z]) )? $/six)
3618 0 2 if (defined $_ and s/\s*([smhdw])\z//i)
3623 1 0 if (not defined $zone) { }
3625 0 1 if defined $timeout_min
3632 0 0 if defined $timeout_min
3650 0 10620 unless (defined $value and not $value =~ /^$/)
3653 0 10620 unless ($value =~ /^[^\s.]+(?:\s+[^\s.]+)*$/)
3674 0 35881 unless (defined $value and not $value =~ /^$/)
3677 0 35881 unless ($value =~ /^[^\s.]+\.[^\s.]+(?:\s+[^\s.]+\.[^\s.]+)*$/)
3698 0 3745 unless (defined $value and not $value =~ /^$/)
3701 0 3745 unless ($value =~ /^[^\s.]+\.[^\s.]+\.[^\s.]+(?:\s+[^\s.]+\.[^\s.]+\.[^\s.]+)*$/)
3723 0 78 unless (not defined $value or $value eq '')
3754 0 61 unless (defined $value and not $value =~ /^$/)
3757 0 61 if (-d $value)
3782 0 0 unless ($value =~ /^0?[0-7]{3}$/)
3806 0 6 unless ($value =~ /^([_A-Za-z0-9:]+)$/)
4059 0 5148 if ($value eq '')
4064 5148 0 if ($value =~ /^((?:\w+::){0,10}\w+)(?:\s+(\S+\.pm))?$/i) { }
4085 0 0 if ($value eq '')
4090 0 0 if ($value =~ /^((?:\w+::){0,10}\w+)(?:\s+(\S+\.pm))?$/i) { }
4545 0 0 if (@_)
4586 0 0 if ($test_type eq 'rbl_evals')
4590 0 0 if (defined $priority) { }
4606 0 0 if ($test_type eq 'rbl_evals')
4610 0 0 if (defined $priority) { }
4615 0 0 if (exists $self->{$test_type}{$pri}{$rulename})
4627 0 0 if ($test_type eq 'rbl_evals')
4631 0 0 if (defined $priority) { }
4636 0 0 if (exists $self->{$test_type}{$pri}{$rulename})
4653 0 0 unless ($rec)
4665 0 0 if (@rules_to_keep == 0)
4683 0 0 unless $rules_to_keep_hash{$rulekey}
4698 0 0 if $token eq $meta
4702 0 0 if ($self->get_rule_value('meta_tests', $token))
4714 0 88 if ($test_type eq 'rbl_evals')
4715 0 0 unless $self->{$test_type}{$rulename}
4720 0 88 if (defined $priority) { }
4722 0 0 unless $self->{$test_type}{$priority}{$rulename}
4729 88 0 if ($self->{$test_type}{$pri}{$rulename})
4734 0 88 unless $found_p
4747 0 1 if $port_range_lo < 0
4748 0 1 if $port_range_hi > 65535
4749 1 0 if (not defined $$bitset_ref) { }
0 0 elsif ($$bitset_ref eq '') { }
4755 1 0 !$value ? :
4763 0 1 !$value ? :
4786 0 0 if (@_ == 1) { }
4809 90 3 unless (defined $self->{'found_any_rules'})
4832 0 13 if ($rulename =~ /AUTOLEARNTEST/i)
4836 0 13 unless defined $type
4838 9 4 if ($type == $TYPE_HEAD_TESTS or $type == $TYPE_HEAD_EVALS) { }
0 4 elsif ($type == $TYPE_META_TESTS) { }
4844 0 0 if ($tflags =~ /\bnet\b/i) { }
4858 0 4 if ($rulename =~ /AUTOLEARNTEST/i)
4862 0 4 unless defined $type
4864 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) { }
4872 0 0 if ($tflags =~ /\bnet\b/i) { }
4904 1 2 unless (defined $source)
4907 2 1 unless (defined $dest)
4955 12 0 if ($i eq 'HASH') { }
0 0 elsif ($i eq 'ARRAY') { }
4970 61 692 if exists $done{$k}
4975 536 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') { }
4998 644 76 if exists $done{$k}
5025 2 0 if (not $self->{'main'}{'keep_config_parsing_metadata'} || $self->{'allow_user_rules'})
5037 246 123 if ($add_loopback)