File Coverage

blib/lib/Perl/Lint/Policy/InputOutput/ProhibitInteractiveTest.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition 3 3 100.0
subroutine 6 6 100.0
pod 0 1 0.0
total 34 35 97.1


line stmt bran cond sub pod time code
1             package Perl::Lint::Policy::InputOutput::ProhibitInteractiveTest;
2 133     133   68320 use strict;
  133         197  
  133         3141  
3 133     133   446 use warnings;
  133         171  
  133         2578  
4 133     133   798 use Perl::Lint::Constants::Type;
  133         169  
  133         60018  
5 133     133   600 use parent "Perl::Lint::Policy";
  133         195  
  133         591  
6              
7             use constant {
8 133         19573 DESC => 'Use IO::Interactive::is_interactive() instead of -t',
9             EXPL => [218],
10 133     133   6699 };
  133         188  
11              
12             sub evaluate {
13 3     3 0 5 my ($class, $file, $tokens, $src, $args) = @_;
14              
15 3         4 my @violations;
16 3         289 for (my $i = 0; my $token = $tokens->[$i]; $i++) {
17 23         20 my $token_type = $token->{type};
18 23         39 my $token_data = $token->{data};
19 23 100 100     60 if ($token_type == HANDLE && $token_data eq '-t') {
20             push @violations, {
21             filename => $file,
22             line => $token->{line},
23 7         27 description => DESC,
24             explanation => EXPL,
25             policy => __PACKAGE__,
26             };
27             }
28             }
29              
30 3         10 return \@violations;
31             }
32              
33             1;
34