| 1 | package Perl::Critic::Policy::CodeLayout::ProhibitHashBarewords; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use Perl::Critic::Utils; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use base 'Perl::Critic::Policy'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 3 | our $VERSION = '0.07'; | |||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | 8 | ▶ | sub default_severity { return $SEVERITY_MEDIUM } | ||||||||
|
Subroutine
default_severity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 12 | 0 | ▶ | sub default_themes { return qw(itch) } | ||||||||
|
Subroutine
default_themes: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 13 | 3 | ▶ | sub applies_to { return 'PPI::Token::Word' } | ||||||||
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 14 | |||||||||||
| 15 | 16 | ▶ | sub violates { | ||||||||
|
Subroutine
violates: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 16 | 16 | my ( $self, $elem ) = @_; | |||||||||
| 17 | |||||||||||
| 18 | #we only want the check hash keys | ||||||||||
| 19 | 16 | ▶ | return if !is_hash_key($elem); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | |||||||||||
| 21 | 9 | ▶ | return if is_method_call($elem); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 8 | ▶ | return if is_function_call($elem); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | |||||||||||
| 24 | 8 | my $desc = q{Hash key with bareword}; | |||||||||
| 25 | 8 | my $expl = q{Place quotes on all hash key barewords}; | |||||||||
| 26 | 8 | return $self->violation( $desc, $expl, $elem ); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 3 | 1; | |||||||||
| 30 | |||||||||||
| 31 | __END__ | ||||||||||