File Coverage

blib/lib/Perl/Critic/Policy/OTRS/ProhibitRequire.pm
Criterion Covered Total %
statement 22 22 100.0
branch 2 2 100.0
condition n/a
subroutine 10 10 100.0
pod 5 5 100.0
total 39 39 100.0


line stmt bran cond sub pod time code
1             package Perl::Critic::Policy::OTRS::ProhibitRequire;
2              
3             # ABSTRACT: Do not use "require"
4              
5 24     24   15432 use strict;
  24         61  
  24         684  
6 24     24   119 use warnings;
  24         50  
  24         699  
7              
8 24     24   148 use Perl::Critic::Utils qw{ :severities :classification :ppi };
  24         46  
  24         1173  
9 24     24   8507 use base 'Perl::Critic::Policy';
  24         53  
  24         2255  
10              
11 24     24   163 use Readonly;
  24         50  
  24         4668  
12              
13             our $VERSION = '0.03';
14              
15             Readonly::Scalar my $DESC => q{Use of "require" is not allowed};
16             Readonly::Scalar my $EXPL => q{Use Require() method of MainObject instead.};
17              
18 12     12 1 28401 sub supported_parameters { return; }
19 3     3 1 28 sub default_severity { return $SEVERITY_HIGHEST; }
20 1     1 1 693 sub default_themes { return qw( otrs otrs_lt_3_3 ) }
21 3     3 1 177815 sub applies_to { return 'PPI::Token::Word' }
22              
23             sub violates {
24 19     19 1 504 my ( $self, $elem ) = @_;
25              
26 19 100       35 return if $elem ne 'require';
27 2         29 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::ProhibitRequire - Do not use "require"
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