Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/Bayes.pm
Criterion Covered Total %
branch 161 350 46.0


line true false branch
53 0 22 unless (eval {
245 39 1 if ($self->{'store'})
267 0 0 if ($self->{'store'} and $self->{'store'}->UNIVERSAL::can("prefork_init"))
279 0 0 if ($self->{'store'} and $self->{'store'}->UNIVERSAL::can("spamd_child_init"))
290 0 0 unless $self->{'conf'}{'use_learner'}
291 0 0 unless $self->{'conf'}{'use_bayes'} and $self->{'conf'}{'use_bayes_rules'}
293 0 0 unless (exists $pms->{'bayes_score'})
298 0 0 if (defined $pms->{'bayes_score'} and $min == 0 || $pms->{'bayes_score'} > $min and $max eq 'undef' || $pms->{'bayes_score'} <= $max)
302 0 0 if ($self->{'conf'}{'detailed_bayes_score'}) { }
326 0 6 if ($self->{'store'}->db_readable)
327 0 0 unless $quiet
348 0 0 unless $self->{'use_ignores'}
357 0 0 if $ignore
371 0 10 unless ($self->{'conf'}{'use_bayes'})
381 2 8 if ($self->{'main'}{'learn_to_journal'}) { }
390 8 2 if ($ok)
393 8 0 unless ($self->{'main'}{'learn_caller_will_untie'})
398 0 10 unless (eval {
399 0 0 $@ ne '' ? :
412 8 0 unless (defined $msgid)
419 4 8 if (defined $seen)
420 2 2 if ($seen eq 's' and $isspam or $seen eq 'h' and not $isspam) { }
0 2 elsif (not $seen =~ /^[hs]$/) { }
429 0 2 if ($self->{'main'}{'learn_no_relearn'})
446 0 2 if ($fatal)
467 0 6 if $msgatime - time > 86400
472 4 2 if ($isspam) { }
481 4 2 $isspam ? :
503 0 4 unless ($self->{'conf'}{'use_bayes'})
515 0 4 if ($self->{'main'}{'learn_to_journal'}) { }
524 4 0 if ($ok)
527 2 2 unless ($self->{'main'}{'learn_caller_will_untie'})
532 0 4 unless (eval {
533 0 0 $@ ne '' ? :
547 4 0 unless (defined $msgid)
554 4 0 if (defined $seen) { }
555 2 2 if ($seen eq 's') { }
2 0 elsif ($seen eq 'h') { }
574 0 4 if (not defined $isspam) { }
2 2 elsif ($isspam) { }
587 2 2 if ($isspam) { }
609 0 2 unless ($self->{'conf'}{'use_bayes'})
620 0 0 unless ($self->{'conf'}{'use_bayes'})
635 0 146 unless $self->{'conf'}{'use_bayes'}
636 140 6 unless $self->{'store'}->tie_db_readonly
652 0 6 if ($ns < $self->{'conf'}{'bayes_min_spam_num'})
654 0 0 unless ($self->{'main'}{'learn_caller_will_untie'})
659 0 6 if ($nn < $self->{'conf'}{'bayes_min_ham_num'})
661 0 0 unless ($self->{'main'}{'learn_caller_will_untie'})
676 0 4 unless $self->{'conf'}{'use_learner'}
683 0 4 if $self->{'main'}{'bayes_scanner'}->ignore_message($permsgstatus)
685 0 4 unless $self->learner_is_scan_available
714 602 502 unless defined $prob
728 0 4 unless (@pw_keys)
742 0 4 if $msgatime > $now
756 2 2 if (@pw_keys > 150)
760 132 282 if $tok_strength{$tok} < $Mail::SpamAssassin::Bayes::Combine::MIN_PROB_STRENGTH
775 250 32 $pw_prob < 0.5 ? :
783 0 282 if ($log_each_token)
788 0 4 if (not @sorted or Deparse error: Can't locate object method "object_2svref" via package "B::SPECIAL" at /usr/local/lib/perl5/5.26.1/B/Deparse.pm line 5018.
799 0 4 unless defined $score
828 0 4 unless (defined $score)
833 4 0 unless (defined $timer_finish)
838 0 4 if ($self->{'main'}{'opportunistic_expire_check_only'}) { }
855 4 0 unless ($caller_untie)
860 4 0 $tinfo_hammy ? :
862 4 0 $tinfo_spammy ? :
880 0 0 if (defined $pms->{'tag_data'}{'BAYESTC'}) { }
911 0 0 unless $self->{'store'}->tie_db_readonly
919 0 0 if ($magic)
920 0 0 unless printf $template, 0, 0, $bv, 0, "non-token data: bayes db version"
922 0 0 unless printf $template, 0, 0, $ns, 0, "non-token data: nspam"
924 0 0 unless printf $template, 0, 0, $nh, 0, "non-token data: nham"
926 0 0 unless printf $template, 0, 0, $nt, 0, "non-token data: ntokens"
928 0 0 unless printf $template, 0, 0, $oa, 0, "non-token data: oldest atime"
930 0 0 if ($bv >= 2)
931 0 0 unless printf $template, 0, 0, $na, 0, "non-token data: newest atime"
934 0 0 if ($bv < 2)
935 0 0 unless printf $template, 0, 0, $sb, 0, "non-token data: current scan-count"
938 0 0 if ($bv >= 2)
939 0 0 unless printf $template, 0, 0, $js, 0, "non-token data: last journal sync atime"
942 0 0 unless printf $template, 0, 0, $le, 0, "non-token data: last expiry atime"
944 0 0 if ($bv >= 2)
945 0 0 unless printf $template, 0, 0, $ad, 0, "non-token data: last expire atime delta"
948 0 0 unless printf $template, 0, 0, $er, 0, "non-token data: last expire reduction count"
953 0 0 if ($toks)
958 0 0 unless ($self->{'main'}{'learn_caller_will_untie'})
973 14 0 if (defined $msgid and $msgid ne "" and not $msgid =~ /^\s*<\s*(?:\@sa_generated)?>.*$/)
986 0 14 if not defined $date or $date eq ""
996 14 0 if (length $body > 64)
997 14 0 length $body > 2048 ? :
1007 14 0 wantarray ? :
1013 0 20 unless (ref $msg)
1025 0 20 unless (defined $msgdata)
1040 24 0 if $t_src->{'visible'}
1042 24 0 if $t_src->{'invisible'}
1044 0 24 if $t_src->{'mimepart'}
1046 24 0 if $t_src->{'uri'}
1060 16 0 if ($msgdata->{'bayes_token_body'})
1063 0 278 if scalar @tokens_body >= 50000
1069 16 0 if ($msgdata->{'bayes_token_uris'})
1072 0 54 if scalar @tokens_uri >= 10000
1078 16 0 if ($msgdata->{'bayes_token_inviz'})
1082 16 0 if (defined $tokprefix)
1085 0 0 if scalar @tokens_inviz >= 50000
1093 0 16 if ($msgdata->{'bayes_mimepart_digests'})
1111 16 0 if ($t_src->{'header'})
1115 0 200 if scalar @tokens_header >= 10000
1127 6714 0 if $token ne ""
1153 2368 2476 defined $1 ? :
1163 332 200 if ($region == 1 or $region == 2)
1185 0 8592 if defined $magic_re and $token =~ /$magic_re/
1194 3362 5230 if $len < 3 or $token =~ /^(?:a(?:ble|l(?:ready|l)|n[dy]|re)|b(?:ecause|oth)|c(?:an|ome)|e(?:ach|mail|ven)|f(?:ew|irst|or|rom)|give|h(?:a(?:ve|s)|ttp)|i(?:n(?:formation|to)|t\'s)|just|know|l(?:ike|o(?:ng|ok))|m(?:a(?:de|il(?:(?:ing|to))?|ke|ny)|o(?:re|st)|uch)|n(?:eed|o[tw]|umber)|o(?:ff|n(?:ly|e)|ut|wn)|p(?:eople|lace)|right|s(?:ame|ee|uch)|t(?:h(?:at|is|rough|e)|ime)|using|w(?:eb|h(?:ere|y)|ith(?:out)?|or(?:ld|k))|y(?:ears?|ou(?:(?:\'re|r))?))$/i
1198 3534 1696 if ($region == 1 or $region == 2)
1199 38 3496 if ($token =~ /\S\@\S/i) { }
110 3386 elsif ($token =~ /\S\.[a-z]/i) { }
1214 250 4980 if ($len > 15 and not $token =~ /\*/)
1216 0 250 if ($token =~ /[\x80-\xBF]{2}/)
1221 0 0 if (@t)
1237 78 18 if ($region == 0 and 1 or $region == 1 and 1 or $region == 2 and 0)
1258 3534 1696 if ($region == 1 or $region == 2)
1260 358 3176 if ($token =~ /[^\w:\*]/)
1266 712 2822 if ($token =~ /[A-Z]/)
1270 76 636 if ($token =~ /[^\w:\*]/)
1297 52 150 if (/^Received:/i)
1302 48 102 if /^$IGNORED_HDRS:/i
1310 14 2 if ($#rcvdlines >= 0)
1311 14 2 if ($#rcvdlines >= 1)
1314 0 194 unless /\S/
1319 0 194 if exists $user_ignore{lc $hdr}
1326 16 178 if ($hdr =~ /^(?:|X-|Resent-)Message-Id$/i) { }
60 118 elsif ($hdr =~ /^(?:|X-|Resent-)
28 90 elsif ($hdr eq 'Received') { }
4 86 elsif ($hdr eq 'Content-Type') { }
2 84 elsif ($hdr eq 'MIME-Version') { }
0 84 elsif ($hdr =~ /^$MARK_PRESENCE_ONLY_HDRS$/i) { }
1348 16 178 if ($hdr =~ /^(?:In-Reply-To|References|Message-ID)$/i)
1353 32 162 if ($hdr =~ /^(?:From|To|Cc)$/i)
1358 0 194 if ($hdr =~ /^(?:X-Mailer|User-Agent)$/i)
1364 126 68 if (defined $HEADER_NAME_COMPRESSION{$hdr})
1368 26 168 if (exists $parsed{$hdr}) { }
1373 0 194 if (would_log("dbg", "bayes") > 1)
1385 0 4 if ($val =~ s/boundary=[\"\'](.*?)[\"\']/ /gi)
1387 0 0 unless defined $boundary
1450 0 30 if ($2 eq '10' or $2 eq '192' and $3 eq '168') { }
1481 0 86 unless $addr =~ /(.+)\@(.+)$/
1496 0 4 unless $ns and $nn
1502 0 4 unless ($self->{'use_hapaxes'})
1512 502 602 if ($s + $n >= $threshold)
1554 0 0 unless (defined $s and defined $n)
1557 0 0 unless $s or $n
1579 0 0 if $ns == 0 and $nn == 0
1582 0 0 if $ns + $nn < 2
0 0 unless ($self->{'use_hapaxes'})
1584 0 0 if $Ns == 0 or $Nn == 0
1585 0 0 if abs $prob - "0.5" < $Mail::SpamAssassin::Bayes::Combine::MIN_PROB_STRENGTH
1588 0 0 $prob > 0.5 ? :
1600 0 0 $discrim < 0 ? :
1604 0 0 $dd_exact < 1 ? :
1613 0 10 unless ($self->{'store'}->db_readable)
1620 0 10 if (defined $running_expire and $running_expire + $OPPORTUNISTIC_LOCK_VALID > time)
1626 0 10 if (not $journal_only and $self->{'store'}->expiry_due) { }
0 10 elsif ($self->{'store'}->sync_due) { }
1640 0 0 if ($self->{'store'}->db_writable)
1655 57 6 if (not $module) { }
6 0 elsif ($module =~ /^([_A-Za-z0-9:]+)$/) { }
1669 0 63 unless (eval "\n require " . $module . ";\n \$store = " . $module . "->new(\$self);\n 1;\n ")
1670 0 0 $@ ne '' ? :
1684 0 0 unless defined $info
1698 0 0 !$fmt_arg ? :
1700 0 0 unless defined $raw_fmt
1704 0 0 $limit < @$info ? :
1705 0 0 unless $amt
1709 0 0 $_[0] > 9 ? :
1718 0 0 $prob < 0.5 ? :