Policy/Bangs/ProhibitNoPlan.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 100% 4 / 4 Conditioncond 60.0% 3 / 5 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 88.8% 8 / 9 Podpod 80.0% 4 / 5 totaltotal 86.5% 45 / 52 CC 5 SCAR 9.7
CC
5
Cov
91%
violates
5.0
default_themes
2.0
BEGIN
1.0
CRAP 2.6
« Policy/Bangs/ProhibitUselessRegexModifiers.pm ↑ Summary Policy/Bangs/ProhibitVagueNames.pm »
1 package Perl::Critic::Policy::Bangs::ProhibitNoPlan;
2  
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use Perl::Critic::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use base 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 5 our $VERSION = '1.14';
9  
10 5 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
11 2 ▶sub default_severity { return $SEVERITY_LOW }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
12 0 ▶sub default_themes { return qw( bangs tests ) }
Subroutine default_themes: not called CC=1 SCAR=6.9
Pod documented
13 2 ▶sub applies_to { return 'PPI::Token::QuoteLike::Words' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
14  
15 #---------------------------------------------------------------------------
16  
17 4 ▶sub violates {
Subroutine violates: called CC=5 SCAR=16.2
Pod documented
18 4 my ( $self, $elem, $doc ) = @_;
19  
20  
21 4 ▶ if ( $elem =~ qr/\bno_plan\b/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($elem =~ qr/\bno_plan\b/) 3 1 4
22 # Make sure that the previous sibling was Test::More, or return
23 3 ▶ my $sib = $elem->sprevious_sibling() || return;
Condition50%1/2
$elem->sprevious_sibling || (return)
l!l
30
MC/DC0%0/1
$elem->sprevious_sibling || (return)
$elem->sprevious_sibling
Truth table50%1/2
A
A= $elem->sprevious_sibling
Aresult
11
00
24 3 ▶ $sib->isa('PPI::Token::Word') && $sib eq 'Test::More' || return;
Branch: 1 branch
BranchTrueFalseTotal
$sib->isa("PPI::Token::Word") and $sib eq "Test::More" or return 2 1 3
Condition66%2/3
$sib->isa("PPI::Token::Word") and $sib eq "Test::More"
!ll&&!rl&&r
102
MC/DC50%1/2
$sib->isa("PPI::Token::Word") and $sib eq "Test::More"
$sib->isa("PPI::Token::Word") $sib eq "Test::More"
Truth table66%2/3
A and B
A= $sib->isa("PPI::Token::Word")B= $sib eq "Test::More"
ABresult
0X0
100
111
25  
26 2 my $desc = q(Test::More with "no_plan" found);
27 2 my $expl = q(Test::More should be given a plan indicating the number of tests run);
28 2 return $self->violation( $desc, $expl, $elem );
29 }
30  
31 1 return;
32 }
33  
34 5 1;
35  
36 __END__
« Policy/Bangs/ProhibitUselessRegexModifiers.pm ↑ Summary Policy/Bangs/ProhibitVagueNames.pm »