Policy/CodeLayout/ProhibitHashBarewords.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 100% 4 / 4 totaltotal 92.8% 39 / 42 CC 4 SCAR 7.8
CC
4
Cov
93%
violates
4.0
default_themes
2.0
BEGIN
1.0
CRAP 2.2
↑ Summary Itch.pm »
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
BranchTrueFalseTotal
unless is_hash_key($elem) 7 9 16
20  
21 9 ▶ return if is_method_call($elem);
Branch: 1 branch
BranchTrueFalseTotal
if is_method_call($elem) 1 8 9
22 8 ▶ return if is_function_call($elem);
Branch: 1 branch
BranchTrueFalseTotal
if is_function_call($elem) 0 8 8
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__
↑ Summary Itch.pm »