File Coverage

blib/lib/Perl/Lint/Policy/References/ProhibitDoubleSigils.pm
Criterion Covered Total %
statement 23 24 95.8
branch 1 2 50.0
condition 2 6 33.3
subroutine 6 6 100.0
pod 0 1 0.0
total 32 39 82.0


line stmt bran cond sub pod time code
1             package Perl::Lint::Policy::References::ProhibitDoubleSigils;
2 134     134   107258 use strict;
  134         260  
  134         7431  
3 134     134   1775 use warnings;
  134         991  
  134         4165  
4 134     134   2018 use Perl::Lint::Constants::Type;
  134         2095  
  134         91589  
5 134     134   5530 use parent "Perl::Lint::Policy";
  134         230  
  134         3061  
6              
7             use constant {
8 134         27903 DESC => 'Double-sigil dereference',
9             EXPL => [228],
10 134     134   20938 };
  134         1167  
11              
12             sub evaluate {
13 2     2 0 6 my ($class, $file, $tokens, $args) = @_;
14              
15 2         3 my @violations;
16 2         3 my $token_num = scalar @$tokens;
17 2         7 for (my $i = 0; $i < $token_num; $i++) {
18 51         42 my $token = $tokens->[$i];
19 51         48 my $token_type = $token->{type};
20              
21 51 50 33     237 if (
      33        
22             $token_type == SHORT_SCALAR_DEREFERENCE ||
23             $token_type == SHORT_ARRAY_DEREFERENCE ||
24             $token_type == SHORT_HASH_DEREFERENCE
25             ) {
26 0         0 push @violations, {
27             filename => $file,
28             line => $token->{line},
29             description => DESC,
30             explanation => EXPL,
31             policy => __PACKAGE__,
32             };
33             }
34             }
35              
36 2         5 return \@violations;
37             }
38              
39             1;
40