lib/Perl/Critic/Policy/Modules/RequireBarewordIncludes.pm

filter: Statementstmt 100% 32 / 32 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 80.0% 4 / 5 totaltotal 96.1% 50 / 52 CC 3 SCAR 3.8
CC
3
Cov
97%
violates
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm ↑ Summary lib/Perl/Critic/Exception/Configuration/Option.pm »
1 package Perl::Critic::Policy::Modules::RequireBarewordIncludes;
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 };
Subroutine BEGIN: called CC=1 SCAR=0.0
9 40 ▶use parent 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 40 our $VERSION = '1.156';
12  
13 #-----------------------------------------------------------------------------
14  
15 40 Readonly::Scalar my $EXPL => q{Use a bareword instead};
16  
17 #-----------------------------------------------------------------------------
18  
19 90 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
20 76 ▶sub default_severity { return $SEVERITY_HIGHEST }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
21 73 ▶sub default_themes { return qw(core portability) }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
22 37 ▶sub applies_to { return 'PPI::Statement::Include' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
23  
24 #-----------------------------------------------------------------------------
25  
26 63 ▶sub violates {
Subroutine violates: called CC=3 SCAR=11.0
Pod documented
27 63 my ( $self, $elem, undef ) = @_;
28  
29 63 my $child = $elem->schild(1);
30 63 ▶ return if !$child;
Branch: 1 branch
BranchTrueFalseTotal
unless $child 0 63 63
31  
32 63 ▶ if ( $child->isa('PPI::Token::Quote') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($child->isa("PPI::Token::Quote")) 2 61 63
33 2 my $type = $elem->type;
34 2 my $desc = qq{"$type" statement with library name as string};
35 2 return $self->violation( $desc, $EXPL, $elem );
36 }
37 61 return; #ok!
38 }
39  
40  
41 40 1;
42  
43 __END__
« lib/Perl/Critic/Policy/CodeLayout/ProhibitTrailingWhitespace.pm ↑ Summary lib/Perl/Critic/Exception/Configuration/Option.pm »