File Coverage

blib/lib/Perl/Critic/Policy/OTRS/ProhibitOpen.pm
Criterion Covered Total %
statement 22 22 100.0
branch 2 2 100.0
condition 3 3 100.0
subroutine 10 10 100.0
pod 5 5 100.0
total 42 42 100.0


line stmt bran cond sub pod time code
1             package Perl::Critic::Policy::OTRS::ProhibitOpen;
2              
3             # ABSTRACT: Do not use "open"
4              
5 24     24   14339 use strict;
  24         57  
  24         740  
6 24     24   135 use warnings;
  24         52  
  24         704  
7              
8 24     24   125 use Perl::Critic::Utils qw{ :severities :classification :ppi };
  24         50  
  24         1239  
9 24     24   8351 use base 'Perl::Critic::Policy';
  24         55  
  24         2331  
10              
11 24     24   167 use Readonly;
  24         46  
  24         5227  
12              
13             our $VERSION = '0.03';
14              
15             Readonly::Scalar my $DESC => q{Use of "open" is not allowed};
16             Readonly::Scalar my $EXPL => q{Use file operation methods of MainObject instead.};
17              
18 12     12 1 27899 sub supported_parameters { return; }
19 4     4 1 45 sub default_severity { return $SEVERITY_HIGHEST; }
20 1     1 1 764 sub default_themes { return qw( otrs otrs_lt_3_3 ) }
21 3     3 1 242453 sub applies_to { return 'PPI::Token::Word' }
22              
23             sub violates {
24 28     28 1 1619 my ( $self, $elem ) = @_;
25              
26 28 100 100     64 return if $elem ne 'open' and $elem ne 'CORE::open';
27 3         60 return $self->violation( $DESC, $EXPL, $elem );
28             }
29              
30             1;
31              
32             __END__
33              
34             =pod
35              
36             =encoding UTF-8
37              
38             =head1 NAME
39              
40             Perl::Critic::Policy::OTRS::ProhibitOpen - Do not use "open"
41              
42             =head1 VERSION
43              
44             version 0.09
45              
46             =head1 METHODS
47              
48             =head2 supported_parameters
49              
50             There are no supported parameters.
51              
52             =head1 AUTHOR
53              
54             Renee Baecker <info@perl-services.de>
55              
56             =head1 COPYRIGHT AND LICENSE
57              
58             This software is Copyright (c) 2013 by Renee Baecker.
59              
60             This is free software, licensed under:
61              
62             The Artistic License 2.0 (GPL Compatible)
63              
64             =cut