Perl/Lint/Policy/ValuesAndExpressions/ProhibitVersionStrings.pm

filter: Statementstmt 57.1% 16 / 28 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 33.8% 21 / 62 CC 10 SCAR 43.0
CC
10
Cov
32%
evaluate
110.0
BEGIN
1.0
BEGIN
1.0
CRAP 73.7
« Perl/Lint/Policy/BuiltinFunctions/ProhibitUniversalIsa.pm ↑ Summary Perl/Lint/Policy/InputOutput/ProhibitJoinedReadline.pm »
1 package Perl::Lint::Policy::ValuesAndExpressions::ProhibitVersionStrings;
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 => 'Version string used',
9 EXPL => 'Use a real number instead',
10 2 };
11  
12 0 ▶sub evaluate {
Subroutine evaluate: not called CC=10 SCAR=47.0
Pod undocumented
13 0 my ($class, $file, $tokens, $args) = @_;
14  
15 0 my @violations;
16 0 ▶ for (my $i = 0; my $token = $tokens->[$i]; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = $tokens->[$i]) 0 0 0
17 0 my $token_type = $token->{type};
18  
19 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 93 or $token_type == 94 or $token_type == 127 or $token_type == 71 or $token_type == 95) 0 0 0
Condition0%0/12
$token_type == 93 or $token_type == 94 or $token_type == 127 or $token_type == 71 or $token_type == 95
l!l&&r!l&&!r
000
$token_type == 93 or $token_type == 94 or $token_type == 127 or $token_type == 71
l!l&&r!l&&!r
000
$token_type == 93 or $token_type == 94 or $token_type == 127
l!l&&r!l&&!r
000
$token_type == 93 or $token_type == 94
l!l&&r!l&&!r
000
MC/DC0%0/5
$token_type == 93 or $token_type == 94 or $token_type == 127 or $token_type == 71 or $token_type == 95
$token_type == 93 $token_type == 94 $token_type == 127 $token_type == 71 $token_type == 95
Truth table0%0/6
A or B or C or D or E
A= $token_type == 93B= $token_type == 94C= $token_type == 127D= $token_type == 71E= $token_type == 95
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
20 $token_type == USE_DECL ||
21 $token_type == USED_NAME ||
22 $token_type == NAMESPACE ||
23 $token_type == REQUIRE_DECL ||
24 $token_type == REQUIRED_NAME
25 ) {
26 0 $token_type = $tokens->[$i+1]->{type};
27  
28 0 ▶ if ($token_type == DOUBLE) {
Branch: 2 branches
BranchTrueFalseTotal
if ($token_type == 171) { } 0 0 0
elsif ($token_type == 175) { } 0 0 0
29 0 $token_type = $tokens->[$i+2]->{type};
30 0 ▶ if ($token_type == DOUBLE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 171) 0 0 0
31 push @violations, {
32 filename => $file,
33 line => $token->{line},
34 0 description => DESC,
35 explanation => EXPL,
36 policy => __PACKAGE__,
37 };
38 }
39 }
40 elsif ($token_type == VERSION_STRING) {
41 push @violations, {
42 filename => $file,
43 line => $token->{line},
44 0 description => DESC,
45 explanation => EXPL,
46 policy => __PACKAGE__,
47 };
48 }
49 }
50  
51 }
52  
53 0 return \@violations;
54 }
55  
56 2 1;
57  
« Perl/Lint/Policy/BuiltinFunctions/ProhibitUniversalIsa.pm ↑ Summary Perl/Lint/Policy/InputOutput/ProhibitJoinedReadline.pm »