Policy/Bangs/ProhibitCommentedOutCode.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 80.0% 4 / 5 totaltotal 92.5% 37 / 40 CC 2 SCAR 2.6
CC
2
Cov
96%
default_themes
2.0
violates
2.0
BEGIN
1.0
CRAP 1.3
« Policy/Bangs/ProhibitFlagComments.pm ↑ Summary Policy/Bangs/ProhibitBitwiseOperators.pm »
1 package Perl::Critic::Policy::Bangs::ProhibitCommentedOutCode;
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 #---------------------------------------------------------------------------
11  
12 10 ▶sub supported_parameters {
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
13 return (
14 {
15 10 name => 'commentedcoderegex',
16 description => 'Regular expression to use to look for code in comments.',
17 behavior => 'string',
18 default_string => '\$[A-Za-z_].*=', ## no critic (RequireInterpolationOfMetachars)
19 },
20 );
21 }
22  
23 5 ▶sub default_severity { return $SEVERITY_LOW }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
24 0 ▶sub default_themes { return qw( bangs maintenance ) }
Subroutine default_themes: not called CC=1 SCAR=6.9
Pod documented
25 6 ▶sub applies_to { return 'PPI::Token::Comment' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
26  
27 #---------------------------------------------------------------------------
28  
29 17 ▶sub violates {
Subroutine violates: called CC=2 SCAR=6.9
Pod documented
30 17 my ( $self, $elem, $doc ) = @_;
31  
32 17 ▶ if ( $elem =~ $self->{_commentedcoderegex} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($elem =~ /$self->{"_commentedcoderegex"}/) 5 12 17
33 5 my $desc = q(Code found in comment);
34 5 my $expl = q(Commented-out code found can be confusing);
35 5 return $self->violation( $desc, $expl, $elem );
36 }
37  
38 12 return;
39 }
40  
41 5 1;
42  
43 __END__
« Policy/Bangs/ProhibitFlagComments.pm ↑ Summary Policy/Bangs/ProhibitBitwiseOperators.pm »