lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitEmptyQuotes.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 80.0% 4 / 5 totaltotal 97.9% 47 / 48 CC 2 SCAR 1.5
CC
2
Cov
100%
violates
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« lib/Perl/Critic/Policy/ControlStructures/ProhibitUnlessBlocks.pm ↑ Summary lib/Perl/Critic/PolicyParameter/Behavior.pm »
1 package Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes;
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 $EMPTY_RX => qr{\A ["'] \s* ['"] \z}xms;
16 40 Readonly::Scalar my $DESC => q<Quotes used with a string containing no non-whitespace characters>;
17 40 Readonly::Scalar my $EXPL => [ 53 ];
18  
19 #-----------------------------------------------------------------------------
20  
21 90 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
22 112 ▶sub default_severity { return $SEVERITY_LOW }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
23 83 ▶sub default_themes { return qw(core pbp cosmetic) }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
24 31 ▶sub applies_to { return 'PPI::Token::Quote' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
25  
26 #-----------------------------------------------------------------------------
27  
28 72 ▶sub violates {
Subroutine violates: called CC=2 SCAR=6.9
Pod documented
29 72 my ( $self, $elem, undef ) = @_;
30 72 ▶ if ( $elem =~ $EMPTY_RX ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($elem =~ /$EMPTY_RX/) 38 34 72
31 38 return $self->violation( $DESC, $EXPL, $elem );
32 }
33 34 return; #ok!
34 }
35  
36 40 1;
37  
38 __END__
« lib/Perl/Critic/Policy/ControlStructures/ProhibitUnlessBlocks.pm ↑ Summary lib/Perl/Critic/PolicyParameter/Behavior.pm »