Policy/NamingConventions/ProhibitMixedCaseSubs.pm

filter: Statementstmt 96.9% 32 / 33 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.9% 10 / 11 Podpod 80.0% 4 / 5 totaltotal 94.1% 48 / 51 CC 2 SCAR 2.2
CC
2
Cov
97%
default_themes
2.0
violates
2.0
BEGIN
1.0
CRAP 1.2
« Deprecated.pm ↑ Summary
1 ##############################################################################
2 # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/distributions/Perl-Critic-Deprecated/lib/Perl/Critic/Policy/NamingConventions/ProhibitMixedCaseSubs.pm $
3 # $Date: 2013-10-29 09:11:44 -0700 (Tue, 29 Oct 2013) $
4 # $Author: thaljef $
5 # $Revision: 4214 $
6 ##############################################################################
7  
8 package Perl::Critic::Policy::NamingConventions::ProhibitMixedCaseSubs;
9  
10 1 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use Perl::Critic::Utils qw{ :severities };
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use base 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 our $VERSION = '1.119';
20  
21 #-----------------------------------------------------------------------------
22  
23 1 Readonly::Scalar my $UPPER_LOWER => qr/ [[:upper:]] [[:lower:]] /xms;
24 1 Readonly::Scalar my $LOWER_UPPER => qr/ [[:lower:]] [[:upper:]] /xms;
25 1 Readonly::Scalar my $MIXED_RX => qr{ $UPPER_LOWER | $LOWER_UPPER }xmso;
26 1 Readonly::Scalar my $DESC => 'Mixed-case subroutine name';
27 1 Readonly::Scalar my $EXPL => [ 45, 46 ];
28  
29 #-----------------------------------------------------------------------------
30  
31 2 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
32 4 ▶sub default_severity { return $SEVERITY_LOWEST }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
33 0 ▶sub default_themes { return qw( deprecated pbp cosmetic ) }
Subroutine default_themes: not called CC=1 SCAR=6.9
Pod documented
34 2 ▶sub applies_to { return 'PPI::Statement::Sub' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
35  
36 #-----------------------------------------------------------------------------
37  
38 9 ▶sub violates {
Subroutine violates: called CC=2 SCAR=6.9
Pod documented
39 9 my ( $self, $elem, undef ) = @_;
40 9 (my $name = $elem->name() ) =~ s/\A.*:://xms;
41 9 ▶ if ( $name =~ m/$MIXED_RX/xms ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /$MIXED_RX/msx) 4 5 9
42 4 return $self->violation( $DESC, $EXPL, $elem );
43 }
44 5 return; #ok!
45 }
46  
47 1 1;
48  
49 __END__
« Deprecated.pm ↑ Summary