File Coverage

blib/lib/Perl/Critic/Policy/OTRS/ProhibitLocaltime.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::ProhibitLocaltime;
2              
3             # ABSTRACT: do not use "localtime"
4              
5 24     24   15115 use strict;
  24         66  
  24         682  
6 24     24   157 use warnings;
  24         50  
  24         675  
7              
8 24     24   147 use Perl::Critic::Utils qw{ :severities :classification :ppi };
  24         48  
  24         1247  
9 24     24   8786 use base 'Perl::Critic::Policy';
  24         50  
  24         2613  
10              
11 24     24   164 use Readonly;
  24         55  
  24         4938  
12              
13             our $VERSION = '0.03';
14              
15             Readonly::Scalar my $DESC => q{Use of "localtime" is not allowed};
16             Readonly::Scalar my $EXPL => q{Use methods of TimeObject instead.};
17              
18 12     12 1 28426 sub supported_parameters { return; }
19 4     4 1 43 sub default_severity { return $SEVERITY_HIGHEST; }
20 1     1 1 753 sub default_themes { return qw( otrs otrs_lt_3_3 ) }
21 3     3 1 229933 sub applies_to { return 'PPI::Token::Word' }
22              
23             sub violates {
24 22     22 1 946 my ( $self, $elem ) = @_;
25              
26 22 100       55 return if $elem ne 'localtime';
27 3         49 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::ProhibitLocaltime - do not use "localtime"
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