Sisimai/Reason/SpamDetected.pm

filter: Statementstmt 100% 37 / 37 Branchbran 91.6% 11 / 12 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 10 / 10 Podpod 50.0% 2 / 4 totaltotal 95.8% 69 / 72 CC 10 SCAR 13.5
CC
10
Cov
98%
true
7.0
match
4.0
BEGIN
1.0
CRAP 3.8
« Sisimai/Reason/NotAccept.pm ↑ Summary Sisimai/RFC3464/ThirdParty.pm »
1 package Sisimai::Reason::SpamDetected;
2 51 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 51 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 51 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 51 ▶use Sisimai::Eb;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 51 ▶use Sisimai::String;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 51 ▶use Sisimai::SMTP::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 52 ▶sub text { $Sisimai::Eb::ReSPAM }
Subroutine text: called CC=1 SCAR=0.0
Pod documented
10 4 ▶sub description { 'Email rejected by spam filter running on the remote host' }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
11 1426 ▶sub match {
Subroutine match: called CC=4 SCAR=13.9
Pod documented
12 # Try to match that the given text and regular expressions
13 # @param [String] argv1 String to be matched with regular expressions
14 # @return [Integer] 0: Did not match
15 # 1: Matched
16 # @since v4.1.19
17 1426 my $class = shift;
18 1426 ▶ my $argv1 = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
14251
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
19  
20 1425 state $index = [
21 "blacklisted url in message",
22 "block for spam",
23 "blocked by policy: no spam please",
24 "blocked by spamassassin", # rejected by SpamAssassin
25 "classified as spam and is rejected",
26 "content filter rejection",
27 "denied due to spam list",
28 "identified spam", # 554 SpamBouncer identified SPAM, message permanently rejected (#5.3.0)
29 "may consider spam",
30 "message content rejected",
31 "message has been temporarily blocked by our filter",
32 "message is being rejected as it seems to be a spam",
33 "message was rejected by recurrent pattern detection system",
34 "our email server thinks this email is spam",
35 "reject bulk.advertising",
36 "spam check",
37 "spam content ",
38 "spam detected",
39 "spam email",
40 "spam-like header",
41 "spam message",
42 "spam not accepted",
43 "spam refused",
44 "spamming not allowed",
45 "unsolicited ",
46 "your email breaches local uribl policy",
47 ];
48 1425 state $pairs = [
49 ["accept", " spam"],
50 ["appears", " to ", "spam"],
51 ["bulk", "mail"],
52 ["considered", " spam"],
53 ["contain", " spam"],
54 ["detected", " spam"],
55 ["greylisted", " please try again in"],
56 ["mail score (", " over "],
57 ["mail rejete. mail rejected. ", "506"],
58 ["message ", "as spam"],
59 ["message ", "like spam"],
60 ["message ", "spamprofiler"],
61 ["probab", " spam"],
62 ["refused by", " spamprofiler"],
63 ["reject", " content"],
64 ["reject, id=", "spam"],
65 ["rejected by ", " (spam)"],
66 ["rejected due to spam ", "classification"],
67 ["rule imposed as ", " is blacklisted on"],
68 ["score", "spam"],
69 ["spam ", "block"],
70 ["spam ", "filter"],
71 ["spam ", " exceeded"],
72 ["spam ", "score"],
73 ];
74 1425 ▶ return 1 if grep { rindex($argv1, $_) > -1 } @$index;
Branch: 1 branch
BranchTrueFalseTotal
if grep {rindex($argv1, $_) != -1;} @$index 68 1357 1425
75 1357 ▶ return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
Branch: 1 branch
BranchTrueFalseTotal
if grep {"Sisimai::String"->aligned(\$argv1, $_);} @$pairs 43 1314 1357
76 1314 return 0;
77 }
78  
79 1828 ▶sub true {
Subroutine true: called CC=7 SCAR=19.5
Pod undocumented
80 # Rejected due to spam content in the message
81 # @param [Sisimai::Fact] argvs Object to be detected the reason
82 # @return [Integer] 1: rejected due to spam
83 # 0: is not rejected due to spam
84 # @since v4.1.19
85 # @see http://www.ietf.org/rfc/rfc2822.txt
86 1828 my $class = shift;
87 1828 ▶ my $argvs = shift // return 0; return 0 unless $argvs->{'deliverystatus'};
Branch: 1 branch
BranchTrueFalseTotal
unless $argvs->{"deliverystatus"} 633 1194 1827
Condition100%2/2
shift() // (return 0)
l!l
18271
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
88  
89 1194 ▶ return 1 if $argvs->{'reason'} eq $Sisimai::Eb::ReSPAM;
Branch: 1 branch
BranchTrueFalseTotal
if $argvs->{"reason"} eq $Sisimai::Eb::ReSPAM 1 1193 1194
90 1193 ▶ return 1 if (Sisimai::SMTP::Status->name($argvs->{'deliverystatus'}) || '') eq $Sisimai::Eb::ReSPAM;
Branch: 1 branch
BranchTrueFalseTotal
if ("Sisimai::SMTP::Status"->name($argvs->{"deliverystatus"}) || "") eq $Sisimai::Eb::ReSPAM 0 1193 1193
Condition100%2/2
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || ''
l!l
839354
MC/DC100%1/1
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || ''
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'})
Truth table100%2/2
A
A= 'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'})
Aresult
11
00
91  
92 # The value of "reason" isn't "SpamDetected" when the value of "command" is an SMTP command to
93 # be sent before the SMTP DATA command because all the MTAs read the headers and the entire
94 # message body after the DATA command.
95 1193 ▶ return 0 if grep { $argvs->{'command'} eq $_ } Sisimai::SMTP::Command->ExceptDATA->@*;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$argvs->{"command"} eq $_;} @{"Sisimai::SMTP::Command"->ExceptDATA} 394 799 1193
96 799 return __PACKAGE__->match(lc $argvs->{'diagnosticcode'});
97 }
98  
99 51 1;
100 __END__
« Sisimai/Reason/NotAccept.pm ↑ Summary Sisimai/RFC3464/ThirdParty.pm »