File Coverage

blib/lib/Perl/Critic/Policy/OTRS/ProhibitRmtree.pm
Criterion Covered Total %
statement 23 23 100.0
branch 3 4 75.0
condition n/a
subroutine 10 10 100.0
pod 5 5 100.0
total 41 42 97.6


line stmt bran cond sub pod time code
1             package Perl::Critic::Policy::OTRS::ProhibitRmtree;
2              
3             # ABSTRACT: Do not use File::Path's rmtree
4              
5 24     24   3998282 use strict;
  24         232  
  24         788  
6 24     24   133 use warnings;
  24         44  
  24         608  
7              
8 24     24   117 use Readonly;
  24         47  
  24         1253  
9              
10 24     24   145 use Perl::Critic::Utils qw{ :severities :classification :ppi };
  24         64  
  24         1691  
11 24     24   10286 use base 'Perl::Critic::Policy';
  24         53  
  24         13467  
12              
13             our $VERSION = '1.03';
14              
15             Readonly::Scalar my $DESC => q{ ERROR: Don't use File::Path::rmtree(). };
16             Readonly::Scalar my $EXPL => q{ It is obsolete and not thread safe in some versions of perl. Use File::Path::remove_tree() instead.' };
17              
18 12     12 1 28148 sub supported_parameters { return () }
19 3     3 1 31 sub default_severity { return $SEVERITY_HIGHEST; }
20 1     1 1 712 sub default_themes { return qw( otrs otrs_lt_3_3 ) }
21 3     3 1 183649 sub applies_to { return 'PPI::Token::Word' }
22              
23              
24             sub violates {
25 21     21 1 694 my ( $self, $elem, undef ) = @_;
26              
27 21 100       40 return if $elem ne 'rmtree';
28 2 50       28 return if !is_function_call($elem);
29              
30 2         540 return $self->violation( $DESC, $EXPL, $elem );
31             }
32              
33             1;
34              
35             __END__
36              
37             =pod
38              
39             =encoding UTF-8
40              
41             =head1 NAME
42              
43             Perl::Critic::Policy::OTRS::ProhibitRmtree - Do not use File::Path's rmtree
44              
45             =head1 VERSION
46              
47             version 0.09
48              
49             =head1 METHODS
50              
51             =head2 supported_parameters
52              
53             There are no supported parameters.
54              
55             =head1 AUTHOR
56              
57             Renee Baecker <info@perl-services.de>
58              
59             =head1 COPYRIGHT AND LICENSE
60              
61             This software is Copyright (c) 2013 by Renee Baecker.
62              
63             This is free software, licensed under:
64              
65             The Artistic License 2.0 (GPL Compatible)
66              
67             =cut