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

filter: Statementstmt 100% 31 / 31 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 11 / 11 Podpod 80.0% 4 / 5 totaltotal 81.2% 52 / 64 CC 6 SCAR 13.0
CC
6
Cov
84%
violates
8.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.7
« lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMixedBooleanOperators.pm ↑ Summary lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidMap.pm »
1 package Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyQuotes;
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 $NOISE_RX => qr{\A ["'] [^ \w () {} [\] <> ]{1,2} ['"] \z}xms;
16 40 Readonly::Scalar my $DESC => q{Quotes used with a noisy string};
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 105 ▶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 qw(PPI::Token::Quote::Double
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
25 PPI::Token::Quote::Single) }
26  
27 #-----------------------------------------------------------------------------
28  
29 72 ▶sub violates {
Subroutine violates: called CC=6 SCAR=20.9
Pod documented
30 72 my ( $self, $elem, undef ) = @_;
31 72 ▶ return if $elem !~ $NOISE_RX;
Branch: 1 branch
BranchTrueFalseTotal
unless $elem =~ /$NOISE_RX/ 41 31 72
32 31 my $statement = $elem->statement;
33 31 ▶ return if $statement
Branch: 1 branch
BranchTrueFalseTotal
if $statement and $statement->isa("PPI::Statement::Include") and $statement->type eq "use" and $statement->module eq "overload" 0 31 31
Condition33%3/9
$statement and $statement->isa("PPI::Statement::Include") and $statement->type eq "use" and $statement->module eq "overload"
!ll&&!rl&&r
3100
$statement and $statement->isa("PPI::Statement::Include") and $statement->type eq "use"
!ll&&!rl&&r
3100
$statement and $statement->isa("PPI::Statement::Include")
!ll&&!rl&&r
0310
MC/DC0%0/4
$statement and $statement->isa("PPI::Statement::Include") and $statement->type eq "use" and $statement->module eq "overload"
$statement $statement->isa("PPI::Statement::Include") $statement->type eq "use" $statement->module eq "overload"
Truth table20%1/5
A and B and C and D
A= $statementB= $statement->isa("PPI::Statement::Include")C= $statement->type eq "use"D= $statement->module eq "overload"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
34 && $statement->isa('PPI::Statement::Include')
35 && $statement->type eq 'use'
36 && $statement->module eq 'overload';
37 31 return $self->violation( $DESC, $EXPL, $elem );
38 }
39  
40 40 1;
41  
42 __END__
« lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitMixedBooleanOperators.pm ↑ Summary lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitVoidMap.pm »