« lib/Perl/Critic/Policy/ValuesAndExpressions/ProhibitConstantPragma.pm
↑ Summary
lib/Perl/Critic/ThemeListing.pm »
| 1 | package Perl::Critic::Policy::Modules::ProhibitMultiplePackages; | ||||||||||
| 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{Multiple "package" declarations}; | |||||||||
| 16 | 40 | Readonly::Scalar my $EXPL => q{Limit to one per file}; | |||||||||
| 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_HIGH } | ||||||||
|
Subroutine
default_severity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 22 | 73 | ▶ | sub default_themes { return qw( core bugs ) } | ||||||||
|
Subroutine
default_themes: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 23 | 33 | ▶ | sub applies_to { return 'PPI::Document' } | ||||||||
|
Subroutine
applies_to: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 24 | |||||||||||
| 25 | #----------------------------------------------------------------------------- | ||||||||||
| 26 | |||||||||||
| 27 | 33 | ▶ | sub violates { | ||||||||
|
Subroutine
violates: called CC=3 SCAR=11.8
Pod
documented
| |||||||||||
| 28 | 33 | my ( $self, undef, $doc ) = @_; | |||||||||
| 29 | 33 | my $nodes_ref = $doc->find('PPI::Statement::Package'); | |||||||||
| 30 | 33 | ▶ | return if !$nodes_ref; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | ▶ | my @matches = @{$nodes_ref} > 1 ? @{$nodes_ref}[ 1 .. $#{$nodes_ref} ] :(); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | |||||||||||
| 33 | 0 | return map {$self->violation($DESC, $EXPL, $_)} @matches; | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 40 | 1; | |||||||||
| 37 | |||||||||||
| 38 | __END__ | ||||||||||