Perl/Lint/Policy/ValuesAndExpressions/ProhibitNoisyQuotes.pm

filter: Statementstmt 89.6% 26 / 29 Branchbran 75.0% 6 / 8 Conditioncond 66.6% 4 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 79.6% 43 / 54 CC 7 SCAR 16.1
CC
7
Cov
84%
evaluate
7.9
BEGIN
1.0
BEGIN
1.0
CRAP 5.0
« Perl/Lint/Policy/ValuesAndExpressions/RequireQuotedHeredocTerminator.pm ↑ Summary Perl/Lint/Keywords.pm »
1 package Perl::Lint::Policy::ValuesAndExpressions::ProhibitNoisyQuotes;
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 => 'Quotes used with a noisy string',
9 EXPL => [53],
10 3 };
11  
12 2 ▶sub evaluate {
Subroutine evaluate: called CC=7 SCAR=20.6
Pod undocumented
13 2 my ($class, $file, $tokens, $src, $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  
20 51 ▶ if ($token_type == STRING || $token_type == RAW_STRING) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 172 or $token_type == 173) 1 50 51
Condition66%2/3
$token_type == 172 or $token_type == 173
l!l&&r!l&&!r
0150
MC/DC50%1/2
$token_type == 172 or $token_type == 173
$token_type == 172 $token_type == 173
Truth table66%2/3
A or B
A= $token_type == 172B= $token_type == 173
ABresult
1X1
011
000
21 1 ▶ if ($token_data =~ /\A[^\w(){}[\]<>]{1,2}\Z/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_data =~ /\A[^\w(){}[\]<>]{1,2}\Z/) 0 1 1
22 push @violations, {
23 filename => $file,
24 line => $token->{line},
25 0 description => DESC,
26 explanation => EXPL,
27 policy => __PACKAGE__,
28 };
29 }
30 1 next;
31 }
32  
33 50 ▶ if ($token_type == USED_NAME && $token_data eq 'overload') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 94 and $token_data eq "overload") 0 50 50
Condition66%2/3
$token_type == 94 and $token_data eq "overload"
!ll&&!rl&&r
4280
MC/DC0%0/2
$token_type == 94 and $token_data eq "overload"
$token_type == 94 $token_data eq "overload"
Truth table66%2/3
A and B
A= $token_type == 94B= $token_data eq "overload"
ABresult
0X0
100
111
34 0 $i++; # skip the argument of overload
35 0 next;
36 }
37 }
38  
39 2 return \@violations;
40 }
41  
42 3 1;
43  
« Perl/Lint/Policy/ValuesAndExpressions/RequireQuotedHeredocTerminator.pm ↑ Summary Perl/Lint/Keywords.pm »