Sisimai/Reason/Filtered.pm

filter: Statementstmt 100% 38 / 38 Branchbran 92.8% 13 / 14 Conditioncond 100% 8 / 8 MC/DCmcdc 100% 4 / 4 Subroutinesub 100% 9 / 9 Podpod 50.0% 2 / 4 totaltotal 96.1% 74 / 77 CC 12 SCAR 17.6
CC
12
Cov
98%
true
10.0
match
3.0
BEGIN
1.0
CRAP 5.8
« Sisimai/Rhost/GoDaddy.pm ↑ Summary Sisimai/RFC791.pm »
1 package Sisimai::Reason::Filtered;
2 57 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 57 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 57 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 57 ▶use Sisimai::Eb;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 57 ▶use Sisimai::SMTP::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 205 ▶sub text { $Sisimai::Eb::ReFILT }
Subroutine text: called CC=1 SCAR=0.0
Pod documented
9 4 ▶sub description { 'Email rejected due to a header content after SMTP DATA command' }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
10 1105 ▶sub match {
Subroutine match: called CC=3 SCAR=11.0
Pod documented
11 # Try to match that the given text and regular expressions
12 # @param [String] argv1 String to be matched with regular expressions
13 # @return [Integer] 0: Did not match
14 # 1: Matched
15 # @since v4.0.0
16 1105 my $class = shift;
17 1105 ▶ my $argv1 = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
11041
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
18  
19 1104 state $index = [
20 "account is protected by",
21 "has restricted sms e-mail", # AT&T
22 "is not accepting any mail",
23 "message filtered",
24 "message rejected due to user rules",
25 "not found recipient account",
26 "recipient id refuse to receive mail", # Willcom
27 "recipient is only accepting mail from specific email addresses", # AOL Phoenix
28 "refused due to recipient preferences", # Facebook
29 "user refuses to receive this mail",
30 "user reject",
31 "you have been blocked by the recipient",
32 ];
33 1104 ▶ return 1 if grep { rindex($argv1, $_) > -1 } @$index;
Branch: 1 branch
BranchTrueFalseTotal
if grep {rindex($argv1, $_) != -1;} @$index 10 1094 1104
34 1094 return 0;
35 }
36  
37 1360 ▶sub true {
Subroutine true: called CC=10 SCAR=23.0
Pod undocumented
38 # Rejected by domain or address filter ?
39 # @param [Sisimai::Fact] argvs Object to be detected the reason
40 # @return [Integer] 1: is Filtered
41 # 0: is not Filtered
42 # @since v4.0.0
43 # @see http://www.ietf.org/rfc/rfc2822.txt
44 1360 my $class = shift;
45 1360 ▶ my $argvs = shift // return 0; return 1 if $argvs->{'reason'} eq $Sisimai::Eb::ReFILT;
Branch: 1 branch
BranchTrueFalseTotal
if $argvs->{"reason"} eq $Sisimai::Eb::ReFILT 1 1358 1359
Condition100%2/2
shift() // (return 0)
l!l
13591
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
46  
47 1358 ▶ my $tempreason = Sisimai::SMTP::Status->name($argvs->{'deliverystatus'}) || '';
Condition100%2/2
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || ''
l!l
611747
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
48 1358 ▶ return 0 if $tempreason eq $Sisimai::Eb::ReQUIT;
Branch: 1 branch
BranchTrueFalseTotal
if $tempreason eq $Sisimai::Eb::ReQUIT 0 1358 1358
49  
50 1358 require Sisimai::Reason::UserUnknown;
51 1358 my $issuedcode = lc $argvs->{'diagnosticcode'};
52 1358 ▶ my $thecommand = $argvs->{'command'} || '';
Condition100%2/2
$argvs->{'command'} || ''
l!l
517841
MC/DC100%1/1
$argvs->{'command'} || ''
$argvs->{'command'}
Truth table100%2/2
A
A= $argvs->{'command'}
Aresult
11
00
53 1358 ▶ if( $tempreason eq $Sisimai::Eb::ReFILT ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tempreason eq $Sisimai::Eb::ReFILT) { } 40 1318 1358
54 # Delivery status code points "Filtered".
55 40 ▶ return 1 if Sisimai::Reason::UserUnknown->match($issuedcode);
Branch: 1 branch
BranchTrueFalseTotal
if "Sisimai::Reason::UserUnknown"->match($issuedcode) 30 10 40
56 10 return __PACKAGE__->match($issuedcode);
57  
58 } else {
59 # The value of "reason" isn't "Filtered" when the value of "command" is an SMTP command to
60 # be sent before the SMTP DATA command because all the MTAs read the headers and the entire
61 # message body after the DATA command.
62 1318 ▶ return 0 if grep { $argvs->{'command'} eq $_ } Sisimai::SMTP::Command->ExceptDATA->@*;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$argvs->{"command"} eq $_;} @{"Sisimai::SMTP::Command"->ExceptDATA} 327 991 1318
63 991 ▶ return 1 if __PACKAGE__->match($issuedcode);
Branch: 1 branch
BranchTrueFalseTotal
if __PACKAGE__->match($issuedcode) 1 990 991
64 990 return Sisimai::Reason::UserUnknown->match($issuedcode);
65 }
66 }
67  
68 57 1;
69 __END__
« Sisimai/Rhost/GoDaddy.pm ↑ Summary Sisimai/RFC791.pm »