Mail/Qmail/Filter/SpamAssassin.pm

filter: Statementstmt 48.3% 15 / 31 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 31.6% 19 / 60 CC 8 SCAR 39.6
CC
8
Cov
30%
filter
72.0
BEGIN
1.0
BEGIN
1.0
CRAP 52.6
« Mail/Qmail/Filter.pm ↑ Summary Mail/Qmail/Filter/DMARC.pm »
1 1 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Mail::Qmail::Filter::SpamAssassin;
5  
6 1 our $VERSION = '1.01';
7  
8 1 ▶use Mo qw(coerce default);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 extends 'Mail::Qmail::Filter';
10  
11 1 has 'dump_spam_to';
12 1 has 'mark';
13 1 has 'reject_score';
14 1 has 'reject_text' => 'I think this message is spam.';
15  
16 0 ▶sub filter {
Subroutine filter: not called CC=8 SCAR=42.8
Pod documented
17 0 my $self = shift;
18 0 my $message = $self->message;
19 0 my $body_ref = $message->body_ref;
20  
21 0 require Mail::SpamAssassin; # lazy load because filter might be skipped
22 0 my $sa = Mail::SpamAssassin->new;
23 0 my $mail = $sa->parse($body_ref);
24 0 my $status = $sa->check($mail);
25 0 $self->debug( 'spam score' => my $score = $status->get_score );
26  
27 0 ▶ if ( $status->is_spam ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status->is_spam) 0 0 0
28 0 ▶ if ( defined( my $dir = $self->dump_spam_to ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $dir = $self->dump_spam_to)) 0 0 0
29 0 ▶ require Path::Tiny and Path::Tiny->import('path')
Branch: 1 branch
BranchTrueFalseTotal
unless defined &Mail::Qmail::Filter::SpamAssassin::path 0 0 0
Condition0%0/6
defined &Mail::Qmail::Filter::SpamAssassin::path || require Path::Tiny && 'Path::Tiny'->import('path')
l!l&&r!l&&!r
000
require Path::Tiny and "Path::Tiny"->import("path")
!ll&&!rl&&r
000
MC/DC0%0/3
defined &Mail::Qmail::Filter::SpamAssassin::path || require Path::Tiny && 'Path::Tiny'->import('path')
defined &Mail::Qmail::Filter::SpamAssassin::path require Path::Tiny "Path::Tiny"->import("path")
Truth table0%0/4
A || B and C
A= defined &Mail::Qmail::Filter::SpamAssassin::pathB= require Path::TinyC= "Path::Tiny"->import("path")
ABCresult
1XX1
0111
00X0
0100
30 unless defined &path;
31 0 path( $dir, my $file = join '_', $^T, $$, $score )
32 ->spew($$body_ref);
33 0 $self->debug( 'dumped message to' => $file );
34 0 path( $dir, $file . '_report' )->spew( $status->get_report );
35 }
36 0 ▶ $self->reject( $self->reject_text )
Branch: 1 branch
BranchTrueFalseTotal
if $self->reject_score and $score >= $self->reject_score 0 0 0
Condition0%0/3
$self->reject_score and $score >= $self->reject_score
!ll&&!rl&&r
000
MC/DC0%0/2
$self->reject_score and $score >= $self->reject_score
$self->reject_score $score >= $self->reject_score
Truth table0%0/3
A and B
A= $self->reject_scoreB= $score >= $self->reject_score
ABresult
0X0
100
111
37 if $self->reject_score && $score >= $self->reject_score;
38 0 ▶ $$body_ref = $status->rewrite_mail if $self->mark;
Branch: 1 branch
BranchTrueFalseTotal
if $self->mark 0 0 0
39 }
40 }
41  
42 1 1;
43  
44 __END__
« Mail/Qmail/Filter.pm ↑ Summary Mail/Qmail/Filter/DMARC.pm »