Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/Check.pm
Criterion Covered Total %
branch 232 530 43.7


line true false branch
54 0 96 if (ref $suppl_attrib and ref $suppl_attrib->{'rule_hits'})
58 0 0 if ref $caller_rule_hit ne 'HASH'
63 0 0 !defined($score) ? :
0 0 !defined($defscore) ? :
0 0 !defined($value) ? :
0 0 !defined($tflags) ? :
0 0 !defined($description) ? :
88 96 0 if $master_deadline
96 0 250 unless $pms->{'conf'}{'priorities'}{$priority} > 0
98 0 250 if ($pms->{'deadline_exceeded'}) { }
0 250 elsif ($master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline) { }
0 250 elsif ($self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms})) { }
118 77 77 if ($priority >= 500 and $needs_dnsbl_harvest_p and not $self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms}))
130 0 77 if $pms->{'resolver'}
141 0 250 if $pms->{'deadline_exceeded'}
145 0 250 if $pms->{'deadline_exceeded'}
149 0 250 if $pms->{'deadline_exceeded'}
153 0 250 if $pms->{'deadline_exceeded'}
157 0 250 if $pms->{'deadline_exceeded'}
161 0 250 if $pms->{'deadline_exceeded'}
165 0 250 if $pms->{'deadline_exceeded'}
169 0 250 if $pms->{'deadline_exceeded'}
173 0 250 if $pms->{'deadline_exceeded'}
177 0 250 if $pms->{'deadline_exceeded'}
183 0 250 if $pms->{'deadline_exceeded'}
188 19 77 if ($needs_dnsbl_harvest_p)
189 19 0 unless ($self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms}))
199 1 18 if $pms->{'resolver'}
202 0 96 if ($pms->{'deadline_exceeded'})
213 0 96 if ($pms->{'deadline_exceeded'}) { }
0 96 elsif ($master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline) { }
225 0 96 if ($self->{'done_user_rules'})
228 0 0 if ($counters->{$type} > 0)
255 92 4 if ($self->{'main'}{'local_tests_only'})
262 0 0 unless $score
271 0 0 unless (eval { do { $result = $pms->$function($rulename, @args); 1 } })
272 0 0 $@ ne '' ? :
273 0 0 if $eval_stat =~ /__alarm__ignore__/
288 0 1500 if ($pms->{'deadline_exceeded'}) { }
0 1500 elsif ($master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline) { }
0 1500 elsif ($self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms})) { }
305 0 1500 if ($doing_user_rules)
313 138 1362 if (not defined &{$methodname;} or $doing_user_rules)
338 69 69 if (defined $opts{'pre_loop_body'})
346 46 92 if (defined $opts{'post_loop_body'})
393 0 138 unless ($eval_result)
394 0 0 $@ ne '' ? :
410 0 0 if ($t->timed_out and $master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline)
419 276 0 if ($self->{'evalstr_chunk_methodnames'})
455 0 77 if ($r)
457 0 138 if (not $eval_result) { }
458 0 0 $@ ne '' ? :
486 111 132 if (defined $str and $str ne '')
491 0 108 if ($self->{'evalstr_l'} > 60000)
500 240 0 if (defined $str)
548 35 21 if ($token =~ tr[0-9A-Z_a-z](\000-/:-@[-^`{-\377)c or substr($token, 0, 1) =~ tr/A-Z_a-z/\000-@[-^`{-\377/c) { }
557 0 21 if (not exists $conf->{'scores'}{$token}) { }
0 21 elsif ($conf->{'scores'}{$token} == 0) { }
564 0 0 unless (($conf->get_score_set & 1) == 0 and ($conf->{'tflags'}{$token} || '') =~ /\bnet\b/)
573 0 21 if exists $conf->{'meta_tests'}{$opts{'priority'}}{$token}
606 0 7 if grep $metas{$_}, @{$rule_deps{$metas[$i]};}
610 0 7 unless (defined $conf->{'meta_dependencies'}{$metas[$i]})
614 0 21 if index($tflags->{$_} || '', 'net') > -1
617 0 7 if ($alldeps ne '')
640 0 0 if ($self->{'main'}{'lint_rules'}) { }
673 56 7 if ($rule =~ /^\s* (\S+) \s* ([=!]~) \s* (\S .*? \S) \s*$/x) { }
7 0 elsif ($rule =~ /^\s* (\S+) \s* \( \s* (\S+) \s* \) \s*$/x) { }
676 0 56 unless (defined $pat)
681 14 42 if ($pat =~ s/\s+\[if-unset:\s+(.+)\]\s*$//)
692 49 14 !defined($def) ? :
696 0 63 if $opts{'doing_user_rules'} and not $self->is_user_rule_sub($rulename . '_head_test')
701 0 63 if ($self->{'main'}{'use_rule_subs'}) { }
704 0 0 if ($op =~ /^!?[A-Za-z_]+$/) { }
709 0 0 if ($op eq '=~' or $op eq '!~') { }
744 35 7 !defined($def) ? :
749 0 63 if ($self->{'main'}{'use_rule_subs'}) { }
760 63 0 if defined $tc_ref
770 7 56 if (not $op_infix) { }
775 0 56 if (not $op eq '=~' || $op eq '!~') { }
0 56 elsif (($conf->{'tflags'}{$rulename} || '') =~ /\bmultiple\b/) { }
784 0 0 if $max
825 0 25 if (would_log('dbg', 'rules-all') == 2)
830 0 25 if (($conf->{'tflags'}{$rulename} || '') =~ /\bmultiple\b/) { }
836 0 0 $max ? :
0 0 $max ? :
864 0 25 if ($self->{'main'}{'use_rule_subs'}) { }
882 0 25 if $opts{'doing_user_rules'} and not $self->is_user_rule_sub($rulename . '_body_test')
884 0 25 if ($self->{'main'}{'use_rule_subs'})
907 0 7 if (would_log('dbg', 'rules-all') == 2)
912 0 7 if (($conf->{'tflags'}{$rulename} || '') =~ /\bmultiple\b/) { }
916 0 0 $max ? :
0 0 $max ? :
941 0 7 if ($self->{'main'}{'use_rule_subs'}) { }
959 0 7 if $opts{'doing_user_rules'} and not $self->is_user_rule_sub($rulename . '_uri_test')
961 0 7 if ($self->{'main'}{'use_rule_subs'})
984 0 0 if (would_log('dbg', 'rules-all') == 2)
989 0 0 if (($pms->{'conf'}{'tflags'}{$rulename} || '') =~ /\bmultiple\b/) { }
995 0 0 $max ? :
0 0 $max ? :
1021 0 0 if ($self->{'main'}{'use_rule_subs'}) { }
1039 0 0 if $opts{'doing_user_rules'} and not $self->is_user_rule_sub($rulename . '_rawbody_test')
1041 0 0 if ($self->{'main'}{'use_rule_subs'})
1072 4 0 $max ? :
1093 92 158 unless defined $pms->{'conf'}{'head_evals'}{$priority}
1101 173 77 unless defined $pms->{'conf'}{'body_evals'}{$priority}
1110 250 0 unless defined $pms->{'conf'}{'rawbody_evals'}{$priority}
1119 169 81 unless defined $pms->{'conf'}{'full_evals'}{$priority}
1130 0 312 if ($pms->{'deadline_exceeded'}) { }
0 312 elsif ($master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline) { }
0 312 elsif ($self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms})) { }
1143 0 308 if ($doing_user_rules)
1158 152 157 if (defined &{"${package_name}::$methodname";} and not $doing_user_rules)
1168 3 1 if ($t->timed_out and $master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline)
1187 0 156 if (would_log('dbg'))
1194 1153 507 if ($tflagsref->{$rulename})
1196 351 780 if ($tflagsref->{$rulename} =~ /\bnet\b/)
1197 351 19 if ($scoreset & 1) == 0
1200 58 744 if ($tflagsref->{$rulename} =~ /\blearn\b/)
1201 39 19 if ($scoreset & 2) == 0
1207 585 685 if ($test =~ s/^([^,]+)(,.*)$//gs)
1211 22 1248 unless ($function)
1223 1248 22 if ($eval_pluginsref->{$function})
1236 0 1270 if ($have_start_rules)
1261 0 1249 if ($have_ran_rule)
1285 0 156 unless $evalstr
1313 0 6 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_valid(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'DKIM_VALID'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_valid_author_sig(@extraevalargs); 1 } })
0 18 if ($result)
18 0 if ($scoresptr->{'DKIM_VALID_AU'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_signed(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'DKIM_SIGNED'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_to_in_blacklist(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'USER_IN_BLACKLIST_TO'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, 'A'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'DKIM_ADSP_ALL'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, '23', '24'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'HASHCASH_23'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_from_in_blacklist(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'USER_IN_BLACKLIST'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, '25', '26'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'HASHCASH_25'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, '20', '21'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'HASHCASH_20'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_from_in_default_whitelist(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'USER_IN_DEF_WHITELIST'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->similar_recipients(@extraevalargs, '0.65', 'undef'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'SUSPICIOUS_RECIPS'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_msg_parse_flags(@extraevalargs, 'missing_head_body_separator'); 1 } })
1 11 if ($result)
12 0 if ($scoresptr->{'MISSING_HB_SEP'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, '21', '22'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'HASHCASH_21'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, 'N'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'DKIM_ADSP_NXDOMAIN'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_double_spend(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'HASHCASH_2SPEND'})
0 0 if $@ =~ /__alarm__ignore__/
0 13 unless (eval { do { $result = $self->check_for_def_spf_whitelist_from(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'USER_IN_DEF_SPF_WL'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, '3'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'DKIM_ADSP_CUSTOM_HIGH'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_subject_in_blacklist(@extraevalargs); 1 } })
5 7 if ($result)
12 0 if ($scoresptr->{'SUBJECT_IN_BLACKLIST'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, '22', '23'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'HASHCASH_22'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, '2'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'DKIM_ADSP_CUSTOM_MED'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_for_spf_whitelist_from(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'USER_IN_SPF_WHITELIST'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->sorted_recipients(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'SORTED_RECIPS'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_from_in_whitelist(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'USER_IN_WHITELIST'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_for_forged_yahoo_received_headers(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'TEST_FORGED_YAHOO_RCVD'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, '24', '25'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'HASHCASH_24'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, '1'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'DKIM_ADSP_CUSTOM_LOW'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_outlook_message_id(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'TEST_MSGID_OUTLOOK_INVALID'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, 'D'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'DKIM_ADSP_DISCARD'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_to_in_whitelist(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'USER_IN_WHITELIST_TO'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, '26', '9999'); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'HASHCASH_HIGH'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_subject_in_whitelist(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'SUBJECT_IN_WHITELIST'})
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_from_in_auto_whitelist(@extraevalargs); 1 } })
0 12 if ($result)
12 0 if ($scoresptr->{'AWL'})
1315 0 156 if (not $eval_result) { }
1316 0 0 $@ ne '' ? :
1329 0 1 if ($t->timed_out and $master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline)
1351 0 0 if eval 'defined &' . $package_name . '::' . $subname
1359 0 132 if ($self->{'main'}->have_plugin('start_rules'))
1381 7 88 if ($matching_string_unavailable) { }
1389 0 95 if (exists $pms->{'should_log_rule_hits'})
1397 0 95 if ($pms->{'save_pattern_hits'})
1406 95 0 unless (($pms->{'conf'}{'tflags'}{$rulename} || '') =~ /\bmultiple\b/)
1416 95 0 unless $self->{'main'}->have_plugin('ran_rule')
1429 0 132 if $pms->{'conf'}{'allow_user_rules'}
1432 132 0 if (exists $pms->{'conf'}{$type . '_tests'}{$pri})