Sisimai/Reason/RequirePTR.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 8 / 8 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 9 / 9 Podpod 25.0% 1 / 4 totaltotal 95.0% 58 / 61 CC 8 SCAR 11.0
CC
8
Cov
100%
true
5.0
match
4.0
BEGIN
1.0
CRAP 3.0
« Sisimai/Reason/RateLimited.pm ↑ Summary Sisimai/Reason/AuthFailure.pm »
1 package Sisimai::Reason::RequirePTR;
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  
8 92 ▶sub text { $Sisimai::Eb::ReQPTR }
Subroutine text: called CC=1 SCAR=0.0
Pod documented
9 4 ▶sub description { 'Email rejected due to missing PTR record or having invalid PTR record' }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
10 1152 ▶sub match {
Subroutine match: called CC=4 SCAR=13.9
Pod undocumented
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 v5.0.0
16 1152 my $class = shift;
17 1152 ▶ my $argv1 = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
11511
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
18  
19 1151 state $index = [
20 "cannot find your hostname",
21 "cannot resolve your address.",
22 "corresponding forward dns entry does not point to the sending ip", # Google
23 "ip name lookup failed",
24 "no matches to nameserver query",
25 "ptr lookup failure",
26 "sender ip reverse lookup rejected",
27 "unresolvable relay host name",
28 ];
29 1151 state $pairs = [
30 ["domain "," mismatches client ip"],
31 ["domain name verification on your ip address ", "failed"],
32 ["dns lookup failure: ", " try again later"],
33 ["ptr", "record"],
34 ["reverse", " dns"],
35 ["server access ", " forbidden by invalid rdns record of your mail server"],
36 ["service permits ", " unverifyable sending ips"],
37 ];
38  
39 1151 ▶ return 1 if grep { rindex($argv1, $_) > -1 } @$index;
Branch: 1 branch
BranchTrueFalseTotal
if grep {rindex($argv1, $_) != -1;} @$index 11 1140 1151
40 1140 ▶ return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
Branch: 1 branch
BranchTrueFalseTotal
if grep {"Sisimai::String"->aligned(\$argv1, $_);} @$pairs 76 1064 1140
41 1064 return 0;
42 }
43  
44 1158 ▶sub true {
Subroutine true: called CC=5 SCAR=16.1
Pod undocumented
45 # Rejected due to missing PTR record or having invalid PTR record
46 # @param [Sisimai::Fact] argvs Object to be detected the reason
47 # @return [Integer] 1: is missing PTR or invalid PTR
48 # [Integer] 0: is not blocked due to missing PTR record
49 # @see http://www.ietf.org/rfc/rfc2822.txt
50 # @since v5.0.0
51 1158 my $class = shift;
52 1158 ▶ my $argvs = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
11571
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
53  
54 1157 ▶ return 1 if $argvs->{'reason'} eq $Sisimai::Eb::ReQPTR;
Branch: 1 branch
BranchTrueFalseTotal
if $argvs->{"reason"} eq $Sisimai::Eb::ReQPTR 1 1156 1157
55 1156 ▶ return 1 if (Sisimai::SMTP::Status->name($argvs->{'deliverystatus'}) || '') eq $Sisimai::Eb::ReQPTR;
Branch: 1 branch
BranchTrueFalseTotal
if ("Sisimai::SMTP::Status"->name($argvs->{"deliverystatus"}) || "") eq $Sisimai::Eb::ReQPTR 10 1146 1156
Condition100%2/2
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || ''
l!l
551605
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
56 1146 return __PACKAGE__->match(lc $argvs->{'diagnosticcode'});
57 }
58  
59 51 1;
60 __END__
« Sisimai/Reason/RateLimited.pm ↑ Summary Sisimai/Reason/AuthFailure.pm »