| 1 | package Perl::Critic::Policy::ValuesAndExpressions::ProhibitFiletest_rwxRWX; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use 5.006001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use Readonly; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 2 | ▶ | use version; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | use base 'Perl::Critic::Policy'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | use Perl::Critic::Utils qw{ :severities :classification :ppi :booleans | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 2 | :language hashify }; | |||||||||
| 15 | 2 | ▶ | use PPI; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 2 | ▶ | use PPI::Document; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 2 | our $VERSION = '0.003'; | |||||||||
| 19 | |||||||||||
| 20 | #----------------------------------------------------------------------------- | ||||||||||
| 21 | |||||||||||
| 22 | 2 | Readonly::Scalar my $DESC => q{Use of file access test %s}; | |||||||||
| 23 | 2 | Readonly::Scalar my $EXPL => | |||||||||
| 24 | q{File access test results may not reflect actual accessability}; | ||||||||||
| 25 | |||||||||||
| 26 | 2 | Readonly::Hash my %FILE_ACCESS => hashify( qw{ -r -w -x -R -W -X } ); | |||||||||
| 27 | |||||||||||
| 28 | #----------------------------------------------------------------------------- | ||||||||||
| 29 | |||||||||||
| 30 | 3 | ▶ | sub supported_parameters { return () } | ||||||||
|
Subroutine
supported_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 31 | |||||||||||
| 32 | 6 | ▶ | sub default_severity { return $SEVERITY_LOW } | ||||||||
|
Subroutine
default_severity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 33 | 0 | ▶ | sub default_themes { return qw( bugs trw ) } | ||||||||
|
Subroutine
default_themes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 34 | 2 | ▶ | sub applies_to { return 'PPI::Token::Operator' } | ||||||||
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 35 | |||||||||||
| 36 | #----------------------------------------------------------------------------- | ||||||||||
| 37 | |||||||||||
| 38 | 27 | ▶ | sub violates { | ||||||||
|
Subroutine
violates: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 39 | 27 | my ( $self, $elem ) = @_; | |||||||||
| 40 | |||||||||||
| 41 | 27 | ▶ | $elem | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | or return; | ||||||||||
| 43 | |||||||||||
| 44 | 27 | ▶ | $FILE_ACCESS{ $elem->content() } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | or return; | ||||||||||
| 46 | |||||||||||
| 47 | 6 | return $self->violation( | |||||||||
| 48 | sprintf( $DESC, $elem->content() ), | ||||||||||
| 49 | $EXPL, | ||||||||||
| 50 | $elem, | ||||||||||
| 51 | ); | ||||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | #----------------------------------------------------------------------------- | ||||||||||
| 55 | |||||||||||
| 56 | 2 | 1; | |||||||||
| 57 | |||||||||||
| 58 | __END__ | ||||||||||