« 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
| |||||||||||||||||||||||||||||
| 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
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
| |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | if ($token_data =~ /\A[^\w(){}[\]<>]{1,2}\Z/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition66%2/3
$token_type == 94 and $token_data eq "overload"
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"
| |||||||||||||||||||||||||||||
| 34 | 0 | $i++; # skip the argument of overload | |||||||||||||||||||||||||||
| 35 | 0 | next; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 2 | return \@violations; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 3 | 1; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||