Perl/Lint/Policy/References/ProhibitDoubleSigils.pm

filter: Statementstmt 96.0% 24 / 25 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 77.7% 35 / 45 CC 5 SCAR 12.2
CC
5
Cov
83%
evaluate
5.8
BEGIN
1.0
BEGIN
1.0
CRAP 3.4
« Perl/Lint/Policy/ValuesAndExpressions/ProhibitEmptyQuotes.pm ↑ Summary Perl/Lint/Policy/Miscellanea/ProhibitTies.pm »
1 package Perl::Lint::Policy::References::ProhibitDoubleSigils;
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 => 'Double-sigil dereference',
9 EXPL => [228],
10 2 };
11  
12 2 ▶sub evaluate {
Subroutine evaluate: called CC=5 SCAR=17.6
Pod undocumented
13 2 my ($class, $file, $tokens, $args) = @_;
14  
15 2 my @violations;
16 2 my $token_num = scalar @$tokens;
17 2 ▶ for (my $i = 0; $i < $token_num; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $token_num) 51 2 53
18 51 my $token = $tokens->[$i];
19 51 my $token_type = $token->{type};
20  
21 51 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 117 or $token_type == 118 or $token_type == 119) 0 51 51
Condition33%2/6
$token_type == 117 or $token_type == 118 or $token_type == 119
l!l&&r!l&&!r
0051
$token_type == 117 or $token_type == 118
l!l&&r!l&&!r
0051
MC/DC0%0/3
$token_type == 117 or $token_type == 118 or $token_type == 119
$token_type == 117 $token_type == 118 $token_type == 119
Truth table25%1/4
A or B or C
A= $token_type == 117B= $token_type == 118C= $token_type == 119
ABCresult
1XX1
01X1
0011
0000
22 $token_type == SHORT_SCALAR_DEREFERENCE ||
23 $token_type == SHORT_ARRAY_DEREFERENCE ||
24 $token_type == SHORT_HASH_DEREFERENCE
25 ) {
26 push @violations, {
27 filename => $file,
28 line => $token->{line},
29 0 description => DESC,
30 explanation => EXPL,
31 policy => __PACKAGE__,
32 };
33 }
34 }
35  
36 2 return \@violations;
37 }
38  
39 2 1;
40  
« Perl/Lint/Policy/ValuesAndExpressions/ProhibitEmptyQuotes.pm ↑ Summary Perl/Lint/Policy/Miscellanea/ProhibitTies.pm »