« blib/lib/Perl/Lint/Policy/ClassHierarchies/ProhibitAutoloading.pm
↑ Summary
blib/lib/Perl/Lint/Policy/ClassHierarchies/ProhibitOneArgBless.pm »
| 1 | package Perl::Lint::Policy::ClassHierarchies::ProhibitExplicitISA; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Perl::Lint::Constants::Type; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 5 | use parent "Perl::Lint::Policy"; | ||
| 6 | |||
| 7 | use constant { | ||
| 8 | DESC => '@ISA used instead of "use base"', | ||
| 9 | EXPL => [360], | ||
| 10 | }; | ||
| 11 | |||
| 12 | sub evaluate { | ||
| 13 | my ($class, $file, $tokens, $args) = @_; | ||
| 14 | |||
| 15 | my @violations; | ||
| 16 | my $token_num = scalar @$tokens; | ||
| 17 | for (my $i = 0; $i < $token_num; $i++) { | ||
| 18 | my $token = $tokens->[$i]; | ||
| 19 | my $token_type = $token->{type}; | ||
| 20 | my $token_data = $token->{data}; | ||
| 21 | if (($token_type == ARRAY_VAR || $token_type == GLOBAL_ARRAY_VAR) && $token_data eq '@ISA') { | ||
| 22 | push @violations, { | ||
| 23 | filename => $file, | ||
| 24 | line => $token->{line}, | ||
| 25 | description => DESC, | ||
| 26 | explanation => EXPL, | ||
| 27 | policy => __PACKAGE__, | ||
| 28 | }; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | return \@violations; | ||
| 33 | } | ||
| 34 | |||
| 35 | 1; | ||
| 36 | |||