lib/Perl/Critic/Policy/References/ProhibitDoubleSigils.pm

filter: Statementstmt 71.4% 25 / 35 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 90.9% 10 / 11 Podpod 80.0% 4 / 5 totaltotal 59.0% 39 / 66 CC 7 SCAR 31.6
CC
7
Cov
52%
violates
56.0
BEGIN
1.0
BEGIN
1.0
CRAP 23.6
« lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitProlongedStrictureOverride.pm ↑ Summary lib/Perl/Critic/Policy/RegularExpressions/ProhibitUselessTopic.pm »
1 package Perl::Critic::Policy::References::ProhibitDoubleSigils;
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 $DESC => q{Double-sigil dereference};
16 40 Readonly::Scalar my $EXPL => [ 228 ];
17  
18 #-----------------------------------------------------------------------------
19  
20 90 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
21 74 ▶sub default_severity { return $SEVERITY_LOW }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
22 83 ▶sub default_themes { return qw(core pbp cosmetic) }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
23 31 ▶sub applies_to { return 'PPI::Token::Cast' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
24  
25 #-----------------------------------------------------------------------------
26  
27 0 ▶sub violates {
Subroutine violates: not called CC=7 SCAR=40.3
Pod documented
28 0 my ( $self, $elem, undef ) = @_;
29  
30 0 my $content = $elem->content();
31 0 ▶ return if $content eq q{\\};
Branch: 1 branch
BranchTrueFalseTotal
if $content eq "\\" 0 0 0
32 0 ▶ return if $content =~ /[@ $ % * &] [*]/xms;
Branch: 1 branch
BranchTrueFalseTotal
if $content =~ /[@ $ % * &] [*]/msx 0 0 0
33 0 ▶ return if $content eq q{$#*}; ## no critic (RequireInterpolationOfMetachars)
Branch: 1 branch
BranchTrueFalseTotal
if $content eq "\$#*" 0 0 0
34  
35 0 my $sib = $elem->snext_sibling;
36 0 ▶ return if !$sib;
Branch: 1 branch
BranchTrueFalseTotal
unless $sib 0 0 0
37 0 ▶ if ( ! $sib->isa('PPI::Structure::Block') && ! $sib->isa('PPI::Structure::Subscript') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($sib->isa("PPI::Structure::Block") or $sib->isa("PPI::Structure::Subscript")) 0 0 0
Condition0%0/3
$sib->isa("PPI::Structure::Block") or $sib->isa("PPI::Structure::Subscript")
l!l&&r!l&&!r
000
MC/DC0%0/2
$sib->isa("PPI::Structure::Block") or $sib->isa("PPI::Structure::Subscript")
$sib->isa("PPI::Structure::Block") $sib->isa("PPI::Structure::Subscript")
Truth table0%0/3
A or B
A= $sib->isa("PPI::Structure::Block")B= $sib->isa("PPI::Structure::Subscript")
ABresult
1X1
011
000
38 0 return $self->violation( $DESC, $EXPL, $elem );
39 }
40 0 return; #ok!
41 }
42  
43 40 1;
44  
45 __END__
« lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitProlongedStrictureOverride.pm ↑ Summary lib/Perl/Critic/Policy/RegularExpressions/ProhibitUselessTopic.pm »