« Perl/Lint/Policy/Subroutines/ProhibitBuiltinHomonyms.pm
↑ Summary
Perl/Lint/Policy/Modules/RequireNoMatchVarsWithUseEnglish.pm »
| 1 | package Perl::Lint::Policy::BuiltinFunctions::ProhibitStringySplit; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 => 'String delimiter used with "split"', | |||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | EXPL => 'Express it as a regex instead', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | sub evaluate { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
evaluate: called CC=11 SCAR=39.9
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 == BUILTIN_FUNC && $token_data eq 'split') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$token_type == 70 and $token_data eq "split"
MC/DC0%0/2
$token_type == 70 and $token_data eq "split"
$token_type == 70
$token_data eq "split"
Truth table66%2/3
A and B
A= $token_type == 70B= $token_data eq "split"
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | $token = $tokens->[++$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | if ($token->{type} == LEFT_PAREN) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | $token = $tokens->[++$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | $token_data = $token->{data}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$token_type == 172 || $token_type == 173 and $token_data ne " "
$token_type == 172 or $token_type == 173
MC/DC0%0/3
$token_type == 172 || $token_type == 173 and $token_data ne " "
$token_type == 172
$token_type == 173
$token_data ne " "
Truth table0%0/5
A or B and C
A= $token_type == 172B= $token_type == 173C= $token_data ne " "
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ($token_type == STRING || $token_type == RAW_STRING) && | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | $token_data ne ' ' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | push @violations, { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | filename => $file, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | line => $token->{line}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | description => DESC, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | explanation => EXPL, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | ▶ | elsif ($token_type == REG_QUOTE || $token_type == REG_DOUBLE_QUOTE) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$token_type == 145 or $token_type == 146
MC/DC0%0/2
$token_type == 145 or $token_type == 146
$token_type == 145
$token_type == 146
Truth table0%0/3
A or B
A= $token_type == 145B= $token_type == 146
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | $i += 2; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if ($tokens->[$i]->{data} ne ' ') { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | push @violations, { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | filename => $file, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | line => $token->{line}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | description => DESC, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | explanation => EXPL, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | return \@violations; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||