Branch Coverage

lib/Mail/SpamAssassin.pm
Criterion Covered Total %
branch 115 338 34.0


line true false branch
394 0 56 unless (defined $self)
399 0 56 if ($self->{'debug'} and $self->{'debug'} eq '1')
421 0 56 if (defined $ntags)
422 0 0 ref $ntags ? :
423 0 0 if $t =~ /^(NO)?(.+)\z/is
427 0 56 if (would_log('dbg', 'timing') or $self->{'needed_tags'}{'TIMING'})
440 56 0 unless (defined $self->{'username'})
457 0 56 if ($m eq 'win32') { }
0 56 elsif ($m eq 'flock') { }
0 56 elsif ($m eq 'nfssafe') { }
462 0 56 if (am_running_on_windows()) { }
475 0 56 unless (eval "\n use Mail::SpamAssassin::Locker::" . $class . ";\n \$self->{locker} = new Mail::SpamAssassin::Locker::" . $class . " (\$self);\n 1;\n ")
476 0 0 $@ ne '' ? :
480 0 56 if (not defined $self->{'locker'})
534 48 0 if (ref $suppl_attrib and exists $suppl_attrib->{'master_deadline'})
538 102 0 if ($self->{'conf'}{'time_limit'})
540 102 0 if (not defined $master_deadline or $time_limit_deadline < $master_deadline)
544 102 0 if (defined $master_deadline)
585 0 34 if $self->{'timer_enabled'}
650 0 0 if ($forget) { }
0 0 elsif ($isspam) { }
727 0 0 if (exists $opts->{$k})
746 0 0 if $self->{'bayes_scanner'}
758 1 0 if $self->{'bayes_scanner'}
770 0 0 if $self->{'bayes_scanner'}
814 2 0 if (defined $opts and $opts->{'username'}) { }
819 2 0 if (defined $opts and $opts->{'user_dir'}) { }
824 0 2 if (defined $opts and $opts->{'userstate_dir'}) { }
831 1 1 if $self->{'bayes_scanner'}
832 1 1 if ($self->{'conf'}{'use_bayes'}) { }
836 1 0 if $self->{'bayes_scanner'}
842 0 2 unless $self->{'local_tests_only'}
843 0 0 if $self->{'bayes_scanner'} and $self->{'bayes_scanner'}->is_scan_available and $self->{'conf'}{'use_bayes_rules'}
900 0 0 if ($self->{'conf'}{'bayes_learn_during_report'})
1063 0 0 if ($#hdrs >= 0)
1101 0 0 if ($ct =~ m[^\s*multipart/mixed;\s+boundary\s*=\s*["']?(.+?)["']?(?:;|$)]i)
1113 0 0 unless $msg[$i] =~ /^--$boundary\r?$/ or $flag
1115 0 0 if ($msg[$i] =~ /^\s*$/)
1118 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'})
1126 0 0 if ($msg[$i] =~ /^--$boundary/)
1127 0 0 $msg[$i - 1] =~ /\S/ ? :
1146 0 0 if ($msg[$i] =~ /^Content-Type:\s+(.+?)\s*$/i) { }
0 0 elsif ($msg[$i] =~ /^Content-Description:\s+(.+?)\s*$/i) { }
1175 0 0 if $hdrs =~ /^X-Spam-Prev-$header:/im
1178 0 0 if ($header eq 'Subject') { }
1199 0 0 if ($hdrs =~ /^X-Spam-Prev-Subject:\s*\(nonexistent\)$/m and not $hdrs =~ /^Subject:.*\(nonexistent\).*$/m)
1211 0 0 unless ($hdrs =~ s/^${name}[ \t]*.*\n(?:\s+\S.*\n)*/$hdr/m)
1222 0 0 if ($mail_obj->{'line_ending'} ne "\n")
1249 2 0 unless (open IN, "<$filename")
1257 0 0 unless defined $nread
1258 0 0 unless close IN
1292 0 0 unless ($src->load($username))
1375 1 0 if (defined $deal_with_userstate and $deal_with_userstate)
1377 1 112 if defined $v and not ref $v and $v =~ /__userstate__/
1386 0 1 if ($self->{'conf'}{$k} eq $v) { }
1426 0 1 if ($dsn ne '')
1427 0 0 if ($dsn =~ /^ldap:/i) { }
1435 1 0 if $self->{'bayes_scanner'}
1512 0 47 if $self->{'timer_enabled'}
1536 32 0 if ($self->{'bayes_scanner'})
1541 32 0 if $self->{'resolver'}
1552 0 0 unless $self->{'timer_enabled'}
1558 0 0 if $self->{'timer_enabled'}
1572 32 0 unless $self->{'timer_enabled'}
1575 0 0 unless (exists $self->{'timers'}{$name})
1586 32 0 unless $self->{'timer_enabled'}
1591 0 0 unless ($t->{'start'})
1600 0 0 if $dt < 0
1601 0 0 if (defined $t->{'elapsed'}) { }
1607 885 0 unless $self->{'timer_enabled'}
1621 0 0 if (defined $start and !defined($earliest) || $earliest > $start)
1625 0 0 if (defined $end and !defined($latest) || $latest < $end)
1628 0 0 if defined $start and not defined $end
1630 0 0 !(defined $latest && defined $earliest) ? :
1635 0 0 $total <= 0 || $elapsed >= $total ? :
1636 0 0 $elapsed >= 0.002 ? :
0 0 $elapsed >= 0.005 ? :
1650 150 55 if (defined $self->{'_initted'})
1652 0 150 if ($self->{'_initted'} != $$)
1654 0 0 unless $self->{'skip_prng_reseeding'}
1665 15 40 unless (defined $use_user_pref)
1669 55 0 unless (defined $self->{'config_text'})
1680 55 0 if ($siterules) { }
1687 55 0 if ($sysrules) { }
1694 55 0 if ($sysrules)
1696 0 55 if ($self->{'require_rules'} and not $cftext =~ /\S/)
1702 55 0 unless ($self->{'languages_filename'})
1706 55 0 if ($siterules and not $self->{'ignore_site_cf_files'})
1710 50 5 if ($use_user_pref != 0)
1717 1 49 unless ($self->{'dont_copy_prefs'})
1722 1 0 stat $fname ? :
1723 1 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)) { }
1738 0 55 if ($self->{'pre_config_text'})
1741 0 55 if ($self->{'post_config_text'})
1745 0 55 unless ($self->{'config_text'} =~ /\S/)
1747 0 0 if ($self->{'require_rules'}) { }
1756 0 55 if (would_log('dbg', 'config_text') > 1)
1766 0 55 if ($self->{'require_rules'} and not $self->{'conf'}->found_any_rules)
1771 40 15 if ($self->{'conf'}{'use_bayes'})
1779 0 55 unless $self->{'local_tests_only'}
1780 0 0 if $self->{'bayes_scanner'} and $self->{'bayes_scanner'}->is_scan_available and $self->{'conf'}{'use_bayes_rules'}
1783 0 55 if ($self->{'only_these_rules'})
1787 55 0 unless ($self->{'timer_enabled'})
1791 0 438 if ($hf_ref->[1] =~ /_TIMING_/)
1814 0 270 unless defined $allpaths
1821 254 16 stat $path ? :
1822 16 254 if ($stat_errn == 2) { }
0 254 elsif ($stat_errn != 0) { }
188 66 elsif (-d _) { }
32 68 elsif (-f _ and -s _ and -r _) { }
1844 960 0 if (open IN, '<' . $path) { }
1848 0 960 unless defined $nread
1849 0 960 unless close IN
1872 0 50 if (defined $dir) { }
34 16 elsif (defined $self->{'userstate_dir'}) { }
0 16 elsif (defined $self->{'user_dir'}) { }
1888 1 49 unless ($self->{'dont_copy_prefs'})
1895 50 0 stat $fname ? :
1896 0 50 if ($stat_errn == 0 and not -d _) { }
0 50 elsif ($stat_errn != 0 and $stat_errn != 2) { }
1903 0 50 unless (eval { do { mkpath($fname, 0, 448); 1 } })
1904 0 0 $@ ne '' ? :
1943 0 0 if ($self->{'dont_copy_prefs'})
1951 0 0 stat $fname ? :
1952 0 0 if ($stat_errn == 0) { }
0 0 elsif ($stat_errn != 2) { }
1967 0 0 if (not defined $defprefs) { }
0 0 elsif (not open(IN, "<$defprefs")) { }
0 0 elsif (not open(OUT, ">$fname")) { }
1978 0 0 unless print OUT $inbuf
1980 0 0 unless defined $nread
1982 0 0 unless close OUT
1983 0 0 unless close IN
1985 0 0 if ($< == 0 and $> == 0 and defined $user)
1987 0 0 unless (chown $uid, $gid, $fname)
2005 0 16 if (am_running_on_windows()) { }
2008 0 0 if $userprofile and $userprofile =~ m(^[a-z]\:[/\\])io
2009 0 0 if $userprofile =~ /^\\\\/o
2011 0 0 if $home and $home =~ m(^[a-z]\:[/\\])io
2012 0 0 if $home =~ /^\\\\/o
2016 16 0 if $home and $home =~ m[/]o
2017 0 0 if $name ne ''
2024 0 136 unless defined $path
2026 0 136 if (exists $self->{'conf'}{'sed_path_cache'}{$path})
2032 0 0 unless $self->{'LOCAL_RULES_DIR'}
2033 0 1 unless $self->{'LOCAL_STATE_DIR'}
2034 0 1 unless $self->{'DEF_RULES_DIR'}
2035 0 0 unless $self->{'PREFIX'} or $Mail::SpamAssassin::Config{'prefix'}
2036 0 0 unless $self->get_and_create_userstate_dir
2048 0 0 unless $] =~ /^(\d\.\d\d\d)/
2057 133 0 if (defined $path)
2058 71 62 stat $path ? :
2059 62 71 if ($errn == 2) { }
0 71 elsif ($errn) { }
2082 4 184 if ($self->{'config_tree_recurse'}) { }
2093 0 4 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 ")
2094 0 0 $@ ne '' ? :
2101 0 184 unless opendir SA_CF_DIR, $dir
2102 905 1123 if $_ ne '.' and $_ ne '..' and /\.$type$/i
2116 0 415 unless $self->{'plugins'}
2125 0 3467 unless $self->{'plugins'}
2146 0 0 if ($#hdrs < 0)
2160 0 0 if defined $done{$_}
2182 0 2 if defined $seen{$addr}
2231 0 1 unless (defined $source and ref $source eq 'HASH' or defined $dest and ref $dest eq 'HASH')
2241 2 1 if (defined $source) { }