blib/lib/Perl/Critic/Policy/logicLAB/ProhibitUseLib.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 100% 1 / 1 totaltotal 100% 49 / 49 CC 3 SCAR 4.1
CC
3
Cov
100%
violates
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
↑ Summary
1 package Perl::Critic::Policy::logicLAB::ProhibitUseLib;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use base 'Perl::Critic::Policy';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use Perl::Critic::Utils qw{ $SEVERITY_MEDIUM };
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use 5.008; #5.8.0
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 our $VERSION = '0.04';
10  
11 3 Readonly::Scalar my $EXPL => q{Use PERL5LIB environment instead};
12  
13 3 ▶use constant supported_parameters => ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 3 ▶use constant default_severity => $SEVERITY_MEDIUM;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 3 ▶use constant default_themes => qw(logiclab);
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 ▶use constant applies_to => 'PPI::Statement::Include';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 6 ▶sub violates {
Subroutine violates: called CC=3 SCAR=11.0
Pod documented
19 6 my ( $self, $elem ) = @_;
20  
21 6 my $child = $elem->schild(1); #second token
22 6 ▶ return if !$child; #return if no token, this will not be relevant to us
Branch: 1 branch
BranchTrueFalseTotal
unless $child 1 5 6
23  
24 #second token should read: lib
25 #See t/test.t for examples of variations
26 5 ▶ $child =~ m{
Branch: 1 branch
BranchTrueFalseTotal
$child =~ / \A #beginning of string lib #the word 'lib' \Z #end of string /msx or return 4 1 5
27 \A #beginning of string
28 lib #the word 'lib'
29 \Z #end of string
30 }xsm or return;
31  
32 4 return $self->violation( q{Do not use 'use lib' statements}, $EXPL,
33 $child );
34 }
35  
36 3 1;
37  
38 __END__
↑ Summary