Branch Coverage

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


line true false branch
189 9790 8545 if (exists $cmd->{'default'})
203 728 17607 if ($cmd->{'is_frequent'}) { }
211 182 18153 if ($cmd->{'aliases'} and scalar @{$cmd->{'aliases'};} > 0)
231 0 90 if ($lang)
239 90 0 if ($lang =~ /^(C|POSIX)$/) { }
265 50346 88200 if (index($line, '#') > -1)
267 0 50346 if ($keepmetadata and $line =~ /^\#testrules/)
273 0 50346 if ($line =~ /^\# UPDATE version (\d+)$/)
275 0 0 if defined $_ and $_ ne '(no file)'
285 63997 74549 unless $line
288 0 0 unless $lang =~ /^$1/i
0 74549 if ($line =~ s/^lang\s+(\S+)\s+//)
294 1572 72977 unless defined $value
303 3264 71285 if ($key eq 'file') { }
0 71285 elsif ($key eq 'include') { }
734 70551 elsif ($key eq 'ifplugin') { }
236 70315 elsif ($key eq 'if') { }
0 70315 elsif ($key eq 'else') { }
970 69345 elsif ($key eq 'endif') { }
304 1632 1632 if ($value =~ /^start\s+(.+)$/)
310 1632 0 if ($value =~ /^end\s/)
313 0 1632 if (scalar @if_stack > 0)
316 0 0 if ($cond->{'type'} eq 'if') { }
333 1632 0 if (defined $curfile) { }
364 0 0 unless (@if_stack)
376 0 970 unless (defined $lastcond)
386 158 69187 if $skip_parsing
388 0 69187 if ($key eq 'require_version')
390 0 0 if $value eq '@@VERSION@@'
402 0 0 if ($ver ne $value)
416 61046 8141 unless ($cmd)
422 69174 13 if ($cmd)
423 0 69174 if ($self->{'scoresonly'})
424 0 0 if ($cmd->{'is_priv'} and not $conf->{'allow_user_rules'})
428 0 0 if ($cmd->{'is_admin'})
434 776 68398 unless ($cmd->{'code'})
435 0 776 unless ($self->setup_default_code_cb($cmd))
442 0 69174 if ($ret and $ret eq $Mail::SpamAssassin::Conf::INVALID_VALUE) { }
0 69174 elsif ($ret and $ret eq $Mail::SpamAssassin::Conf::INVALID_HEADER_FIELD_NAME) { }
0 69174 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 2100 1860 if ($token =~ /^(?:\W{1,5}|[+-]?\d+(?:\.\d+)?)$/) { }
734 1126 elsif ($token eq 'plugin') { }
156 970 elsif ($token eq 'can') { }
0 970 elsif ($token eq 'has') { }
80 890 elsif ($token eq 'version') { }
0 890 elsif ($token eq 'perl_version') { }
890 0 elsif ($token =~ /^\w[\w\:]+$/) { }
542 890 0 if ($token =~ /^(?:\w+::){0,10}\w+$/) { }
558 0 970 if ($bad)
569 895 75 if (eval $eval) { }
573 0 75 if $@ ne ''
585 0 156 if ($self->{'currentfile'} =~ /\buser_prefs$/)
601 0 156 if (not defined $method) { }
156 0 elsif ($method =~ /^(.*)::([^:]+)$/) { }
608 156 0 if $module->can($meth) and $fn_name eq 'has' || &{$method;}()
624 32 58 if ($conf->{'lint_rules'})
627 0 896 unless (exists $conf->{'tests'}{$k})
633 0 640 unless (exists $conf->{'tests'}{$sk})
651 2419 1219 unless (exists $conf->{'scores'}{$k})
653 0 2419 $k =~ /^T_/ ? :
655 660 1759 if ($conf->{'tflags'}{$k} || '') =~ /\bnice\b/
670 3453 185 unless ($k =~ /^(?:T_|__)/i)
671 1757 1696 unless (exists $conf->{'descriptions'}{$k})
684 122 654 if ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_STRING) { }
96 558 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_BOOL) { }
210 348 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_NUMERIC) { }
182 166 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_HASH_KEY_VALUE) { }
0 166 elsif ($type == $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST) { }
122 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 210 unless (defined $value and not $value =~ /^$/)
735 0 210 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 96 unless (defined $value and not $value =~ /^$/)
768 63 33 if ($value eq 'yes' or $value eq '1') { }
33 0 elsif ($value eq 'no' or $value eq '0') { }
784 0 122 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 3715 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 61 976 if ($value =~ /^"(.*?)"$/)
851 0 122 unless (not defined $value or $value eq '')
865 90 0 if (not $isuserconf) { }
876 90 0 unless ($conf->{'allow_user_rules'})
888 2669 968 if (($type & 1) == 1) { }
889 2669 0 if (my($function, $args) = $text =~ /^(\w+)\((.*?)\)$/) { }
891 0 2669 if (not defined $argsref) { }
83 2586 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_BODY_EVALS) { }
2285 301 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS) { }
1 300 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_RBL_EVALS) { }
0 300 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_RAWBODY_EVALS) { }
300 0 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_FULL_EVALS) { }
927 228 740 if ($type == $Mail::SpamAssassin::Conf::TYPE_BODY_TESTS) { }
549 191 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_HEAD_TESTS) { }
130 61 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_META_TESTS) { }
61 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 90 0 if (not $isuserconf) { }
964 90 0 if (not $conf->{'allow_user_rules'})
979 3508 130 unless $conf->{'test_types'}{$name} == $Mail::SpamAssassin::Conf::TYPE_META_TESTS
990 4 436 if defined $conf->{'meta_dependencies'}{$name}
994 0 436 unless ($rule)
1000 0 436 if exists $alreadydone->{$name}
1012 2188 1611 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 1301 310 unless exists $conf_tests->{$token}
1030 0 90 unless $conf->{'meta_dependencies'}
1043 3205 436 unless defined $deps
1048 7 305 if ($deppri > $basepri)
1066 2669 969 if $type & 1 or $type eq $Mail::SpamAssassin::Conf::TYPE_EMPTY_TESTS
1074 1 968 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 2669 if $args =~ /^\s+$/
1130 1529 0 defined $2 ? :
1133 0 2669 if ($args ne '')
1152 28 62 if ($conf->{'trusted_networks_configured'}) { }
1 61 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 3638 unless ($name =~ /^(?^:[_a-zA-Z][_a-zA-Z0-9]{0,127})$/)
1208 0 3638 if (length $name > 100)
1215 1888 1750 if ($conf->{'lint_rules'})
1216 0 0 if (length $name > 40 and not $name =~ /^__/ and not $name =~ /^T_/)
1228 290 3348 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) { }
549 2799 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_HEAD_TESTS) { }
130 2669 elsif ($type == $Mail::SpamAssassin::Conf::TYPE_META_TESTS) { }
1234 0 290 unless ($rec)
1245 61 488 if ($text =~ /^exists:(.*)/) { }
1249 0 61 unless ($hdr =~ /^[^:\s]+:?$/)
1257 0 488 unless ($text =~ /^([^:\s]+(?:\:|(?:\:[a-z]+){1,2})?)\s*([=!]~)\s*(.+)$/)
1263 122 366 if ($pat =~ s/\s+\[if-unset:\s+(.+)\]$//)
1267 0 488 unless ($rec)
1273 122 366 if $op eq '!~'
1278 130 0 if ($self->is_meta_valid($name, $text)) { }
1289 0 3638 if ($name =~ /AUTOLEARNTEST/i)
1294 130 3508 if ($type == $Mail::SpamAssassin::Conf::TYPE_META_TESTS) { }
1303 0 3638 if ($conf->{'main'}{'keep_config_parsing_metadata'})
1306 0 0 if ($self->{'file_scoped_attrs'}{'testrules'})
1324 0 3638 if ($self->{'scoresonly'})
1334 0 0 if ($conf->{'regression_tests'}{$name}) { }
1350 0 130 if ($rule =~ /(?:\:\:|->)/)
1364 329 476 if ($token =~ /^(?^:[_a-zA-Z][_a-zA-Z0-9]{0,127})$/) { }
476 0 elsif ($token =~ /^(\d+(?:\.\d+)?|[[:punct:]]{1,2})\z/s) { }
1381 130 0 if (eval $evalstr)
1384 0 0 $@ ne '' ? :
1432 0 0 if ($conf->{$listname}{$addr}) { }
1474 0 0 if ($conf_lname->{$addr})
1479 0 0 if (not @replacement) { }
0 0 elsif (@replacement != @$domains_listref) { }
1496 0 0 unless ('File::Spec'->file_name_is_absolute($path))
1509 4 13 unless (defined $iserror)
1511 4 13 if ($self->{'conf'}{'main'}{'lint_callback'}) { }
0 13 elsif ($self->{'conf'}{'lint_rules'}) { }
1525 17 0 if ($iserror)