File Coverage

blib/lib/Perl/Critic/Policy/OTRS/ProhibitDumper.pm
Criterion Covered Total %
statement 23 23 100.0
branch 3 4 75.0
condition 3 3 100.0
subroutine 10 10 100.0
pod 5 5 100.0
total 44 45 97.7


line stmt bran cond sub pod time code
1             package Perl::Critic::Policy::OTRS::ProhibitDumper;
2              
3             # ABSTRACT: Check module for use of "Dumper"
4              
5 24     24   15066 use strict;
  24         67  
  24         648  
6 24     24   117 use warnings;
  24         48  
  24         640  
7              
8 24     24   126 use Perl::Critic::Utils qw{ :severities :classification :ppi };
  24         46  
  24         1105  
9 24     24   9260 use base 'Perl::Critic::Policy';
  24         51  
  24         2135  
10              
11 24     24   147 use Readonly;
  24         52  
  24         5171  
12              
13             our $VERSION = '0.04';
14              
15             Readonly::Scalar my $DESC => q{Use of "Dumper" is not allowed.};
16             Readonly::Scalar my $EXPL => q{Use "Dump" method of MainObject instead};
17              
18 12     12 1 2455291 sub supported_parameters { return; }
19 3     3 1 45 sub default_severity { return $SEVERITY_HIGHEST; }
20 1     1 1 567 sub default_themes { return qw( otrs otrs_lt_3_3 ) }
21 8     8 1 262634 sub applies_to { return 'PPI::Token::Word' }
22              
23             sub violates {
24 36     36 1 1011 my ( $self, $elem ) = @_;
25              
26 36 100 100     79 return if $elem ne 'Dumper' && $elem ne 'Data::Dumper::Dumper';
27 2 50       45 return if !is_function_call( $elem );
28 2         754 return $self->violation( $DESC, $EXPL, $elem );
29             }
30              
31             1;
32              
33             __END__
34              
35             =pod
36              
37             =encoding UTF-8
38              
39             =head1 NAME
40              
41             Perl::Critic::Policy::OTRS::ProhibitDumper - Check module for use of "Dumper"
42              
43             =head1 VERSION
44              
45             version 0.09
46              
47             =head1 METHODS
48              
49             =head2 supported_parameters
50              
51             There are no supported parameters.
52              
53             =head1 AUTHOR
54              
55             Renee Baecker <info@perl-services.de>
56              
57             =head1 COPYRIGHT AND LICENSE
58              
59             This software is Copyright (c) 2013 by Renee Baecker.
60              
61             This is free software, licensed under:
62              
63             The Artistic License 2.0 (GPL Compatible)
64              
65             =cut