Sisimai/Reason/RateLimited.pm

filter: Statementstmt 100% 28 / 28 Branchbran 87.5% 7 / 8 Conditioncond 100% 6 / 6 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 8 / 8 Podpod 50.0% 2 / 4 totaltotal 94.7% 54 / 57 CC 8 SCAR 11.4
CC
8
Cov
98%
true
5.0
match
4.0
BEGIN
1.0
CRAP 3.1
« Sisimai/Reason/Suspend.pm ↑ Summary Sisimai/Reason/RequirePTR.pm »
1 package Sisimai::Reason::RateLimited;
2 43 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 43 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 43 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 43 ▶use Sisimai::Eb;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 12 ▶sub text { $Sisimai::Eb::ReRATE }
Subroutine text: called CC=1 SCAR=0.0
Pod documented
8 4 ▶sub description { "Rejected due to exceeding a rate limit: sending too fast or too many concurrency connections" }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
9 835 ▶sub match {
Subroutine match: called CC=4 SCAR=13.9
Pod documented
10 # Try to match that the given text and regular expressions
11 # @param [String] argv1 String to be matched with regular expressions
12 # @return [Integer] 0: Did not match
13 # 1: Matched
14 # @since v4.1.26
15 835 my $class = shift;
16 835 ▶ my $argv1 = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
8341
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
17  
18 834 state $index = [
19 "has exceeded the max emails per hour ",
20 "please try again slower",
21 "receiving mail at a rate that prevents additional messages from being delivered",
22 "temporarily deferred due to unexpected volume or user complaints",
23 "throttling failure: ",
24 "too many errors from your ip", # Free.fr
25 "trop de connexions, ",
26 "we have already made numerous attempts to deliver this message",
27 ];
28 834 state $pairs = [
29 ["exceeded ", "allowable number of posts without solving a captcha"],
30 ["connection ", "limit"],
31 ["temporarily", "rate limited"],
32 ["throttled ", "postmaster.comcast.net"],
33 ["too many ", "session"], # Sendmail(daemon.c), comcast.net
34 ["too many ", "recipients"], # nttdocomo, comcast.net
35 ["too many con", "s"],
36 ];
37 834 ▶ return 1 if grep { rindex($argv1, $_) > -1 } @$index;
Branch: 1 branch
BranchTrueFalseTotal
if grep {rindex($argv1, $_) != -1;} @$index 3 831 834
38 831 ▶ return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
Branch: 1 branch
BranchTrueFalseTotal
if grep {"Sisimai::String"->aligned(\$argv1, $_);} @$pairs 18 813 831
39 813 return 0;
40 }
41  
42 742 ▶sub true {
Subroutine true: called CC=5 SCAR=16.1
Pod undocumented
43 # Blocked due to that connection rate limit exceeded
44 # @param [Sisimai::Fact] argvs Object to be detected the reason
45 # @return [Integer] 1: Rate limited
46 # 0: Not rate limited
47 # @since v4.1.26
48 # @see http://www.ietf.org/rfc/rfc2822.txt
49 742 my $class = shift;
50 742 ▶ my $argvs = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
7411
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
51  
52 741 ▶ return 1 if $argvs->{'reason'} eq $Sisimai::Eb::ReRATE;
Branch: 1 branch
BranchTrueFalseTotal
if $argvs->{"reason"} eq $Sisimai::Eb::ReRATE 1 740 741
53 740 ▶ return 1 if (Sisimai::SMTP::Status->name($argvs->{'deliverystatus'}) || '') eq $Sisimai::Eb::ReRATE;
Branch: 1 branch
BranchTrueFalseTotal
if ("Sisimai::SMTP::Status"->name($argvs->{"deliverystatus"}) || "") eq $Sisimai::Eb::ReRATE 0 740 740
Condition100%2/2
'Sisimai::SMTP::Status'->name($argvs->{'deliverystatus'}) || ''
l!l
303437
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
54 740 return __PACKAGE__->match(lc $argvs->{'diagnosticcode'});
55 }
56  
57 43 1;
58 __END__
« Sisimai/Reason/Suspend.pm ↑ Summary Sisimai/Reason/RequirePTR.pm »