Branch Coverage

blib/lib/Mail/SpamAssassin/Conf/Parser.pm
Criterion Covered Total %
branch 207 338 61.2


line true false branch
189 9922 8716 if (exists $cmd->{'default'})
203 736 17902 if ($cmd->{'is_frequent'}) { }
211 184 18454 if ($cmd->{'aliases'} and scalar @{$cmd->{'aliases'};} > 0)
231 0 91 if ($lang)
239 91 0 if ($lang =~ /^(C|POSIX)$/) { }
265 51386 89488 if (index($line, "#") > -1)
267 0 51386 if ($keepmetadata and $line =~ /^\#testrules/)
273 0 51386 if ($line =~ /^\# UPDATE version (\d+)$/)
275 0 0 if defined $_ and $_ ne "(no file)"
285 65376 75498 unless $line
288 0 0 unless $lang =~ /^$1/i
0 75498 if ($line =~ s/^lang\s+(\S+)\s+//)
294 1595 73903 unless defined $value
303 3314 72184 if ($key eq 'file') { }
0 72184 elsif ($key eq 'include') { }
746 71438 elsif ($key eq 'ifplugin') { }
239 71199 elsif ($key eq 'if') { }
0 71199 elsif ($key eq 'else') { }
985 70214 elsif ($key eq 'endif') { }
304 1657 1657 if ($value =~ /^start\s+(.+)$/)
310 1657 0 if ($value =~ /^end\s/)
313 0 1657 if (scalar @if_stack > 0)
316 0 0 if ($cond->{'type'} eq 'if') { }
333 1657 0 if (defined $curfile) { }
364 0 0 unless (@if_stack)
376 0 985 unless (defined $lastcond)
386 159 70055 if $skip_parsing
388 0 70055 if ($key eq "require_version")
390 0 0 if $value eq "\@\@VERSION\@\@"
402 0 0 if ($ver ne $value)
416 61781 8274 unless ($cmd)
422 70042 13 if ($cmd)
423 0 70042 if ($self->{'scoresonly'})
424 0 0 if ($cmd->{'is_priv'} and not $conf->{'allow_user_rules'})
428 0 0 if ($cmd->{'is_admin'})
434 726 69316 unless ($cmd->{'code'})
435 0 726 unless ($self->setup_default_code_cb($cmd))
442 0 70042 if ($ret and $ret eq $Mail::SpamAssassin::Conf::INVALID_VALUE) { }
0 70042 elsif ($ret and $ret eq $Mail::SpamAssassin::Conf::INVALID_HEADER_FIELD_NAME) { }
0 70042 elsif ($ret and $ret eq $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE) { }
469 0 13 if ($conf->{'main'}->call_plugins("parse_config", {"key", $key, "value", $value, "line", $line, "conf", $conf, "user_config", $self->{'scoresonly'}}))
484 13 0 unless ($msg)
486 0 13 if ($migrated_keys{$key}) { }
517 2132 1889 if ($token =~ /^(?:\W{1,5}|[+-]?\d+(?:\.\d+)?)$/) { }
746 1143 elsif ($token eq 'plugin') { }
158 985 elsif ($token eq 'can') { }
0 985 elsif ($token eq 'has') { }
81 904 elsif ($token eq 'version') { }
0 904 elsif ($token eq 'perl_version') { }
904 0 elsif ($token =~ /^\w[\w\:]+$/) { }
542 904 0 if ($token =~ /^(?:\w+::){0,10}\w+$/) { }
558 0 985 if ($bad)
569 909 76 if (eval $eval) { }
573 0 76 if $@ ne ""
585 0 158 if ($self->{'currentfile'} =~ /\buser_prefs$/)
601 0 158 if (not defined $method) { }
158 0 elsif ($method =~ /^(.*)::([^:]+)$/) { }
608 158 0 if $module->can($meth) and $fn_name eq 'has' || &{$method;}()
624 32 59 if ($conf->{'lint_rules'})
627 0 896 unless (exists $conf->{'tests'}{$k})
633 0 640 unless (exists $conf->{'tests'}{$sk})
651 2458 1239 unless (exists $conf->{'scores'}{$k})
653 0 2458 $k =~ /^T_/ ? :
655 671 1787 if ($conf->{'tflags'}{$k} || '') =~ /\bnice\b/
670 3509 188 unless ($k =~ /^(?:T_|__)/i)
671 1785 1724 unless (exists $conf->{'descriptions'}{$k})
684 124 602 if ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_STRING) { }
97 505 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_BOOL) { }
213 292 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_NUMERIC) { }
124 168 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_HASH_KEY_VALUE) { }
0 168 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST) { }
124 44 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_TEMPLATE) { }
0 44 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_NOARGS) { }
0 44 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_STRINGLIST) { }
44 0 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_IPADDRLIST) { }
0 0 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_DURATION) { }
724 0 0 unless (not defined $value or $value eq "")
732 0 213 unless (defined $value and not $value =~ /^$/)
735 0 213 unless ($value =~ /^ [+-]? \d+ (?: \. \d* )? \z/sx)
746 0 0 unless (defined $value and not $value =~ /^$/)
749 0 0 unless ($value =~ /^( \+? \d+ (?: \. \d* )? ) (?: \s* ([smhdw]))? \z/six)
754 0 0 if defined $2
762 0 97 unless (defined $value and not $value =~ /^$/)
768 64 33 if ($value eq 'yes' or $value eq '1') { }
33 0 elsif ($value eq 'no' or $value eq '0') { }
784 0 124 unless (defined $value and not $value =~ /^$/)
794 0 0 unless (defined $value and not $value =~ /^$/)
804 0 44 unless (defined $value and not $value =~ /^$/)
818 0 3699 unless (defined $v and $v ne "")
828 0 0 unless (defined $value and not $value =~ /^$/)
837 0 0 unless (defined $value and not $value =~ /^$/)
845 62 992 if ($value =~ /^"(.*?)"$/)
851 0 124 unless (not defined $value or $value eq "")
865 91 0 if (not $isuserconf) { }
876 91 0 unless ($conf->{'allow_user_rules'})
888 2713 983 if (($type & 1) == 1) { }
889 2713 0 if (my($function, $args) = $text =~ /^(\w+)\((.*?)\)$/) { }
891 0 2713 if (not defined $argsref) { }
84 2629 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_BODY_EVALS) { }
2323 306 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS) { }
1 305 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_RBL_EVALS) { }
0 305 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_RAWBODY_EVALS) { }
305 0 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_FULL_EVALS) { }
927 231 752 if ($type == $Mail::SpamAssassin::Conf::TYPE_BODY_TESTS) { }
558 194 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_HEAD_TESTS) { }
132 62 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_META_TESTS) { }
62 0 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_URI_TESTS) { }
0 0 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_RAWBODY_TESTS) { }
0 0 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_FULL_TESTS) { }
0 0 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_EMPTY_TESTS) { }
956 91 0 if (not $isuserconf) { }
964 91 0 if (not $conf->{'allow_user_rules'})
979 3565 132 unless $conf->{'test_types'}{$name} == $Mail::SpamAssassin::Conf::TYPE_META_TESTS
990 4 443 if defined $conf->{'meta_dependencies'}{$name}
994 0 443 unless ($rule)
1000 0 443 if exists $alreadydone->{$name}
1012 2223 1637 if $token =~ tr[0-9A-Z_a-z](\000-/:-@[-^`{-\377)c or substr($token, 0, 1) =~ tr/A-Z_a-z/\000-@[-^`{-\377/c
1015 1322 315 unless exists $conf_tests->{$token}
1030 0 91 unless $conf->{'meta_dependencies'}
1043 3257 443 unless defined $deps
1048 7 310 if ($deppri > $basepri)
1066 2713 984 if $type & 1 or $type eq $Mail::SpamAssassin::Conf::TYPE_EMPTY_TESTS
1074 1 983 if (defined $names_for_text{$text}) { }
1089 1 1 if (not defined $first or $priority < $first_pri)
1098 1 1 if $name eq $first
1117 0 2713 if $args =~ /^\s+$/
1130 1554 0 defined $2 ? :
1133 0 2713 if ($args ne "")
1152 28 63 if ($conf->{'trusted_networks_configured'}) { }
1 62 elsif ($conf->{'internal_networks_configured'}) { }
1163 42 16 unless $$conf{"${net_type}_configured"}
1164 1 15 if $net_type eq $matching_against
1172 4 34 if (not $net->{'exclude'} || $nt->contains_net($net)) { }
1184 4 11 if ($replace_nets)
1199 0 3697 unless ($name =~ /^(?^:[_a-zA-Z][_a-zA-Z0-9]{0,127})$/)
1208 0 3697 if (length $name > 100)
1215 1888 1809 if ($conf->{'lint_rules'})
1216 0 0 if (length $name > 40 and not $name =~ /^__/ and not $name =~ /^T_/)
1228 294 3403 if ($type == $Mail::SpamAssassin::Conf::TYPE_BODY_TESTS or $type == $Mail::SpamAssassin::Conf::TYPE_FULL_TESTS or $type == $Mail::SpamAssassin::Conf::TYPE_RAWBODY_TESTS or $type == $Mail::SpamAssassin::Conf::TYPE_URI_TESTS) { }
558 2845 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_HEAD_TESTS) { }
132 2713 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_META_TESTS) { }
1234 0 294 unless ($rec)
1245 62 496 if ($text =~ /^exists:(.*)/) { }
1249 0 62 unless ($hdr =~ /^[\w.-]+:?$/)
1258 0 496 unless ($text =~ /^([\w.-]+(?:\:|(?:\:[a-z]+){1,2})?)\s*([=!]~)\s*(.+)$/)
1264 124 372 if ($pat =~ s/\s+\[if-unset:\s+(.+)\]$//)
1268 0 496 unless ($rec)
1274 124 372 if $op eq "!~"
1279 132 0 if ($self->is_meta_valid($name, $text)) { }
1290 0 3697 if ($name =~ /AUTOLEARNTEST/i)
1295 132 3565 if ($type == $Mail::SpamAssassin::Conf::TYPE_META_TESTS) { }
1304 0 3697 if ($conf->{'main'}{'keep_config_parsing_metadata'})
1307 0 0 if ($self->{'file_scoped_attrs'}{'testrules'})
1325 0 3697 if ($self->{'scoresonly'})
1335 0 0 if ($conf->{'regression_tests'}{$name}) { }
1351 0 132 if ($rule =~ /(?:\:\:|->)/)
1365 334 483 if ($token =~ /^(?^:[_a-zA-Z][_a-zA-Z0-9]{0,127})$/) { }
483 0 elsif ($token =~ /^(\d+(?:\.\d+)?|[[:punct:]]{1,2})\z/s) { }
1382 132 0 if (eval $evalstr)
1385 0 0 $@ ne '' ? :
1433 0 0 if ($conf->{$listname}{$addr}) { }
1475 0 0 if ($conf_lname->{$addr})
1480 0 0 if (not @replacement) { }
0 0 elsif (@replacement != @$domains_listref) { }
1497 0 0 unless ("File::Spec"->file_name_is_absolute($path))
1510 4 13 unless (defined $iserror)
1512 4 13 if ($self->{'conf'}{'main'}{'lint_callback'}) { }
0 13 elsif ($self->{'conf'}{'lint_rules'}) { }
1526 17 0 if ($iserror)