Branch Coverage

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


line true false branch
392 0 36 unless (defined $self)
397 0 36 if ($self->{'debug'} and $self->{'debug'} eq '1')
419 0 36 if (defined $ntags)
420 0 0 ref $ntags ? :
421 0 0 if $t =~ /^(NO)?(.+)\z/is
425 0 36 if (would_log('dbg', 'timing') or $self->{'needed_tags'}{'TIMING'})
437 36 0 unless (defined $self->{'username'})
454 0 36 if ($m eq 'win32') { }
0 36 elsif ($m eq 'flock') { }
0 36 elsif ($m eq 'nfssafe') { }
459 0 36 if (am_running_on_windows()) { }
472 0 36 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 36 if (not defined $self->{'locker'})
531 1 0 if (ref $suppl_attrib and exists $suppl_attrib->{'master_deadline'})
535 43 0 if ($self->{'conf'}{'time_limit'})
537 43 0 if (not defined $master_deadline or $time_limit_deadline < $master_deadline)
541 43 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 447 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 61 35 if (defined $self->{'_initted'})
1651 0 61 if ($self->{'_initted'} != $$)
1653 0 0 unless $self->{'skip_prng_reseeding'}
1664 7 28 unless (defined $use_user_pref)
1668 23 12 unless (defined $self->{'config_text'})
1679 23 0 if ($siterules) { }
1686 23 0 if ($sysrules) { }
1693 23 0 if ($sysrules)
1695 0 23 if ($self->{'require_rules'} and not $cftext =~ /\S/)
1701 23 0 unless ($self->{'languages_filename'})
1705 23 0 if ($siterules and not $self->{'ignore_site_cf_files'})
1709 7 16 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 35 if ($self->{'pre_config_text'})
1740 2 33 if ($self->{'post_config_text'})
1744 0 35 unless ($self->{'config_text'} =~ /\S/)
1746 0 0 if ($self->{'require_rules'}) { }
1755 0 35 if (would_log('dbg', 'config_text') > 1)
1765 0 35 if ($self->{'require_rules'} and not $self->{'conf'}->found_any_rules)
1770 22 13 if ($self->{'conf'}{'use_bayes'})
1778 1 34 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 35 if ($self->{'only_these_rules'})
1786 35 0 unless ($self->{'timer_enabled'})
1790 0 180 if ($hf_ref->[1] =~ /_TIMING_/)
1813 0 99 unless defined $allpaths
1820 98 1 stat $path ? :
1821 1 98 if ($stat_errn == 2) { }
0 98 elsif ($stat_errn != 0) { }
92 6 elsif (-d _) { }
0 12 elsif (-f _ and -s _ and -r _) { }
1843 580 0 if (open IN, '<' . $path) { }
1847 0 580 unless defined $nread
1848 0 580 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 { do { mkpath($fname, 0, 448); 1 } })
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 117 unless defined $path
2025 50 67 if (exists $self->{'conf'}{'sed_path_cache'}{$path})
2031 0 0 unless $self->{'LOCAL_RULES_DIR'}
2032 0 24 unless $self->{'LOCAL_STATE_DIR'}
2033 0 24 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 52 0 if (defined $path)
2057 24 28 stat $path ? :
2058 28 24 if ($errn == 2) { }
0 24 elsif ($errn) { }
2081 0 92 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 92 unless opendir SA_CF_DIR, $dir
2101 580 680 if $_ ne '.' and $_ ne '..' and /\.$type$/i
2115 0 176 unless $self->{'plugins'}
2125 0 2114 unless $self->{'plugins'}
2128 35 2079 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) { }