Branch Coverage

blib/lib/Mail/SpamAssassin/Plugin/AWL.pm
Criterion Covered Total %
branch 22 96 22.9


line true false branch
172 0 0 if (not defined $value or $value eq '') { }
0 0 elsif (not $value =~ /^\d+$/ or $value < 0 or $value > 32) { }
203 0 0 if (not defined $value or $value eq '') { }
0 0 elsif (not $value =~ /^\d+$/ or $value < 0 or $value > 128) { }
288 0 62 unless (defined $value and not $value =~ /^$/)
291 0 62 if (-d $value)
339 0 0 unless ($value =~ /^0?[0-7]{3}$/)
410 64 13 unless $pms->{'conf'}{'use_auto_whitelist'}
416 7 6 unless $from =~ /\S/
422 0 1 if $rly->{'ip_private'}
423 1 0 if ($rly->{'ip'})
432 6 0 if defined $signedby and $signedby eq ''
437 0 10 unless $scores->{$test}
438 0 10 if exists $tflags->{$test} and $tflags->{$test} =~ /\bnoautolearn\b/
439 0 10 if exists $tflags->{$test} and $tflags->{$test} =~ /\bnoawl\b/
459 5 1 !defined($meanscore) ? :
0 6 $signedby ? :
464 1 5 if (defined $meanscore)
469 1 0 if (defined $meanscore)
479 5 1 unless ($pms->{'disable_auto_learning'})
489 0 6 if ($delta != 0)
496 0 6 unless (eval { do { $whitelist = 'Mail::SpamAssassin::AutoWhitelist'->new($pms->{'main'}); my $meanscore; { my $timer = $self->{'main'}->time_method('check_awl'); $meanscore = $whitelist->check_address($from, $origip, $signedby); } ; my $delta = 0; dbg('auto-whitelist: AWL active, pre-score: %s, autolearn score: %s, mean: %s, IP: %s, address: %s %s', $pms->{'score'}, $awlpoints, !defined($meanscore) ? 'undef' : sprintf('%.3f', $meanscore), $origip || 'undef', $from, $signedby ? "signed by $signedby" : '(not signed)'); if (defined $meanscore) { $delta = $meanscore - $awlpoints; $delta *= $pms->{'main'}{'conf'}{'auto_whitelist_factor'}; $pms->set_tag('AWL', sprintf('%2.1f', $delta)); if (defined $meanscore) { $pms->set_tag('AWLMEAN', sprintf('%2.1f', $meanscore)); } ; $pms->set_tag('AWLCOUNT', sprintf('%2.1f', $whitelist->count)); $pms->set_tag('AWLPRESCORE', sprintf('%2.1f', $pms->{'score'})); } ; unless ($pms->{'disable_auto_learning'}) { my $timer = $self->{'main'}->time_method('update_awl'); $whitelist->add_score($awlpoints); } ; if ($delta != 0) { $pms->got_hit('AWL', 'AWL: ', 'ruletype', 'eval', 'score', sprintf('%0.3f', $delta)); } ; $whitelist->finish; 1 } })
497 0 0 $@ ne '' ? :
500 0 0 if $whitelist
513 0 0 unless $self->{'main'}{'conf'}{'use_auto_whitelist'}
515 0 0 unless ($args->{'address'})
516 0 0 if $args->{'cli_p'}
527 0 0 if ($whitelist->add_known_bad_address($args->{'address'}, $args->{'signedby'})) { }
528 0 0 if $args->{'cli_p'}
533 0 0 if $args->{'cli_p'}
539 0 0 unless (eval { do { $whitelist = 'Mail::SpamAssassin::AutoWhitelist'->new($self->{'main'}); if ($whitelist->add_known_bad_address($args->{'address'}, $args->{'signedby'})) { print 'SpamAssassin auto-whitelist: adding address to blacklist: ' . $args->{'address'} . "\n" if $args->{'cli_p'}; dbg('auto-whitelist: adding address to blacklist: ' . $args->{'address'}); $status = 0; } else { print "SpamAssassin auto-whitelist: error adding address to blacklist\n" if $args->{'cli_p'}; dbg('auto-whitelist: error adding address to blacklist'); $status = 1; } ; $whitelist->finish; 1 } })
540 0 0 $@ ne '' ? :
552 0 0 unless $self->{'main'}{'conf'}{'use_auto_whitelist'}
554 0 0 unless ($args->{'address'})
555 0 0 if $args->{'cli_p'}
566 0 0 if ($whitelist->add_known_good_address($args->{'address'}, $args->{'signedby'})) { }
567 0 0 if $args->{'cli_p'}
572 0 0 if $args->{'cli_p'}
579 0 0 unless (eval { do { $whitelist = 'Mail::SpamAssassin::AutoWhitelist'->new($self->{'main'}); if ($whitelist->add_known_good_address($args->{'address'}, $args->{'signedby'})) { print 'SpamAssassin auto-whitelist: adding address to whitelist: ' . $args->{'address'} . "\n" if $args->{'cli_p'}; dbg('auto-whitelist: adding address to whitelist: ' . $args->{'address'}); $status = 1; } else { print "SpamAssassin auto-whitelist: error adding address to whitelist\n" if $args->{'cli_p'}; dbg('auto-whitelist: error adding address to whitelist'); $status = 0; } ; $whitelist->finish; 1 } })
580 0 0 $@ ne '' ? :
592 0 0 unless $self->{'main'}{'conf'}{'use_auto_whitelist'}
594 0 0 unless ($args->{'address'})
595 0 0 if $args->{'cli_p'}
606 0 0 if ($whitelist->remove_address($args->{'address'}, $args->{'signedby'})) { }
607 0 0 if $args->{'cli_p'}
612 0 0 if $args->{'cli_p'}
619 0 0 unless (eval { do { $whitelist = 'Mail::SpamAssassin::AutoWhitelist'->new($self->{'main'}); if ($whitelist->remove_address($args->{'address'}, $args->{'signedby'})) { print 'SpamAssassin auto-whitelist: removing address: ' . $args->{'address'} . "\n" if $args->{'cli_p'}; dbg('auto-whitelist: removing address: ' . $args->{'address'}); $status = 1; } else { print "SpamAssassin auto-whitelist: error removing address\n" if $args->{'cli_p'}; dbg('auto-whitelist: error removing address'); $status = 0; } ; $whitelist->finish; 1 } })
620 0 0 $@ ne '' ? :