Branch Coverage

blib/lib/Mail/SpamAssassin.pm
Criterion Covered Total %
branch 106 338 31.3


line true false branch
392 0 25 unless (defined $self)
397 0 25 if ($self->{'debug'} and $self->{'debug'} eq '1')
419 0 25 if (defined $ntags)
420 0 0 ref $ntags ? :
421 0 0 if $t =~ /^(NO)?(.+)\z/is
425 0 25 if (would_log('dbg', 'timing') or $self->{'needed_tags'}{'TIMING'})
438 25 0 unless (defined $self->{'username'})
455 0 25 if ($m eq 'win32') { }
0 25 elsif ($m eq 'flock') { }
0 25 elsif ($m eq 'nfssafe') { }
460 0 25 if (am_running_on_windows()) { }
473 0 25 unless (eval "\n use Mail::SpamAssassin::Locker::" . $class . ";\n \$self->{locker} = new Mail::SpamAssassin::Locker::" . $class . " (\$self);\n 1;\n ")
474 0 0 $@ ne '' ? :
478 0 25 if (not defined $self->{'locker'})
532 1 0 if (ref $suppl_attrib and exists $suppl_attrib->{'master_deadline'})
536 31 0 if ($self->{'conf'}{'time_limit'})
538 31 0 if (not defined $master_deadline or $time_limit_deadline < $master_deadline)
542 31 0 if (defined $master_deadline)
583 0 12 if $self->{'timer_enabled'}
648 0 2 if ($forget) { }
0 2 elsif ($isspam) { }
725 14 10 if (exists $opts->{$k})
744 0 0 if $self->{'bayes_scanner'}
756 2 1 if $self->{'bayes_scanner'}
768 0 0 if $self->{'bayes_scanner'}
812 0 0 if (defined $opts and $opts->{'username'}) { }
817 0 0 if (defined $opts and $opts->{'user_dir'}) { }
822 0 0 if (defined $opts and $opts->{'userstate_dir'}) { }
829 0 0 if $self->{'bayes_scanner'}
830 0 0 if ($self->{'conf'}{'use_bayes'}) { }
834 0 0 if $self->{'bayes_scanner'}
840 0 0 unless $self->{'local_tests_only'}
841 0 0 if $self->{'bayes_scanner'} and $self->{'bayes_scanner'}->is_scan_available and $self->{'conf'}{'use_bayes_rules'}
898 0 0 if ($self->{'conf'}{'bayes_learn_during_report'})
1061 0 0 if ($#hdrs >= 0)
1099 0 0 if ($ct =~ m[^\s*multipart/mixed;\s+boundary\s*=\s*["']?(.+?)["']?(?:;|$)]i)
1111 0 0 unless $msg[$i] =~ /^--$boundary\r?$/ or $flag
1113 0 0 if ($msg[$i] =~ /^\s*$/)
1116 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'})
1124 0 0 if ($msg[$i] =~ /^--$boundary/)
1125 0 0 $msg[$i - 1] =~ /\S/ ? :
1144 0 0 if ($msg[$i] =~ /^Content-Type:\s+(.+?)\s*$/i) { }
0 0 elsif ($msg[$i] =~ /^Content-Description:\s+(.+?)\s*$/i) { }
1173 0 0 if $hdrs =~ /^X-Spam-Prev-$header:/im
1176 0 0 if ($header eq 'Subject') { }
1197 0 0 if ($hdrs =~ /^X-Spam-Prev-Subject:\s*\(nonexistent\)$/m and not $hdrs =~ /^Subject:.*\(nonexistent\).*$/m)
1209 0 0 unless ($hdrs =~ s/^${name}[ \t]*.*\n(?:\s+\S.*\n)*/$hdr/m)
1220 0 0 if ($mail_obj->{'line_ending'} ne "\n")
1247 0 0 unless (open IN, "<$filename")
1255 0 0 unless defined $nread
1256 0 0 unless close IN
1290 0 0 unless ($src->load($username))
1373 0 1 if (defined $deal_with_userstate and $deal_with_userstate)
1375 0 0 if defined $v and not ref $v and $v =~ /__userstate__/
1384 0 0 if ($self->{'conf'}{$k} eq $v) { }
1424 0 1 if ($dsn ne '')
1425 0 0 if ($dsn =~ /^ldap:/i) { }
1433 0 1 if $self->{'bayes_scanner'}
1510 0 0 if $self->{'timer_enabled'}
1534 7 1 if ($self->{'bayes_scanner'})
1539 8 0 if $self->{'resolver'}
1550 0 0 unless $self->{'timer_enabled'}
1556 0 0 if $self->{'timer_enabled'}
1570 8 0 unless $self->{'timer_enabled'}
1573 0 0 unless (exists $self->{'timers'}{$name})
1584 8 0 unless $self->{'timer_enabled'}
1589 0 0 unless ($t->{'start'})
1598 0 0 if $dt < 0
1599 0 0 if (defined $t->{'elapsed'}) { }
1605 354 0 unless $self->{'timer_enabled'}
1619 0 0 if (defined $start and !defined($earliest) || $earliest > $start)
1623 0 0 if (defined $end and !defined($latest) || $latest < $end)
1626 0 0 if defined $start and not defined $end
1628 0 0 !(defined $latest && defined $earliest) ? :
1633 0 0 $total <= 0 || $elapsed >= $total ? :
1634 0 0 $elapsed >= 0.002 ? :
0 0 $elapsed >= 0.005 ? :
1648 49 24 if (defined $self->{'_initted'})
1650 0 49 if ($self->{'_initted'} != $$)
1652 0 0 unless $self->{'skip_prng_reseeding'}
1663 7 17 unless (defined $use_user_pref)
1667 24 0 unless (defined $self->{'config_text'})
1678 24 0 if ($siterules) { }
1685 24 0 if ($sysrules) { }
1692 24 0 if ($sysrules)
1694 0 24 if ($self->{'require_rules'} and not $cftext =~ /\S/)
1700 24 0 unless ($self->{'languages_filename'})
1704 24 0 if ($siterules and not $self->{'ignore_site_cf_files'})
1708 7 17 if ($use_user_pref != 0)
1715 6 1 unless ($self->{'dont_copy_prefs'})
1720 6 0 stat $fname ? :
1721 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)) { }
1736 0 24 if ($self->{'pre_config_text'})
1739 2 22 if ($self->{'post_config_text'})
1743 0 24 unless ($self->{'config_text'} =~ /\S/)
1745 0 0 if ($self->{'require_rules'}) { }
1754 0 24 if (would_log('dbg', 'config_text') > 1)
1764 0 24 if ($self->{'require_rules'} and not $self->{'conf'}->found_any_rules)
1769 23 1 if ($self->{'conf'}{'use_bayes'})
1777 1 23 unless $self->{'local_tests_only'}
1778 2 0 if $self->{'bayes_scanner'} and $self->{'bayes_scanner'}->is_scan_available and $self->{'conf'}{'use_bayes_rules'}
1781 0 24 if ($self->{'only_these_rules'})
1785 24 0 unless ($self->{'timer_enabled'})
1789 0 163 if ($hf_ref->[1] =~ /_TIMING_/)
1812 0 103 unless defined $allpaths
1819 102 1 stat $path ? :
1820 1 102 if ($stat_errn == 2) { }
0 102 elsif ($stat_errn != 0) { }
94 8 elsif (-d _) { }
0 14 elsif (-f _ and -s _ and -r _) { }
1842 545 0 if (open IN, '<' . $path) { }
1846 0 545 unless defined $nread
1847 0 545 unless close IN
1870 0 7 if (defined $dir) { }
6 1 elsif (defined $self->{'userstate_dir'}) { }
0 1 elsif (defined $self->{'user_dir'}) { }
1886 6 1 unless ($self->{'dont_copy_prefs'})
1893 7 0 stat $fname ? :
1894 0 7 if ($stat_errn == 0 and not -d _) { }
0 7 elsif ($stat_errn != 0 and $stat_errn != 2) { }
1901 0 7 unless (eval { do { mkpath($fname, 0, 448); 1 } })
1902 0 0 $@ ne '' ? :
1941 0 0 if ($self->{'dont_copy_prefs'})
1949 0 0 stat $fname ? :
1950 0 0 if ($stat_errn == 0) { }
0 0 elsif ($stat_errn != 2) { }
1965 0 0 if (not defined $defprefs) { }
0 0 elsif (not open(IN, "<$defprefs")) { }
0 0 elsif (not open(OUT, ">$fname")) { }
1976 0 0 unless print OUT $inbuf
1978 0 0 unless defined $nread
1980 0 0 unless close OUT
1981 0 0 unless close IN
1983 0 0 if ($< == 0 and $> == 0 and defined $user)
1985 0 0 unless (chown $uid, $gid, $fname)
2003 0 1 if (am_running_on_windows()) { }
2006 0 0 if $userprofile and $userprofile =~ m(^[a-z]\:[/\\])io
2007 0 0 if $userprofile =~ /^\\\\/o
2009 0 0 if $home and $home =~ m(^[a-z]\:[/\\])io
2010 0 0 if $home =~ /^\\\\/o
2014 1 0 if $home and $home =~ m[/]o
2015 0 0 if $name ne ''
2022 0 115 unless defined $path
2024 48 67 if (exists $self->{'conf'}{'sed_path_cache'}{$path})
2030 0 0 unless $self->{'LOCAL_RULES_DIR'}
2031 0 25 unless $self->{'LOCAL_STATE_DIR'}
2032 0 25 unless $self->{'DEF_RULES_DIR'}
2033 0 0 unless $self->{'PREFIX'} or $Mail::SpamAssassin::Config{'prefix'}
2034 0 0 unless $self->get_and_create_userstate_dir
2046 0 0 unless $] =~ /^(\d\.\d\d\d)/
2055 54 0 if (defined $path)
2056 25 29 stat $path ? :
2057 29 25 if ($errn == 2) { }
0 25 elsif ($errn) { }
2080 0 94 if ($self->{'config_tree_recurse'}) { }
2091 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 ")
2092 0 0 $@ ne '' ? :
2099 0 94 unless opendir SA_CF_DIR, $dir
2100 545 639 if $_ ne '.' and $_ ne '..' and /\.$type$/i
2114 0 133 unless $self->{'plugins'}
2123 0 1947 unless $self->{'plugins'}
2144 0 0 if ($#hdrs < 0)
2158 0 0 if defined $done{$_}
2180 10 124 if defined $seen{$addr}
2229 0 0 unless (defined $source and ref $source eq 'HASH' or defined $dest and ref $dest eq 'HASH')
2239 0 0 if (defined $source) { }