« lib/Perl/Critic/Policy/Variables/ProhibitAugmentedAssignmentInDeclaration.pm
↑ Summary
lib/Perl/Critic/Exception/Configuration/Option/Policy/ParameterValue.pm »
| 1 | package Perl::Critic::Policy::ValuesAndExpressions::ProhibitVersionStrings; | ||||||||||
| 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{Version string used}; | |||||||||
| 16 | 40 | Readonly::Scalar my $EXPL => q{Use a real number instead}; | |||||||||
| 17 | |||||||||||
| 18 | #----------------------------------------------------------------------------- | ||||||||||
| 19 | |||||||||||
| 20 | 90 | ▶ | sub supported_parameters { return () } | ||||||||
|
Subroutine
supported_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 21 | 74 | ▶ | sub default_severity { return $SEVERITY_MEDIUM } | ||||||||
|
Subroutine
default_severity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 22 | 85 | ▶ | sub default_themes { return qw(core pbp maintenance) } | ||||||||
|
Subroutine
default_themes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 23 | 31 | ▶ | sub applies_to { return 'PPI::Statement::Include' } | ||||||||
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 24 | |||||||||||
| 25 | #----------------------------------------------------------------------------- | ||||||||||
| 26 | |||||||||||
| 27 | 57 | ▶ | sub violates { | ||||||||
|
Subroutine
violates: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||
| 28 | 57 | my ($self, $elem, undef) = @_; | |||||||||
| 29 | |||||||||||
| 30 | 57 | my $version; | |||||||||
| 31 | |||||||||||
| 32 | 57 | ▶ | if ( my $module = $elem->module() ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 55 | ▶ | return if $module eq 'lib'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | |||||||||||
| 35 | 55 | $version = $elem->module_version(); | |||||||||
| 36 | } else { | ||||||||||
| 37 | 2 | $version = $elem->schild(1); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 57 | ▶ | return if not defined $version; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 2 | ▶ | return if not $version->isa('PPI::Token::Number::Version'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | |||||||||||
| 43 | 0 | return $self->violation($DESC, $EXPL, $elem); | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 40 | 1; | |||||||||
| 47 | |||||||||||
| 48 | __END__ | ||||||||||