File Coverage

blib/lib/Perl/Lint/Policy/Subroutines/ProhibitSubroutinePrototypes.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 31 32 96.8


line stmt bran cond sub pod time code
1             package Perl::Lint::Policy::Subroutines::ProhibitSubroutinePrototypes;
2 133     133   90487 use strict;
  133         272  
  133         4877  
3 133     133   638 use warnings;
  133         223  
  133         3359  
4 133     133   1122 use Perl::Lint::Constants::Type;
  133         228  
  133         83925  
5 133     133   803 use parent "Perl::Lint::Policy";
  133         258  
  133         883  
6              
7             use constant {
8 133         24235 DESC => 'Subroutine prototypes used',
9             EXPL => [194],
10 133     133   9409 };
  133         288  
11              
12             sub evaluate {
13 3     3 0 6 my ($class, $file, $tokens, $args) = @_;
14              
15 3         5 my @violations;
16 3         12 for (my $i = 0; my $token = $tokens->[$i]; $i++) {
17 36         49 my $token_type = $token->{type};
18 36 100       74 if ($token_type == PROTOTYPE) {
19 4         58 push @violations, {
20             filename => $file,
21             line => $token->{line},
22             description => DESC,
23             explanation => EXPL,
24             policy => __PACKAGE__,
25             };
26 4         13 next;
27             }
28             }
29              
30 3         13 return \@violations;
31             }
32              
33             1;
34