File Coverage

blib/lib/Perl/Lint/Policy/BuiltinFunctions/RequireGlobFunction.pm
Criterion Covered Total %
statement 26 26 100.0
branch 6 6 100.0
condition n/a
subroutine 6 6 100.0
pod 0 1 0.0
total 38 39 97.4


line stmt bran cond sub pod time code
1             package Perl::Lint::Policy::BuiltinFunctions::RequireGlobFunction;
2 133     133   68123 use strict;
  133         198  
  133         3031  
3 133     133   416 use warnings;
  133         175  
  133         2445  
4 133     133   810 use Perl::Lint::Constants::Type;
  133         160  
  133         59318  
5 133     133   576 use parent "Perl::Lint::Policy";
  133         201  
  133         601  
6              
7             use constant {
8 133         22537 DESC => 'Glob written as <...>',
9             EXPL => [167],
10 133     133   6675 };
  133         202  
11              
12             sub evaluate {
13 5     5 0 9 my ($class, $file, $tokens, $src, $args) = @_;
14              
15 5         5 my @violations;
16 5         18 for (my $i = 0; my $token = $tokens->[$i]; $i++) {
17 81         59 my $token_type = $token->{type};
18              
19 81 100       207 if ($token_type == HANDLE_DELIM) {
20 10         17 for ($i++; my $token = $tokens->[$i]; $i++) {
21 44         32 my $token_type = $token->{type};
22              
23 44 100       89 if ($token_type == MUL) {
    100          
24             push @violations, {
25             filename => $file,
26             line => $token->{line},
27 9         48 description => DESC,
28             explanation => EXPL,
29             policy => __PACKAGE__,
30             };
31             }
32             elsif ($token_type == GREATER) {
33 9         18 last;
34             }
35             }
36             }
37             }
38              
39 5         18 return \@violations;
40             }
41              
42             1;
43