Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/Check.pm
Criterion Covered Total %
branch 196 460 42.6


line true false branch
57 0 96 if (ref $suppl_attrib and ref $suppl_attrib->{'rule_hits'})
61 0 0 if ref $caller_rule_hit ne 'HASH'
66 0 0 !defined($score) ? :
0 0 !defined($defscore) ? :
0 0 !defined($value) ? :
0 0 !defined($tflags) ? :
0 0 !defined($description) ? :
91 96 0 if $master_deadline
99 0 258 unless $pms->{'conf'}{'priorities'}{$priority} > 0
101 0 258 if ($pms->{'deadline_exceeded'}) { }
0 258 elsif ($master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline) { }
0 258 elsif ($self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms})) { }
121 81 81 if ($priority >= 500 and $needs_dnsbl_harvest_p and not $self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms}))
133 1 80 if $pms->{'resolver'}
144 0 258 if $pms->{'deadline_exceeded'}
148 0 258 if $pms->{'deadline_exceeded'}
152 0 258 if $pms->{'deadline_exceeded'}
156 0 258 if $pms->{'deadline_exceeded'}
160 0 258 if $pms->{'deadline_exceeded'}
164 0 258 if $pms->{'deadline_exceeded'}
168 0 258 if $pms->{'deadline_exceeded'}
172 0 258 if $pms->{'deadline_exceeded'}
176 0 258 if $pms->{'deadline_exceeded'}
180 0 258 if $pms->{'deadline_exceeded'}
186 0 258 if $pms->{'deadline_exceeded'}
191 15 81 if ($needs_dnsbl_harvest_p)
192 15 0 unless ($self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms}))
202 0 15 if $pms->{'resolver'}
205 0 96 if ($pms->{'deadline_exceeded'})
216 0 96 if ($pms->{'deadline_exceeded'}) { }
0 96 elsif ($master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline) { }
228 0 96 if ($self->{'done_user_rules'})
231 0 0 if ($counters->{$type} > 0)
258 92 4 if ($self->{'main'}{'local_tests_only'})
265 0 0 unless $score
270 0 0 unless (exists $pms->{'conf'}{'eval_plugins'}{$function})
278 0 0 unless (eval { do { $result = $pms->$function($rulename, @{$$test[1];}); 1 } })
279 0 0 $@ ne '' ? :
280 0 0 if $eval_stat =~ /__alarm__ignore__/
295 0 1548 if ($pms->{'deadline_exceeded'}) { }
0 1548 elsif ($master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline) { }
0 1548 elsif ($self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms})) { }
312 0 1548 if ($doing_user_rules)
320 150 1398 if (not defined &{$methodname;} or $doing_user_rules)
346 75 75 if (defined $opts{'pre_loop_body'})
354 50 100 if (defined $opts{'post_loop_body'})
401 0 150 unless ($eval_result)
402 0 0 $@ ne '' ? :
418 0 0 if ($t->timed_out and $master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline)
427 300 0 if ($self->{'evalstr_chunk_methodnames'})
463 0 81 if ($r)
0 81 if ($r)
465 0 150 if (not $eval_result) { }
466 0 0 $@ ne '' ? :
494 124 150 if (defined $str and $str ne '')
499 0 124 if ($self->{'evalstr_l'} > 60000)
508 273 0 if (defined $str)
532 0 0 if (exists $pms->{'ruleglob_cache'}{$ruleglob}) { }
539 0 0 if /^$reglob$/
540 0 0 if (@rules) { }
546 0 0 $expanded eq '0' ? :
581 40 56 if ($token =~ /^(?^:[_a-zA-Z][_a-zA-Z0-9]{0,127})$/) { }
587 0 40 if (not exists $conf->{'scores'}{$token}) { }
0 40 elsif ($conf->{'scores'}{$token} == 0) { }
594 0 0 unless (($conf->get_score_set & 1) == 0 and ($conf->{'tflags'}{$token} || '') =~ /\bnet\b/)
603 0 40 if exists $conf->{'meta_tests'}{$opts{'priority'}}{$token}
639 0 16 if grep $metas{$_}, @{$rule_deps{$metas[$i]};}
643 0 16 unless (defined $conf->{'meta_dependencies'}{$metas[$i]})
650 0 16 if ($alldeps ne '')
673 0 0 if ($self->{'main'}{'lint_rules'}) { }
705 8 64 if (exists $conf->{'test_opt_exists'}{$rulename}) { }
707 0 8 if (exists $conf->{'test_opt_neg'}{$rulename}) { }
715 16 48 $conf->{'test_opt_neg'}{$rulename} ? :
719 56 16 !defined($def) ? :
723 0 72 if $opts{'doing_user_rules'} and not $self->is_user_rule_sub($rulename . '_head_test')
741 40 8 !defined($def) ? :
748 72 0 if defined $tc_ref
757 8 64 if (not $op_infix) { }
762 0 64 if (($conf->{'tflags'}{$rulename} || '') =~ /\bmultiple\b/)
766 0 0 if ($conf->{'tflags'}{$rulename} =~ /\bmaxhits=(\d+)\b/)
770 0 64 if ($matchg) { }
812 0 28 if (would_log('dbg', 'rules-all') == 2)
818 0 28 if ($nosubject)
823 0 28 if (($conf->{'tflags'}{$rulename} || '') =~ /\bmultiple\b/) { }
833 0 0 if ($nosubject)
838 0 0 $max ? :
855 0 28 if ($nosubject)
878 0 28 if $opts{'doing_user_rules'} and not $self->is_user_rule_sub($rulename . '_body_test')
897 0 8 if (would_log('dbg', 'rules-all') == 2)
902 0 8 if (($conf->{'tflags'}{$rulename} || '') =~ /\bmultiple\b/) { }
906 0 0 $max ? :
938 0 8 if $opts{'doing_user_rules'} and not $self->is_user_rule_sub($rulename . '_uri_test')
957 0 0 if (would_log('dbg', 'rules-all') == 2)
962 0 0 if (($pms->{'conf'}{'tflags'}{$rulename} || '') =~ /\bmultiple\b/) { }
968 0 0 $max ? :
1001 0 0 if $opts{'doing_user_rules'} and not $self->is_user_rule_sub($rulename . '_rawbody_test')
1052 96 162 unless defined $pms->{'conf'}{'head_evals'}{$priority}
1060 177 81 unless defined $pms->{'conf'}{'body_evals'}{$priority}
1068 258 0 unless defined $pms->{'conf'}{'rawbody_evals'}{$priority}
1076 177 81 unless defined $pms->{'conf'}{'full_evals'}{$priority}
1086 0 324 if ($pms->{'deadline_exceeded'}) { }
0 324 elsif ($master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline) { }
0 324 elsif ($self->{'main'}->call_plugins('have_shortcircuited', {'permsgstatus', $pms})) { }
1099 0 324 if ($doing_user_rules)
1114 126 198 if (defined &{"${package_name}::$methodname";} and not $doing_user_rules)
1124 0 0 if ($t->timed_out and $master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline)
1144 0 198 if (would_log('dbg'))
1149 1297 523 if ($tflagsref->{$rulename})
1151 400 897 if ($tflagsref->{$rulename} =~ /\bnet\b/)
1152 390 10 if ($scoreset & 1) == 0
1155 78 829 if ($tflagsref->{$rulename} =~ /\blearn\b/)
1156 78 0 if ($scoreset & 2) == 0
1161 0 1352 unless $scoresref->{$rulename}
1164 0 1352 unless ($function)
1169 0 1352 unless (exists $conf->{'eval_plugins'}{$function})
1181 1352 0 if ($eval_pluginsref->{$function})
1192 0 1352 if ($have_start_rules)
1214 0 1352 if ($have_ran_rule)
1235 77 121 unless $evalstr
1262 0 0 if $@ =~ /__alarm__ignore__/
0 30 unless (eval { do { $result = $self->check_dkim_valid_author_sig(@extraevalargs, @{$$testptr{'DKIM_VALID_AU'}[1];}); 1 } })
1 24 if ($result)
0 13 if $@ =~ /__alarm__ignore__/
0 25 unless (eval { do { $result = $self->check_dkim_valid(@extraevalargs, @{$$testptr{'DKIM_VALID'}[1];}); 1 } })
4 21 if ($result)
13 0 if $@ =~ /__alarm__ignore__/
0 30 unless (eval { do { $result = $self->check_dkim_signed(@extraevalargs, @{$$testptr{'DKIM_SIGNED'}[1];}); 1 } })
18 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->similar_recipients(@extraevalargs, @{$$testptr{'SUSPICIOUS_RECIPS'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_shortcircuit(@extraevalargs, @{$$testptr{'SHORTCIRCUIT'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_for_forged_yahoo_received_headers(@extraevalargs, @{$$testptr{'TEST_FORGED_YAHOO_RCVD'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_msg_parse_flags(@extraevalargs, @{$$testptr{'MISSING_HB_SEP'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_for_def_spf_whitelist_from(@extraevalargs, @{$$testptr{'USER_IN_DEF_SPF_WL'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_to_in_whitelist(@extraevalargs, @{$$testptr{'USER_IN_WHITELIST_TO'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, @{$$testptr{'DKIM_ADSP_CUSTOM_HIGH'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_outlook_message_id(@extraevalargs, @{$$testptr{'TEST_MSGID_OUTLOOK_INVALID'}[1];}); 1 } })
5 7 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_double_spend(@extraevalargs, @{$$testptr{'HASHCASH_2SPEND'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_subject_in_whitelist(@extraevalargs, @{$$testptr{'SUBJECT_IN_WHITELIST'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->sorted_recipients(@extraevalargs, @{$$testptr{'SORTED_RECIPS'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, @{$$testptr{'HASHCASH_20'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, @{$$testptr{'DKIM_ADSP_ALL'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_subject_in_blacklist(@extraevalargs, @{$$testptr{'SUBJECT_IN_BLACKLIST'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_from_in_blacklist(@extraevalargs, @{$$testptr{'USER_IN_BLACKLIST'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, @{$$testptr{'DKIM_ADSP_CUSTOM_LOW'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, @{$$testptr{'DKIM_ADSP_DISCARD'}[1];}); 1 } })
1 11 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, @{$$testptr{'HASHCASH_HIGH'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_to_in_blacklist(@extraevalargs, @{$$testptr{'USER_IN_BLACKLIST_TO'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, @{$$testptr{'HASHCASH_25'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_from_in_default_whitelist(@extraevalargs, @{$$testptr{'USER_IN_DEF_WHITELIST'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_for_spf_whitelist_from(@extraevalargs, @{$$testptr{'USER_IN_SPF_WHITELIST'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, @{$$testptr{'HASHCASH_23'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, @{$$testptr{'HASHCASH_22'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, @{$$testptr{'DKIM_ADSP_CUSTOM_MED'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, @{$$testptr{'HASHCASH_24'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_from_in_whitelist(@extraevalargs, @{$$testptr{'USER_IN_WHITELIST'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_hashcash_value(@extraevalargs, @{$$testptr{'HASHCASH_21'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_dkim_adsp(@extraevalargs, @{$$testptr{'DKIM_ADSP_NXDOMAIN'}[1];}); 1 } })
0 12 if ($result)
0 0 if $@ =~ /__alarm__ignore__/
0 12 unless (eval { do { $result = $self->check_from_in_auto_whitelist(@extraevalargs, @{$$testptr{'AWL'}[1];}); 1 } })
0 12 if ($result)
1264 0 121 if (not $eval_result) { }
1265 0 0 $@ ne '' ? :
1278 0 0 if ($t->timed_out and $master_deadline and &Mail::SpamAssassin::Plugin::Check::time() > $master_deadline)
1300 0 0 if eval 'defined &' . $package_name . '::' . $subname
1308 0 132 if ($self->{'main'}->have_plugin('start_rules'))
1330 7 88 if ($matching_string_unavailable) { }
1338 0 95 if (exists $pms->{'should_log_rule_hits'})
1346 0 95 if ($pms->{'save_pattern_hits'})
1355 32 63 if ($loop_break_directive and not +($pms->{'conf'}{'tflags'}{$rulename} || '') =~ /\bmultiple\b/)
1366 95 0 unless $self->{'main'}->have_plugin('ran_rule')
1379 0 132 if $pms->{'conf'}{'allow_user_rules'}
1382 132 0 if (exists $pms->{'conf'}{$type . '_tests'}{$pri})