lib/Perl/Critic/Policy/ControlStructures/ProhibitYadaOperator.pm

filter: Statementstmt 90.9% 30 / 33 Branchbran 33.3% 2 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 12 / 12 Podpod 80.0% 4 / 5 totaltotal 78.6% 48 / 61 CC 5 SCAR 12.3
CC
5
Cov
76%
_is_yada
10.2
violates
2.1
BEGIN
1.0
CRAP 3.4
« lib/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm ↑ Summary lib/Perl/Critic/Utils/POD.pm »
1 package Perl::Critic::Policy::ControlStructures::ProhibitYadaOperator;
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{ :characters :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{yada operator (...) used};
16 40 Readonly::Scalar my $EXPL => q{The yada operator is a placeholder for code you have not yet written.};
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_HIGH }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
22 85 ▶sub default_themes { return qw( core pbp maintenance ) }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
23 33 ▶sub applies_to { return 'PPI::Token::Operator' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
24  
25 #-----------------------------------------------------------------------------
26  
27 140 ▶sub violates {
Subroutine violates: called CC=2 SCAR=7.6
Pod documented
28 140 my ( $self, $elem, undef ) = @_;
29  
30 140 ▶ if ( _is_yada( $elem ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_is_yada($elem)) 0 140 140
31 0 return $self->violation( $DESC, $EXPL, $elem );
32 }
33 140 return; #ok!
34 }
35  
36 140 ▶sub _is_yada {
Subroutine _is_yada: called CC=4 SCAR=23.2
37 140 my ( $elem ) = @_;
38  
39 140 ▶ return if $elem ne '...';
Branch: 1 branch
BranchTrueFalseTotal
if $elem ne "..." 140 0 140
40 #return if not defined $elem->statement;
41  
42 # if there is something significant on both sides of the element it's
43 # probably the three dot range operator
44 0 ▶ return if ($elem->snext_sibling and $elem->sprevious_sibling);
Branch: 1 branch
BranchTrueFalseTotal
if $elem->snext_sibling and $elem->sprevious_sibling 0 0 0
Condition0%0/3
$elem->snext_sibling and $elem->sprevious_sibling
!ll&&!rl&&r
000
MC/DC0%0/2
$elem->snext_sibling and $elem->sprevious_sibling
$elem->snext_sibling $elem->sprevious_sibling
Truth table0%0/3
A and B
A= $elem->snext_siblingB= $elem->sprevious_sibling
ABresult
0X0
100
111
45  
46 0 return 1;
47 }
48  
49 40 1;
50  
51 __END__
« lib/Perl/Critic/PolicyParameter/Behavior/Enumeration.pm ↑ Summary lib/Perl/Critic/Utils/POD.pm »