File Coverage

blib/lib/Perl/Lint/Policy/ClassHierarchies/ProhibitExplicitISA.pm
Criterion Covered Total %
statement 25 25 100.0
branch 2 2 100.0
condition 6 6 100.0
subroutine 6 6 100.0
pod 0 1 0.0
total 39 40 97.5


line stmt bran cond sub pod time code
1             package Perl::Lint::Policy::ClassHierarchies::ProhibitExplicitISA;
2 133     133   67804 use strict;
  133         164  
  133         3066  
3 133     133   408 use warnings;
  133         157  
  133         2827  
4 133     133   795 use Perl::Lint::Constants::Type;
  133         163  
  133         59893  
5 133     133   571 use parent "Perl::Lint::Policy";
  133         181  
  133         600  
6              
7             use constant {
8 133         20812 DESC => '@ISA used instead of "use base"',
9             EXPL => [360],
10 133     133   6701 };
  133         195  
11              
12             sub evaluate {
13 3     3 0 6 my ($class, $file, $tokens, $args) = @_;
14              
15 3         3 my @violations;
16 3         4 my $token_num = scalar @$tokens;
17 3         8 for (my $i = 0; $i < $token_num; $i++) {
18 68         51 my $token = $tokens->[$i];
19 68         45 my $token_type = $token->{type};
20 68         45 my $token_data = $token->{data};
21 68 100 100     217 if (($token_type == ARRAY_VAR || $token_type == GLOBAL_ARRAY_VAR) && $token_data eq '@ISA') {
      100        
22             push @violations, {
23             filename => $file,
24             line => $token->{line},
25 8         35 description => DESC,
26             explanation => EXPL,
27             policy => __PACKAGE__,
28             };
29             }
30             }
31              
32 3         9 return \@violations;
33             }
34              
35             1;
36