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   91231 use strict;
  133         288  
  133         4815  
3 133     133   614 use warnings;
  133         222  
  133         3511  
4 133     133   964 use Perl::Lint::Constants::Type;
  133         233  
  133         81513  
5 133     133   817 use parent "Perl::Lint::Policy";
  133         255  
  133         959  
6              
7             use constant {
8 133         26802 DESC => '@ISA used instead of "use base"',
9             EXPL => [360],
10 133     133   9237 };
  133         258  
11              
12             sub evaluate {
13 3     3 0 4 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         55 my $token = $tokens->[$i];
19 68         51 my $token_type = $token->{type};
20 68         58 my $token_data = $token->{data};
21 68 100 100     277 if (($token_type == ARRAY_VAR || $token_type == GLOBAL_ARRAY_VAR) && $token_data eq '@ISA') {
      100        
22 8         30 push @violations, {
23             filename => $file,
24             line => $token->{line},
25             description => DESC,
26             explanation => EXPL,
27             policy => __PACKAGE__,
28             };
29             }
30             }
31              
32 3         12 return \@violations;
33             }
34              
35             1;
36