line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::Lint::Policy::ValuesAndExpressions::ProhibitNoisyQuotes; |
2
|
134
|
|
|
134
|
|
67754
|
use strict; |
|
134
|
|
|
|
|
178
|
|
|
134
|
|
|
|
|
3167
|
|
3
|
134
|
|
|
134
|
|
398
|
use warnings; |
|
134
|
|
|
|
|
148
|
|
|
134
|
|
|
|
|
2379
|
|
4
|
134
|
|
|
134
|
|
742
|
use Perl::Lint::Constants::Type; |
|
134
|
|
|
|
|
164
|
|
|
134
|
|
|
|
|
59938
|
|
5
|
134
|
|
|
134
|
|
556
|
use parent "Perl::Lint::Policy"; |
|
134
|
|
|
|
|
153
|
|
|
134
|
|
|
|
|
573
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use constant { |
8
|
134
|
|
|
|
|
92408
|
DESC => 'Quotes used with a noisy string', |
9
|
|
|
|
|
|
|
EXPL => [53], |
10
|
134
|
|
|
134
|
|
6766
|
}; |
|
134
|
|
|
|
|
178
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub evaluate { |
13
|
7
|
|
|
7
|
0
|
12
|
my ($class, $file, $tokens, $src, $args) = @_; |
14
|
|
|
|
|
|
|
|
15
|
7
|
|
|
|
|
6
|
my @violations; |
16
|
7
|
|
|
|
|
24
|
for (my $i = 0; my $token = $tokens->[$i]; $i++) { |
17
|
234
|
|
|
|
|
155
|
my $token_type = $token->{type}; |
18
|
234
|
|
|
|
|
147
|
my $token_data = $token->{data}; |
19
|
|
|
|
|
|
|
|
20
|
234
|
100
|
100
|
|
|
529
|
if ($token_type == STRING || $token_type == RAW_STRING) { |
21
|
39
|
100
|
|
|
|
69
|
if ($token_data =~ /\A[^\w(){}[\]<>]{1,2}\Z/) { |
22
|
|
|
|
|
|
|
push @violations, { |
23
|
|
|
|
|
|
|
filename => $file, |
24
|
|
|
|
|
|
|
line => $token->{line}, |
25
|
8
|
|
|
|
|
26
|
description => DESC, |
26
|
|
|
|
|
|
|
explanation => EXPL, |
27
|
|
|
|
|
|
|
policy => __PACKAGE__, |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
} |
30
|
39
|
|
|
|
|
60
|
next; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
195
|
100
|
100
|
|
|
399
|
if ($token_type == USED_NAME && $token_data eq 'overload') { |
34
|
1
|
|
|
|
|
2
|
$i++; # skip the argument of overload |
35
|
1
|
|
|
|
|
3
|
next; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
7
|
|
|
|
|
26
|
return \@violations; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|