Branch Coverage

lib/Mail/SpamAssassin.pm
Criterion Covered Total %
branch 117 340 34.4


line true false branch
394 0 55 unless (defined $self)
399 0 55 if ($self->{'debug'} and $self->{'debug'} eq '1')
421 0 55 if (defined $ntags)
422 0 0 ref $ntags ? :
423 0 0 if $t =~ /^(NO)?(.+)\z/is
427 0 55 if (would_log('dbg', 'timing') or $self->{'needed_tags'}{'TIMING'})
439 55 0 unless (defined $self->{'username'})
456 0 55 if ($m eq 'win32') { }
0 55 elsif ($m eq 'flock') { }
0 55 elsif ($m eq 'nfssafe') { }
461 0 55 if (am_running_on_windows()) { }
474 0 55 unless (eval "\n use Mail::SpamAssassin::Locker::" . $class . ";\n \$self->{locker} = new Mail::SpamAssassin::Locker::" . $class . " (\$self);\n 1;\n ")
475 0 0 $@ ne '' ? :
479 0 55 if (not defined $self->{'locker'})
533 48 0 if (ref $suppl_attrib and exists $suppl_attrib->{'master_deadline'})
537 102 0 if ($self->{'conf'}{'time_limit'})
539 102 0 if (not defined $master_deadline or $time_limit_deadline < $master_deadline)
543 102 0 if (defined $master_deadline)
586 0 34 if $self->{'timer_enabled'}
651 0 0 if ($forget) { }
0 0 elsif ($isspam) { }
728 0 0 if (exists $opts->{$k})
747 0 0 if $self->{'bayes_scanner'}
759 1 0 if $self->{'bayes_scanner'}
771 0 0 if $self->{'bayes_scanner'}
815 2 0 if (defined $opts and $opts->{'username'}) { }
820 2 0 if (defined $opts and $opts->{'user_dir'}) { }
825 0 2 if (defined $opts and $opts->{'userstate_dir'}) { }
832 1 1 if $self->{'bayes_scanner'}
833 1 1 if ($self->{'conf'}{'use_bayes'}) { }
837 1 0 if $self->{'bayes_scanner'}
843 0 2 unless $self->{'local_tests_only'}
844 0 0 if $self->{'bayes_scanner'} and $self->{'bayes_scanner'}->is_scan_available and $self->{'conf'}{'use_bayes_rules'}
901 0 0 if ($self->{'conf'}{'bayes_learn_during_report'})
1064 0 0 if ($#hdrs >= 0)
1102 0 0 if ($ct =~ m[^\s*multipart/mixed;\s+boundary\s*=\s*["']?(.+?)["']?(?:;|$)]i)
1114 0 0 unless $msg[$i] =~ /^--$boundary\r?$/ or $flag
1116 0 0 if ($msg[$i] =~ /^\s*$/)
1119 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'})
1127 0 0 if ($msg[$i] =~ /^--$boundary/)
1128 0 0 $msg[$i - 1] =~ /\S/ ? :
1147 0 0 if ($msg[$i] =~ /^Content-Type:\s+(.+?)\s*$/i) { }
0 0 elsif ($msg[$i] =~ /^Content-Description:\s+(.+?)\s*$/i) { }
1176 0 0 if $hdrs =~ /^X-Spam-Prev-$header:/im
1179 0 0 if ($header eq 'Subject') { }
1200 0 0 if ($hdrs =~ /^X-Spam-Prev-Subject:\s*\(nonexistent\)$/m and not $hdrs =~ /^Subject:.*\(nonexistent\).*$/m)
1212 0 0 unless ($hdrs =~ s/^${name}[ \t]*.*\n(?:\s+\S.*\n)*/$hdr/m)
1223 0 0 if ($mail_obj->{'line_ending'} ne "\n")
1250 2 0 unless (open IN, "<$filename")
1258 0 0 unless defined $nread
1259 0 0 unless close IN
1293 0 0 unless ($src->load($username))
1376 1 0 if (defined $deal_with_userstate and $deal_with_userstate)
1378 1 113 if defined $v and not ref $v and $v =~ /__userstate__/
1387 0 1 if ($self->{'conf'}{$k} eq $v) { }
1427 0 1 if ($dsn ne '')
1428 0 0 if ($dsn =~ /^ldap:/i) { }
1436 1 0 if $self->{'bayes_scanner'}
1513 0 47 if $self->{'timer_enabled'}
1537 32 0 if ($self->{'bayes_scanner'})
1542 32 0 if $self->{'resolver'}
1553 0 0 unless $self->{'timer_enabled'}
1559 0 0 if $self->{'timer_enabled'}
1573 32 0 unless $self->{'timer_enabled'}
1576 0 0 unless (exists $self->{'timers'}{$name})
1587 32 0 unless $self->{'timer_enabled'}
1592 0 0 unless ($t->{'start'})
1601 0 0 if $dt < 0
1602 0 0 if (defined $t->{'elapsed'}) { }
1608 850 0 unless $self->{'timer_enabled'}
1622 0 0 if (defined $start and !defined($earliest) || $earliest > $start)
1626 0 0 if (defined $end and !defined($latest) || $latest < $end)
1629 0 0 if defined $start and not defined $end
1631 0 0 !(defined $latest && defined $earliest) ? :
1636 0 0 $total <= 0 || $elapsed >= $total ? :
1637 0 0 $elapsed >= 0.002 ? :
0 0 $elapsed >= 0.005 ? :
1651 150 55 if (defined $self->{'_initted'})
1653 0 150 if ($self->{'_initted'} != $$)
1655 0 0 unless $self->{'skip_prng_reseeding'}
1666 15 40 unless (defined $use_user_pref)
1670 55 0 unless (defined $self->{'config_text'})
1681 55 0 if ($siterules) { }
1688 55 0 if ($sysrules) { }
1695 55 0 if ($sysrules)
1697 0 55 if ($self->{'require_rules'} and not $cftext =~ /\S/)
1703 55 0 unless ($self->{'languages_filename'})
1707 55 0 if ($siterules and not $self->{'ignore_site_cf_files'})
1711 50 5 if ($use_user_pref != 0)
1718 1 49 unless ($self->{'dont_copy_prefs'})
1723 1 0 stat $fname ? :
1724 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)) { }
1739 0 55 if ($self->{'pre_config_text'})
1742 0 55 if ($self->{'post_config_text'})
1746 0 55 unless ($self->{'config_text'} =~ /\S/)
1748 0 0 if ($self->{'require_rules'}) { }
1757 0 55 if (would_log('dbg', 'config_text') > 1)
1767 0 55 if ($self->{'require_rules'} and not $self->{'conf'}->found_any_rules)
1772 40 15 if ($self->{'conf'}{'use_bayes'})
1780 0 55 unless $self->{'local_tests_only'}
1781 0 0 if $self->{'bayes_scanner'} and $self->{'bayes_scanner'}->is_scan_available and $self->{'conf'}{'use_bayes_rules'}
1784 0 55 if ($self->{'only_these_rules'})
1788 55 0 unless ($self->{'timer_enabled'})
1792 0 433 if ($hf_ref->[1] =~ /_TIMING_/)
1815 0 270 unless defined $allpaths
1822 254 16 stat $path ? :
1823 16 254 if ($stat_errn == 2) { }
0 254 elsif ($stat_errn != 0) { }
188 66 elsif (-d _) { }
32 68 elsif (-f _ and -s _ and -r _) { }
1845 1052 0 if (open IN, '<' . $path) { }
1849 0 1052 unless defined $nread
1850 0 1052 unless close IN
1873 0 50 if (defined $dir) { }
34 16 elsif (defined $self->{'userstate_dir'}) { }
0 16 elsif (defined $self->{'user_dir'}) { }
1889 1 49 unless ($self->{'dont_copy_prefs'})
1896 50 0 stat $fname ? :
1897 0 50 if ($stat_errn == 0 and not -d _) { }
0 50 elsif ($stat_errn != 0 and $stat_errn != 2) { }
1904 0 50 unless (eval { do { mkpath($fname, 0, 448); 1 } })
1905 0 0 $@ ne '' ? :
1944 0 0 if ($self->{'dont_copy_prefs'})
1952 0 0 stat $fname ? :
1953 0 0 if ($stat_errn == 0) { }
0 0 elsif ($stat_errn != 2) { }
1968 0 0 if (not defined $defprefs) { }
0 0 elsif (not open(IN, "<$defprefs")) { }
0 0 elsif (not open(OUT, ">$fname")) { }
1979 0 0 unless print OUT $inbuf
1981 0 0 unless defined $nread
1983 0 0 unless close OUT
1984 0 0 unless close IN
1986 0 0 if ($< == 0 and $> == 0 and defined $user)
1988 0 0 unless (chown $uid, $gid, $fname)
2006 0 16 if (am_running_on_windows()) { }
2009 0 0 if $userprofile and $userprofile =~ m(^[a-z]\:[/\\])io
2010 0 0 if $userprofile =~ /^\\\\/o
2012 0 0 if $home and $home =~ m(^[a-z]\:[/\\])io
2013 0 0 if $home =~ /^\\\\/o
2017 16 0 if $home and $home =~ m[/]o
2018 0 0 if $name ne ''
2025 0 136 unless defined $path
2027 0 136 if (exists $self->{'conf'}{'sed_path_cache'}{$path})
2033 0 0 unless $self->{'LOCAL_RULES_DIR'}
2034 0 1 unless $self->{'LOCAL_STATE_DIR'}
2035 0 1 unless $self->{'DEF_RULES_DIR'}
2036 0 0 unless $self->{'PREFIX'} or $Mail::SpamAssassin::Config{'prefix'}
2037 0 0 unless $self->get_and_create_userstate_dir
2049 0 0 unless $] =~ /^(\d\.\d\d\d)/
2058 133 0 if (defined $path)
2059 71 62 stat $path ? :
2060 62 71 if ($errn == 2) { }
0 71 elsif ($errn) { }
2083 4 184 if ($self->{'config_tree_recurse'}) { }
2094 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 ")
2095 0 0 $@ ne '' ? :
2102 0 184 unless opendir SA_CF_DIR, $dir
2103 995 1225 if $_ ne '.' and $_ ne '..' and /\.$type$/i
2117 0 479 unless $self->{'plugins'}
2127 0 3462 unless $self->{'plugins'}
2130 55 3407 if ($subname eq 'finish_parsing_end')
2155 0 0 if ($#hdrs < 0)
2169 0 0 if defined $done{$_}
2191 0 2 if defined $seen{$addr}
2240 0 1 unless (defined $source and ref $source eq 'HASH' or defined $dest and ref $dest eq 'HASH')
2250 2 1 if (defined $source) { }