| 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
| |||||||||||||||||||||||||||||
| 17 | 51 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||
| 18 | 51 | ▶ | if ($token_type == STRING || $token_type == RAW_STRING) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$token_type == 172 or $token_type == 173
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
| |||||||||||||||||||||||||||||
| 19 | 1 | my $string = $token->{data}; | |||||||||||||||||||||||||||
| 20 | 1 | ▶ | if (!$string || $string =~ /\A\s+\Z/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not $string or $string =~ /\A\s+\Z/
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/
| |||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||