« Perl/Lint/Policy/Variables/ProtectPrivateVars.pm
↑ Summary
Perl/Lint/Policy/ControlStructures/ProhibitCStyleForLoops.pm »
| 1 | package Perl::Lint::Policy::Miscellanea::ProhibitFormats; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use Perl::Lint::Constants::Type; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use parent "Perl::Lint::Policy"; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use constant { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | DESC => 'Format used', | |||||||||
| 9 | EXPL => [449], | ||||||||||
| 10 | 2 | }; | |||||||||
| 11 | |||||||||||
| 12 | 0 | ▶ | sub evaluate { | ||||||||
|
Subroutine
evaluate: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 13 | 0 | my ($class, $file, $tokens, $args) = @_; | |||||||||
| 14 | |||||||||||
| 15 | 0 | my @violations; | |||||||||
| 16 | my $next_token; | ||||||||||
| 17 | 0 | ▶ | for (my $i = 0; my $token = $tokens->[$i]; $i++) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 0 | ▶ | if ($token->{type} == FORMAT_DECL) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | 0 | $next_token = $tokens->[$i+1]; | |||||||||
| 20 | 0 | ▶ | if ($next_token->{type} != ARROW) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | # XXX workaround for Compiler::Lexer | ||||||||||
| 22 | # ref: https://github.com/goccy/p5-Compiler-Lexer/issues/33 | ||||||||||
| 23 | push @violations, { | ||||||||||
| 24 | filename => $file, | ||||||||||
| 25 | line => $token->{line}, | ||||||||||
| 26 | 0 | description => DESC, | |||||||||
| 27 | explanation => EXPL, | ||||||||||
| 28 | policy => __PACKAGE__, | ||||||||||
| 29 | }; | ||||||||||
| 30 | } | ||||||||||
| 31 | } | ||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 0 | return \@violations; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 2 | 1; | |||||||||
| 38 | |||||||||||