Branch Coverage

blib/lib/Mail/SpamAssassin.pm
Criterion Covered Total %
branch 109 340 32.0


line true false branch
392 0 37 unless (defined $self)
397 0 37 if ($self->{'debug'} and $self->{'debug'} eq 1)
419 0 37 if (defined $ntags)
420 0 0 ref $ntags ? :
421 0 0 if $t =~ /^(NO)?(.+)\z/is
425 0 37 if (would_log("dbg", "timing") or $self->{'needed_tags'}{'TIMING'})
437 37 0 unless (defined $self->{'username'})
454 0 37 if ($m eq 'win32') { }
0 37 elsif ($m eq 'flock') { }
0 37 elsif ($m eq 'nfssafe') { }
459 0 37 if (am_running_on_windows()) { }
472 0 37 unless (eval "\n use Mail::SpamAssassin::Locker::" . $class . ";\n \$self->{locker} = new Mail::SpamAssassin::Locker::" . $class . " (\$self);\n 1;\n ")
473 0 0 $@ ne '' ? :
477 0 37 if (not defined $self->{'locker'})
531 1 0 if (ref $suppl_attrib and exists $suppl_attrib->{'master_deadline'})
535 44 0 if ($self->{'conf'}{'time_limit'})
537 44 0 if (not defined $master_deadline or $time_limit_deadline < $master_deadline)
541 44 0 if (defined $master_deadline)
584 0 12 if $self->{'timer_enabled'}
649 0 2 if ($forget) { }
0 2 elsif ($isspam) { }
726 14 10 if (exists $opts->{$k})
745 0 0 if $self->{'bayes_scanner'}
757 2 1 if $self->{'bayes_scanner'}
769 0 0 if $self->{'bayes_scanner'}
813 0 0 if (defined $opts and $opts->{'username'}) { }
818 0 0 if (defined $opts and $opts->{'user_dir'}) { }
823 0 0 if (defined $opts and $opts->{'userstate_dir'}) { }
830 0 0 if $self->{'bayes_scanner'}
831 0 0 if ($self->{'conf'}{'use_bayes'}) { }
835 0 0 if $self->{'bayes_scanner'}
841 0 0 unless $self->{'local_tests_only'}
842 0 0 if $self->{'bayes_scanner'} and $self->{'bayes_scanner'}->is_scan_available and $self->{'conf'}{'use_bayes_rules'}
899 0 0 if ($self->{'conf'}{'bayes_learn_during_report'})
1062 0 0 if ($#hdrs >= 0)
1100 0 0 if ($ct =~ m[^\s*multipart/mixed;\s+boundary\s*=\s*["']?(.+?)["']?(?:;|$)]i)
1112 0 0 unless $msg[$i] =~ /^--$boundary\r?$/ or $flag
1114 0 0 if ($msg[$i] =~ /^\s*$/)
1117 0 0 if ($ct =~ m[^(?:message/rfc822|text/plain);\s+x-spam-type=original] or $ct eq "message/rfc822" and $cd eq $self->{'conf'}{'encapsulated_content_description'})
1125 0 0 if ($msg[$i] =~ /^--$boundary/)
1126 0 0 $msg[$i - 1] =~ /\S/ ? :
1145 0 0 if ($msg[$i] =~ /^Content-Type:\s+(.+?)\s*$/i) { }
0 0 elsif ($msg[$i] =~ /^Content-Description:\s+(.+?)\s*$/i) { }
1174 0 0 if $hdrs =~ /^X-Spam-Prev-$header:/im
1177 0 0 if ($header eq 'Subject') { }
1198 0 0 if ($hdrs =~ /^X-Spam-Prev-Subject:\s*\(nonexistent\)$/m and not $hdrs =~ /^Subject:.*\(nonexistent\).*$/m)
1210 0 0 unless ($hdrs =~ s/^${name}[ \t]*.*\n(?:\s+\S.*\n)*/$hdr/m)
1221 0 0 if ($mail_obj->{'line_ending'} ne "\n")
1248 0 0 unless (open IN, "<$filename")
1256 0 0 unless defined $nread
1257 0 0 unless close IN
1291 0 0 unless ($src->load($username))
1374 0 1 if (defined $deal_with_userstate and $deal_with_userstate)
1376 0 0 if defined $v and not ref $v and $v =~ /__userstate__/
1385 0 0 if ($self->{'conf'}{$k} eq $v) { }
1425 0 1 if ($dsn ne "")
1426 0 0 if ($dsn =~ /^ldap:/i) { }
1434 0 1 if $self->{'bayes_scanner'}
1511 0 0 if $self->{'timer_enabled'}
1535 7 13 if ($self->{'bayes_scanner'})
1540 20 0 if $self->{'resolver'}
1551 0 0 unless $self->{'timer_enabled'}
1557 0 0 if $self->{'timer_enabled'}
1571 20 0 unless $self->{'timer_enabled'}
1574 0 0 unless (exists $self->{'timers'}{$name})
1585 20 0 unless $self->{'timer_enabled'}
1590 0 0 unless ($t->{'start'})
1599 0 0 if $dt < 0
1600 0 0 if (defined $t->{'elapsed'}) { }
1606 450 0 unless $self->{'timer_enabled'}
1620 0 0 if (defined $start and !defined($earliest) || $earliest > $start)
1624 0 0 if (defined $end and !defined($latest) || $latest < $end)
1627 0 0 if defined $start and not defined $end
1629 0 0 !(defined $latest && defined $earliest) ? :
1634 0 0 $total <= 0 || $elapsed >= $total ? :
1635 0 0 $elapsed >= 0.002 ? :
0 0 $elapsed >= 0.005 ? :
1649 62 36 if (defined $self->{'_initted'})
1651 0 62 if ($self->{'_initted'} != $$)
1653 0 0 unless $self->{'skip_prng_reseeding'}
1664 7 29 unless (defined $use_user_pref)
1668 24 12 unless (defined $self->{'config_text'})
1679 24 0 if ($siterules) { }
1686 24 0 if ($sysrules) { }
1693 24 0 if ($sysrules)
1695 0 24 if ($self->{'require_rules'} and not $cftext =~ /\S/)
1701 24 0 unless ($self->{'languages_filename'})
1705 24 0 if ($siterules and not $self->{'ignore_site_cf_files'})
1709 7 17 if ($use_user_pref != 0)
1716 6 1 unless ($self->{'dont_copy_prefs'})
1721 6 0 stat $fname ? :
1722 6 0 if ($stat_errn == 0 and -f _) { }
0 0 elsif ($stat_errn == 0) { }
0 0 elsif ($stat_errn != 2) { }
0 0 elsif (not $self->create_default_prefs($fname)) { }
1737 0 36 if ($self->{'pre_config_text'})
1740 2 34 if ($self->{'post_config_text'})
1744 0 36 unless ($self->{'config_text'} =~ /\S/)
1746 0 0 if ($self->{'require_rules'}) { }
1755 0 36 if (would_log("dbg", "config_text") > 1)
1765 0 36 if ($self->{'require_rules'} and not $self->{'conf'}->found_any_rules)
1770 23 13 if ($self->{'conf'}{'use_bayes'})
1778 1 35 unless $self->{'local_tests_only'}
1779 2 0 if $self->{'bayes_scanner'} and $self->{'bayes_scanner'}->is_scan_available and $self->{'conf'}{'use_bayes_rules'}
1782 0 36 if ($self->{'only_these_rules'})
1786 36 0 unless ($self->{'timer_enabled'})
1790 0 187 if ($hf_ref->[1] =~ /_TIMING_/)
1813 0 103 unless defined $allpaths
1820 102 1 stat $path ? :
1821 1 102 if ($stat_errn == 2) { }
0 102 elsif ($stat_errn != 0) { }
96 6 elsif (-d _) { }
0 12 elsif (-f _ and -s _ and -r _) { }
1843 605 0 if (open IN, '<' . $path) { }
1847 0 605 unless defined $nread
1848 0 605 unless close IN
1871 0 7 if (defined $dir) { }
6 1 elsif (defined $self->{'userstate_dir'}) { }
0 1 elsif (defined $self->{'user_dir'}) { }
1887 6 1 unless ($self->{'dont_copy_prefs'})
1894 7 0 stat $fname ? :
1895 0 7 if ($stat_errn == 0 and not -d _) { }
0 7 elsif ($stat_errn != 0 and $stat_errn != 2) { }
1902 0 7 unless (eval {
1903 0 0 $@ ne '' ? :
1942 0 0 if ($self->{'dont_copy_prefs'})
1950 0 0 stat $fname ? :
1951 0 0 if ($stat_errn == 0) { }
0 0 elsif ($stat_errn != 2) { }
1966 0 0 if (not defined $defprefs) { }
0 0 elsif (not open(IN, "<$defprefs")) { }
0 0 elsif (not open(OUT, ">$fname")) { }
1977 0 0 unless print OUT $inbuf
1979 0 0 unless defined $nread
1981 0 0 unless close OUT
1982 0 0 unless close IN
1984 0 0 if ($< == 0 and $> == 0 and defined $user)
1986 0 0 unless (chown $uid, $gid, $fname)
2004 0 1 if (am_running_on_windows()) { }
2007 0 0 if $userprofile and $userprofile =~ m(^[a-z]\:[/\\])io
2008 0 0 if $userprofile =~ /^\\\\/o
2010 0 0 if $home and $home =~ m(^[a-z]\:[/\\])io
2011 0 0 if $home =~ /^\\\\/o
2015 1 0 if $home and $home =~ m[/]o
2016 0 0 if $name ne ""
2023 0 119 unless defined $path
2025 50 69 if (exists $self->{'conf'}{'sed_path_cache'}{$path})
2031 0 0 unless $self->{'LOCAL_RULES_DIR'}
2032 0 25 unless $self->{'LOCAL_STATE_DIR'}
2033 0 25 unless $self->{'DEF_RULES_DIR'}
2034 0 0 unless $self->{'PREFIX'} or $Mail::SpamAssassin::Config{'prefix'}
2035 0 0 unless $self->get_and_create_userstate_dir
2047 0 0 unless $] =~ /^(\d\.\d\d\d)/
2056 54 0 if (defined $path)
2057 25 29 stat $path ? :
2058 29 25 if ($errn == 2) { }
0 25 elsif ($errn) { }
2081 0 96 if ($self->{'config_tree_recurse'}) { }
2092 0 0 unless (eval " use File::Find qw();\n File::Find::find(\n { untaint => 1,\n follow => 1,\n wanted =>\n sub { push(\@cfs, \$File::Find::name) if /\\.\\Q\$type\\E\$/i && -f \$_ }\n }, \$dir); 1;\n ")
2093 0 0 $@ ne '' ? :
2100 0 96 unless opendir SA_CF_DIR, $dir
2101 605 709 if $_ ne "." and $_ ne ".." and /\.$type$/i
2115 0 176 unless $self->{'plugins'}
2125 0 2119 unless $self->{'plugins'}
2128 36 2083 if ($subname eq "finish_parsing_end")
2153 0 0 if ($#hdrs < 0)
2167 0 0 if defined $done{$_}
2189 10 127 if defined $seen{$addr}
2238 0 0 unless (defined $source and ref $source eq "HASH" or defined $dest and ref $dest eq "HASH")
2248 0 0 if (defined $source) { }