File Coverage

lib/Sisimai/Reason/NotCompliantRFC.pm
Criterion Covered Total %
statement 20 20 100.0
branch 4 4 100.0
condition 4 4 100.0
subroutine 7 7 100.0
pod 2 4 50.0
total 37 39 94.8


line stmt bran cond sub pod time code
1             package Sisimai::Reason::NotCompliantRFC;
2 47     47   3101 use v5.26;
  47         187  
3 47     47   899 use strict;
  47         109  
  47         1453  
4 47     47   3995 use warnings;
  47         130  
  47         13753  
5              
6 11     11 1 37 sub text { 'notcompliantrfc' }
7 4     4 0 14 sub description { "Email rejected due to non-compliance with RFC" }
8             sub match {
9             # Try to match that the given text and regular expressions
10             # @param [String] argv1 String to be matched with regular expressions
11             # @return [Integer] 0: Did not match
12             # 1: Matched
13             # @since v5.0.0
14 984     984 1 3078 my $class = shift;
15 984   100     3017 my $argv1 = shift // return 0;
16              
17 983         1805 state $index = [
18             "duplicate header",
19             "message is not rfc 5322 compliant",
20             "multiple addresses in from: header are not accepted",
21             "rfc 1035 violation",
22             "https://support.google.com/mail/?p=rfcmessagenoncompliant",
23             ];
24 983 100       4533 return 1 if grep { rindex($argv1, $_) > -1 } @$index;
  4915         10759  
25 971         4003 return 0;
26             }
27              
28             sub true {
29             # Whether the email is RFC compliant or not
30             # @param [Sisimai::Fact] argvs Object to be detected the reason
31             # @return [Integer] 1: RFC compliant
32             # 0: Is not RFC compliant
33             # @since v5.0.0
34             # @see http://www.ietf.org/rfc/rfc5322.txt
35 984     984 0 2668 my $class = shift;
36 984   100     2893 my $argvs = shift // return 0;
37              
38 983 100       3812 return 1 if $argvs->{'reason'} eq 'notcompliantrfc';
39 982         4660 return __PACKAGE__->match(lc $argvs->{'diagnosticcode'});
40             }
41              
42             1;
43             __END__