lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitProlongedStrictureOverride.pm

filter: Statementstmt 77.1% 27 / 35 Branchbran 10.0% 1 / 10 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 11 / 11 Podpod 80.0% 4 / 5 totaltotal 61.4% 43 / 70 CC 8 SCAR 31.7
CC
8
Cov
55%
violates
52.3
BEGIN
1.0
BEGIN
1.0
CRAP 23.8
« lib/Perl/Critic/Policy/Subroutines/ProhibitManyArgs.pm ↑ Summary lib/Perl/Critic/Policy/References/ProhibitDoubleSigils.pm »
1 package Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride;
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{Don't turn off strict for large blocks of code};
16 40 Readonly::Scalar my $EXPL => [ 433 ];
17  
18 #-----------------------------------------------------------------------------
19  
20 91 ▶sub supported_parameters {
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
21 return (
22 {
23 91 name => 'statements',
24 description => 'The maximum number of statements in a no strict block.',
25 default_string => '3',
26 behavior => 'integer',
27 integer_minimum => 1,
28 },
29 );
30 }
31  
32 74 ▶sub default_severity { return $SEVERITY_HIGH }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
33 91 ▶sub default_themes { return qw( core pbp bugs certrec ) }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
34 33 ▶sub applies_to { return 'PPI::Statement::Include' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
35  
36 #-----------------------------------------------------------------------------
37  
38 61 ▶sub violates {
Subroutine violates: called CC=8 SCAR=39.6
Pod documented
39 61 my ($self, $elem, undef) = @_;
40  
41 61 ▶ return if $elem->type ne 'no';
Branch: 1 branch
BranchTrueFalseTotal
if $elem->type ne "no" 61 0 61
42 0 ▶ return if $elem->module ne 'strict';
Branch: 1 branch
BranchTrueFalseTotal
if $elem->module ne "strict" 0 0 0
43  
44 0 my $sib = $elem->snext_sibling;
45 0 my $nstatements = 0;
46 0 ▶ while ($nstatements++ <= $self->{_statements}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nstatements++ <= $self->{"_statements"}) 0 0 0
47 0 ▶ return if !$sib;
Branch: 1 branch
BranchTrueFalseTotal
unless $sib 0 0 0
48 0 ▶ return if $sib->isa('PPI::Statement::Include') &&
Branch: 1 branch
BranchTrueFalseTotal
if $sib->isa("PPI::Statement::Include") and $sib->type eq "use" and $sib->module eq "strict" 0 0 0
Condition0%0/6
$sib->isa("PPI::Statement::Include") and $sib->type eq "use" and $sib->module eq "strict"
!ll&&!rl&&r
000
$sib->isa("PPI::Statement::Include") and $sib->type eq "use"
!ll&&!rl&&r
000
MC/DC0%0/3
$sib->isa("PPI::Statement::Include") and $sib->type eq "use" and $sib->module eq "strict"
$sib->isa("PPI::Statement::Include") $sib->type eq "use" $sib->module eq "strict"
Truth table0%0/4
A and B and C
A= $sib->isa("PPI::Statement::Include")B= $sib->type eq "use"C= $sib->module eq "strict"
ABCresult
0XX0
10X0
1100
1111
49 $sib->type eq 'use' &&
50 $sib->module eq 'strict';
51 0 $sib = $sib->snext_sibling;
52 }
53  
54 0 return $self->violation( $DESC, $EXPL, $elem );
55 }
56  
57 40 1;
58  
59 #-----------------------------------------------------------------------------
60  
61 __END__
« lib/Perl/Critic/Policy/Subroutines/ProhibitManyArgs.pm ↑ Summary lib/Perl/Critic/Policy/References/ProhibitDoubleSigils.pm »