Perl/Lint/Policy/Modules/RequireNoMatchVarsWithUseEnglish.pm

filter: Statementstmt 71.8% 23 / 32 Branchbran 25.0% 3 / 12 Conditioncond 22.2% 2 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 52.3% 34 / 65 CC 11 SCAR 35.1
CC
11
Cov
53%
evaluate
48.3
BEGIN
1.0
BEGIN
1.0
CRAP 33.5
« Perl/Lint/Policy/BuiltinFunctions/ProhibitStringySplit.pm ↑ Summary Perl/Lint/Policy/Modules/ProhibitAutomaticExportation.pm »
1 package Perl::Lint::Policy::Modules::RequireNoMatchVarsWithUseEnglish;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Perl::Lint::Constants::Type;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use parent "Perl::Lint::Policy";
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 DESC => '"use English" without "-no_match_vars" argument',
9 EXPL => '"use English" without the "-no_match_vars" argument degrades performance',
10 3 };
11  
12 2 ▶sub evaluate {
Subroutine evaluate: called CC=11 SCAR=38.8
Pod undocumented
13 2 my ($class, $file, $tokens, $args) = @_;
14  
15 2 my @violations;
16 2 ▶ for (my $i = 0; my $token = $tokens->[$i]; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = $tokens->[$i]) 51 2 53
17 51 my $token_type = $token->{type};
18 51 my $token_data = $token->{data};
19 51 ▶ if ($token_type == USED_NAME && $token_data eq 'English') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 94 and $token_data eq "English") 0 51 51
Condition66%2/3
$token_type == 94 and $token_data eq "English"
!ll&&!rl&&r
4380
MC/DC0%0/2
$token_type == 94 and $token_data eq "English"
$token_type == 94 $token_data eq "English"
Truth table66%2/3
A and B
A= $token_type == 94B= $token_data eq "English"
ABresult
0X0
100
111
20 0 ▶ SCANNING: for ($i++; my $token = $tokens->[$i]; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = $tokens->[$i]) 0 0 0
21 0 my $token_type = $token->{type};
22 0 my $token_data = $token->{data};
23 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 172 or $token_type == 173 or $token_type == 187) 0 0 0
Condition0%0/6
$token_type == 172 or $token_type == 173 or $token_type == 187
l!l&&r!l&&!r
000
$token_type == 172 or $token_type == 173
l!l&&r!l&&!r
000
MC/DC0%0/3
$token_type == 172 or $token_type == 173 or $token_type == 187
$token_type == 172 $token_type == 173 $token_type == 187
Truth table0%0/4
A or B or C
A= $token_type == 172B= $token_type == 173C= $token_type == 187
ABCresult
1XX1
01X1
0011
0000
24 $token_type == STRING ||
25 $token_type == RAW_STRING ||
26 $token_type == REG_EXP
27 ) {
28 0 for my $data (split / /, $token_data) {
29 0 ▶ last SCANNING if $data =~ /\A-no_match_vars\Z/;
Branch: 1 branch
BranchTrueFalseTotal
if $data =~ /\A-no_match_vars\Z/ 0 0 0
30 }
31 }
32  
33 0 ▶ if ($token_type == SEMI_COLON) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 106) 0 0 0
34 push @violations, {
35 filename => $file,
36 line => $token->{line},
37 0 description => DESC,
38 explanation => EXPL,
39 policy => __PACKAGE__,
40 };
41 0 last;
42 }
43 }
44 }
45 }
46  
47 2 return \@violations;
48 }
49  
50 3 1;
51  
« Perl/Lint/Policy/BuiltinFunctions/ProhibitStringySplit.pm ↑ Summary Perl/Lint/Policy/Modules/ProhibitAutomaticExportation.pm »