Policy/Modules/RequirePerlVersion.pm

filter: Statementstmt 100% 34 / 34 Branchbran 87.5% 7 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 80.0% 4 / 5 totaltotal 96.5% 56 / 58 CC 6 SCAR 10.6
CC
6
Cov
98%
violates
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.9
« Policy/ValuesAndExpressions/RequireConstantOnLeftSideOfEquality.pm ↑ Summary Policy/Editor/RequireEmacsFileVariables.pm »
1 #######################################################################
2 # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/distributions/Perl-Critic-More/lib/Perl/Critic/Policy/Modules/RequirePerlVersion.pm $
3 # $Date: 2013-10-29 09:39:11 -0700 (Tue, 29 Oct 2013) $
4 # $Author: thaljef $
5 # $Revision: 4222 $
6 ########################################################################
7  
8 package Perl::Critic::Policy::Modules::RequirePerlVersion;
9  
10 7 ▶use 5.006001;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 7 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 7 ▶use Perl::Critic::Utils qw{ :severities };
Subroutine BEGIN: called CC=1 SCAR=0.0
18 7 ▶use base 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 7 our $VERSION = '1.003';
21  
22 #---------------------------------------------------------------------------
23  
24 7 Readonly::Scalar my $DESC => 'Missing Perl version';
25 7 Readonly::Scalar my $EXPL => 'Add "use 5.006" or similar';
26  
27 #---------------------------------------------------------------------------
28  
29 4 ▶sub default_severity { return $SEVERITY_LOWEST }
Subroutine default_severity: called CC=1 SCAR=0.0
Pod documented
30 1 ▶sub default_themes { return qw< more compatibility > }
Subroutine default_themes: called CC=1 SCAR=0.0
Pod documented
31 8 ▶sub applies_to { return 'PPI::Document' }
Subroutine applies_to: called CC=1 SCAR=0.0
Pod documented
32 9 ▶sub supported_parameters { return () }
Subroutine supported_parameters: called CC=1 SCAR=0.0
Pod undocumented
33  
34 #---------------------------------------------------------------------------
35  
36 8 ▶sub violates {
Subroutine violates: called CC=6 SCAR=17.9
Pod documented
37 8 my ( $self, $elem, $doc ) = @_;
38  
39 8 my $includes = $doc->find('PPI::Statement::Include');
40 8 ▶ if ($includes) {
Branch: 1 branch
BranchTrueFalseTotal
if ($includes) 7 1 8
41 7 for my $stmt ( @{$includes} ) {
42 9 ▶ next if $stmt->type ne 'use';
Branch: 1 branch
BranchTrueFalseTotal
if $stmt->type ne "use" 1 8 9
43 8 ▶ return if $stmt->version;
Branch: 1 branch
BranchTrueFalseTotal
if $stmt->version 5 3 8
44 3 ▶ return if $stmt->module =~ m<
Branch: 1 branch
BranchTrueFalseTotal
if $stmt->module =~ / \A v \d+ (?: [.] \d+ (?: _ \d+ )? )* \z /msx 0 3 3
45 \A
46 v
47 \d+
48 (?:
49 [.] \d+
50 (?:
51 _ \d+
52 )?
53 )*
54 \z
55 >xms;
56 }
57 }
58  
59 3 return $self->violation( $DESC, $EXPL, $doc );
60 }
61  
62 7 1;
63  
64 __END__
« Policy/ValuesAndExpressions/RequireConstantOnLeftSideOfEquality.pm ↑ Summary Policy/Editor/RequireEmacsFileVariables.pm »