| 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
| |||||||||||||||||||||||||||||
| 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)
MC/DC0%0/1
$elem->sprevious_sibling || (return)
$elem->sprevious_sibling
Truth table50%1/2
A
A= $elem->sprevious_sibling
| |||||||||||||||||||||||||||||
| 24 | 3 | ▶ | $sib->isa('PPI::Token::Word') && $sib eq 'Test::More' || return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$sib->isa("PPI::Token::Word") and $sib eq "Test::More"
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"
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||