Sisimai/Reason/VirusDetected.pm

filter: Statementstmt 100% 32 / 32 Branchbran 87.5% 7 / 8 Conditioncond 100% 4 / 4 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 9 / 9 Podpod 50.0% 2 / 4 totaltotal 94.9% 56 / 59 CC 7 SCAR 9.6
CC
7
Cov
98%
match
4.0
true
4.0
BEGIN
1.0
CRAP 2.6
« Sisimai/Reason/PolicyViolation.pm ↑ Summary Sisimai/Fact/JSON.pm »
1 package Sisimai::Reason::VirusDetected;
2 46 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 46 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 46 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 46 ▶use Sisimai::Eb;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 46 ▶use Sisimai::SMTP::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 6 ▶sub text { $Sisimai::Eb::ReEXEC }
Subroutine text: called CC=1 SCAR=0.0
Pod documented
9 4 ▶sub description { 'Email rejected due to a virus scanner on a destination host' }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
10 1005 ▶sub match {
Subroutine match: called CC=4 SCAR=13.9
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.22.0
16 1005 my $class = shift;
17 1005 ▶ my $argv1 = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
10041
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
18  
19 1004 state $index = ["it has a potentially executable attachment"];
20 1004 state $pairs = [
21 ["message was ", "ected", " virus"],
22 ["virus", " detected"],
23 ];
24 1004 ▶ return 1 if grep { rindex($argv1, $_) > -1 } @$index;
Branch: 1 branch
BranchTrueFalseTotal
if grep {rindex($argv1, $_) != -1;} @$index 0 1004 1004
25 1004 ▶ return 1 if grep { Sisimai::String->aligned(\$argv1, $_) } @$pairs;
Branch: 1 branch
BranchTrueFalseTotal
if grep {"Sisimai::String"->aligned(\$argv1, $_);} @$pairs 12 992 1004
26 992 return 0;
27 }
28  
29 616 ▶sub true {
Subroutine true: called CC=4 SCAR=13.9
Pod undocumented
30 # The bounce reason is "VirusDetected" or not
31 # @param [Sisimai::Fact] argvs Object to be detected the reason
32 # @return [Integer] 1: virus detected
33 # 0: virus was not detected
34 # @since v4.22.0
35 # @see http://www.ietf.org/rfc/rfc2822.txt
36 616 my $class = shift;
37 616 ▶ my $argvs = shift // return 0;
Condition100%2/2
shift() // (return 0)
l!l
6151
MC/DC100%1/1
shift() // (return 0)
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
38  
39 # The value of "reason" isn't "VirusDetected" when the value of "command" is an SMTP command to
40 # be sent before the SMTP DATA command because all the MTAs read the headers and the entire
41 # message body after the DATA command.
42 615 ▶ return 1 if $argvs->{'reason'} eq $Sisimai::Eb::ReEXEC;
Branch: 1 branch
BranchTrueFalseTotal
if $argvs->{"reason"} eq $Sisimai::Eb::ReEXEC 1 614 615
43 614 ▶ return 0 if grep { $argvs->{'command'} eq $_ } Sisimai::SMTP::Command->ExceptDATA->@*;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$argvs->{"command"} eq $_;} @{"Sisimai::SMTP::Command"->ExceptDATA} 136 478 614
44 478 return __PACKAGE__->match(lc $argvs->{'diagnosticcode'});
45 }
46  
47 46 1;
48 __END__
« Sisimai/Reason/PolicyViolation.pm ↑ Summary Sisimai/Fact/JSON.pm »