« Perl/Lint/Policy/Subroutines/ProhibitAmpersandSigils.pm
↑ Summary
Perl/Lint/Policy/ControlStructures/ProhibitUnlessBlocks.pm »
| 1 | package Perl::Lint::Policy::RegularExpressions::ProhibitUselessTopic; | ||||||||||||||||||||||||||||
| 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 => 'Useless use of $_', | |||||||||||||||||||||||||||
| 9 | EXPL => '$_ should be omitted when matching a regular expression', | ||||||||||||||||||||||||||||
| 10 | 3 | }; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | sub evaluate { | ||||||||||||||||||||||||||
|
Subroutine
evaluate: called CC=9 SCAR=36.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 2 | my ($class, $file, $tokens, $src, $args) = @_; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 2 | my @violations; | |||||||||||||||||||||||||||
| 16 | 2 | ▶ | for (my $i = 0, my $token_type; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | 51 | $token_type = $token->{type}; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 51 | ▶ | if ($token_type == SPECIFIC_VALUE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 0 | ▶ | $token = $tokens->[++$i] or last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 0 | $token_type = $token->{type}; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | if ($token_type == REG_OK || $token_type == REG_NOT) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$token_type == 35 or $token_type == 36
MC/DC0%0/2
$token_type == 35 or $token_type == 36
$token_type == 35
$token_type == 36
Truth table0%0/3
A or B
A= $token_type == 35B= $token_type == 36
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $token = $tokens->[++$i] or last; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 0 | $token_type = $token->{type}; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | if ($token_type != VAR && $token_type != GLOBAL_VAR) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$token_type != 166 and $token_type != 194
MC/DC0%0/2
$token_type != 166 and $token_type != 194
$token_type != 166
$token_type != 194
Truth table0%0/3
A and B
A= $token_type != 166B= $token_type != 194
| |||||||||||||||||||||||||||||
| 28 | push @violations, { | ||||||||||||||||||||||||||||
| 29 | filename => $file, | ||||||||||||||||||||||||||||
| 30 | line => $token->{line}, | ||||||||||||||||||||||||||||
| 31 | 0 | description => DESC, | |||||||||||||||||||||||||||
| 32 | explanation => EXPL, | ||||||||||||||||||||||||||||
| 33 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||
| 34 | }; | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 2 | return \@violations; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 3 | 1; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||