Perl/Lint/Policy/ValuesAndExpressions/ProhibitEmptyQuotes.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 83.3% 5 / 6 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 81.2% 39 / 48 CC 6 SCAR 13.8
CC
6
Cov
86%
evaluate
6.5
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« Perl/Lint/Keywords.pm ↑ Summary Perl/Lint/Policy/References/ProhibitDoubleSigils.pm »
1 package Perl::Lint::Policy::ValuesAndExpressions::ProhibitEmptyQuotes;
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 string containing no non-whitespace characters',
9 EXPL => [53],
10 3 };
11  
12 2 ▶sub evaluate {
Subroutine evaluate: called CC=6 SCAR=18.7
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 ▶ 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
19 1 my $string = $token->{data};
20 1 ▶ if (!$string || $string =~ /\A\s+\Z/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $string or $string =~ /\A\s+\Z/) 0 1 1
Condition33%1/3
not $string or $string =~ /\A\s+\Z/
l!l&&r!l&&!r
001
MC/DC0%0/2
not $string or $string =~ /\A\s+\Z/
not $string $string =~ /\A\s+\Z/
Truth table33%1/3
not(A) or B
A= not $stringB= $string =~ /\A\s+\Z/
ABresult
1X1
011
000
21 push @violations, {
22 filename => $file,
23 line => $token->{line},
24 0 description => DESC,
25 explanation => EXPL,
26 policy => __PACKAGE__,
27 };
28 }
29 }
30 }
31  
32 2 return \@violations;
33 }
34  
35 3 1;
36  
« Perl/Lint/Keywords.pm ↑ Summary Perl/Lint/Policy/References/ProhibitDoubleSigils.pm »