« lib/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm
↑ Summary
lib/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm »
| 1 | package Perl::Critic::Policy::InputOutput::ProhibitBacktickOperators; | ||||||||||
| 2 | |||||||||||
| 3 | 40 | ▶ | use 5.010001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 40 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 40 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 40 | ▶ | use Readonly; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 40 | ▶ | use Perl::Critic::Utils qw{ :severities is_in_void_context }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 40 | ▶ | use parent 'Perl::Critic::Policy'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 40 | our $VERSION = '1.156'; | |||||||||
| 13 | |||||||||||
| 14 | #----------------------------------------------------------------------------- | ||||||||||
| 15 | |||||||||||
| 16 | 40 | Readonly::Scalar my $EXPL => q{Use IPC::Open3 instead}; | |||||||||
| 17 | 40 | Readonly::Scalar my $DESC => q{Backtick operator used}; | |||||||||
| 18 | |||||||||||
| 19 | 40 | Readonly::Scalar my $VOID_EXPL => q{Assign result to a variable or use system() instead}; | |||||||||
| 20 | 40 | Readonly::Scalar my $VOID_DESC => q{Backtick operator used in void context}; | |||||||||
| 21 | |||||||||||
| 22 | #----------------------------------------------------------------------------- | ||||||||||
| 23 | |||||||||||
| 24 | 91 | ▶ | sub supported_parameters { | ||||||||
|
Subroutine
supported_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 25 | return ( | ||||||||||
| 26 | { | ||||||||||
| 27 | 91 | name => 'only_in_void_context', | |||||||||
| 28 | description => 'Allow backticks everywhere except in void contexts.', | ||||||||||
| 29 | behavior => 'boolean', | ||||||||||
| 30 | }, | ||||||||||
| 31 | ); | ||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 74 | ▶ | sub default_severity { return $SEVERITY_MEDIUM } | ||||||||
|
Subroutine
default_severity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 35 | 73 | ▶ | sub default_themes { return qw(core maintenance) } | ||||||||
|
Subroutine
default_themes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 36 | 31 | ▶ | sub applies_to { return qw(PPI::Token::QuoteLike::Backtick | ||||||||
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 37 | PPI::Token::QuoteLike::Command ) } | ||||||||||
| 38 | |||||||||||
| 39 | #----------------------------------------------------------------------------- | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | sub violates { | ||||||||
|
Subroutine
violates: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 42 | 0 | my ( $self, $elem, undef ) = @_; | |||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | if ( $self->{_only_in_void_context} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 0 | ▶ | return if not is_in_void_context( $elem ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | |||||||||||
| 47 | 0 | return $self->violation( $VOID_DESC, $VOID_EXPL, $elem ); | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | return $self->violation( $DESC, $EXPL, $elem ); | |||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 40 | 1; | |||||||||
| 54 | |||||||||||
| 55 | __END__ | ||||||||||