Perl/Lint/Policy/Variables/ProtectPrivateVars.pm

filter: Statementstmt 66.6% 16 / 24 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 52.5% 21 / 40 CC 4 SCAR 22.5
CC
4
Cov
52%
evaluate
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 9.4
« Perl/Lint/Policy/Modules/ProhibitMultiplePackages.pm ↑ Summary Perl/Lint/Policy/Miscellanea/ProhibitFormats.pm »
1 package Perl::Lint::Policy::Variables::ProtectPrivateVars;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Perl::Lint::Constants::Type;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use parent "Perl::Lint::Policy";
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 DESC => 'Private variable used',
9 EXPL => 'Use published APIs',
10 2 };
11  
12 0 ▶sub evaluate {
Subroutine evaluate: not called CC=4 SCAR=30.0
Pod undocumented
13 0 my ($class, $file, $tokens, $src, $args) = @_;
14  
15 0 my @violations;
16 0 ▶ for (my $i = 0, my $token_type, my $token_data; my $token = $tokens->[$i]; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = $tokens->[$i]) 0 0 0
17 0 $token_type = $token->{type};
18 0 $token_data = $token->{data};
19  
20 0 ▶ if ($token_type == NAMESPACE && $token_data =~ /\A_/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 127 and $token_data =~ /\A_/) 0 0 0
Condition0%0/3
$token_type == 127 and $token_data =~ /\A_/
!ll&&!rl&&r
000
MC/DC0%0/2
$token_type == 127 and $token_data =~ /\A_/
$token_type == 127 $token_data =~ /\A_/
Truth table0%0/3
A and B
A= $token_type == 127B= $token_data =~ /\A_/
ABresult
0X0
100
111
21 push @violations, {
22 filename => $file,
23 line => $token->{line},
24 0 description => DESC,
25 explanation => EXPL,
26 policy => __PACKAGE__,
27 };
28 }
29 }
30  
31 0 return \@violations;
32 }
33  
34 2 1;
35  
« Perl/Lint/Policy/Modules/ProhibitMultiplePackages.pm ↑ Summary Perl/Lint/Policy/Miscellanea/ProhibitFormats.pm »