line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::Modules::RequireNoMatchVarsWithUseEnglish; |
2
|
134
|
|
|
134
|
|
93274
|
use strict; |
|
134
|
|
|
|
|
270
|
|
|
134
|
|
|
|
|
4752
|
|
3
|
134
|
|
|
134
|
|
666
|
use warnings; |
|
134
|
|
|
|
|
207
|
|
|
134
|
|
|
|
|
3343
|
|
4
|
134
|
|
|
134
|
|
954
|
use Perl::Lint::Constants::Type; |
|
134
|
|
|
|
|
201
|
|
|
134
|
|
|
|
|
84377
|
|
5
|
134
|
|
|
134
|
|
897
|
use parent "Perl::Lint::Policy"; |
|
134
|
|
|
|
|
238
|
|
|
134
|
|
|
|
|
854
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
134
|
|
|
|
|
41867
|
DESC => '"use English" without "-no_match_vars" argument', |
9
|
|
|
|
|
|
|
EXPL => '"use English" without the "-no_match_vars" argument degrades performance', |
10
|
134
|
|
|
134
|
|
9165
|
}; |
|
134
|
|
|
|
|
240
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
24
|
|
|
24
|
0
|
40
|
my ($class, $file, $tokens, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
24
|
|
|
|
|
28
|
my @violations; |
16
|
24
|
|
|
|
|
69
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
17
|
317
|
|
|
|
|
272
|
my $token_type = $token->{type}; |
18
|
317
|
|
|
|
|
266
|
my $token_data = $token->{data}; |
19
|
317
|
100
|
100
|
|
|
843
|
if ($token_type == USED_NAME && $token_data eq 'English') { |
20
|
67
|
|
|
|
|
119
|
SCANNING: for ($i++; my $token = $tokens->[$i]; $i++) { |
21
|
186
|
|
|
|
|
150
|
my $token_type = $token->{type}; |
22
|
186
|
|
|
|
|
165
|
my $token_data = $token->{data}; |
23
|
186
|
100
|
100
|
|
|
777
|
if ( |
|
|
|
100
|
|
|
|
|
24
|
|
|
|
|
|
|
$token_type == STRING || |
25
|
|
|
|
|
|
|
$token_type == RAW_STRING || |
26
|
|
|
|
|
|
|
$token_type == REG_EXP |
27
|
|
|
|
|
|
|
) { |
28
|
65
|
|
|
|
|
111
|
for my $data (split / /, $token_data) { |
29
|
105
|
100
|
|
|
|
314
|
last SCANNING if $data =~ /\A-no_match_vars\Z/; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
126
|
100
|
|
|
|
379
|
if ($token_type == SEMI_COLON) { |
34
|
7
|
|
|
|
|
34
|
push @violations, { |
35
|
|
|
|
|
|
|
filename => $file, |
36
|
|
|
|
|
|
|
line => $token->{line}, |
37
|
|
|
|
|
|
|
description => DESC, |
38
|
|
|
|
|
|
|
explanation => EXPL, |
39
|
|
|
|
|
|
|
policy => __PACKAGE__, |
40
|
|
|
|
|
|
|
}; |
41
|
7
|
|
|
|
|
21
|
last; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
24
|
|
|
|
|
101
|
return \@violations; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|