Perl/Lint/Policy/Modules/RequireBarewordIncludes.pm

filter: Statementstmt 61.5% 16 / 26 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 30.0% 21 / 70 CC 11 SCAR 45.1
CC
11
Cov
30%
evaluate
132.0
BEGIN
1.0
BEGIN
1.0
CRAP 91.1
« Perl/Lint/Policy/BuiltinFunctions/RequireSimpleSortBlock.pm ↑ Summary Perl/Lint/Policy/Variables/ProhibitAugmentedAssignmentInDeclaration.pm »
1 package Perl::Lint::Policy::Modules::RequireBarewordIncludes;
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 => '"%s" statement with library name as string',
9 EXPL => 'Use a bareword instead',
10 2 };
11  
12 0 ▶sub evaluate {
Subroutine evaluate: not called CC=11 SCAR=48.8
Pod undocumented
13 0 my ($class, $file, $tokens, $args) = @_;
14  
15 0 my @violations;
16 my $next_token;
17 0 ▶ for (my $i = 0, my $next_token, my $next_token_type; my $token = $tokens->[$i]; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = $tokens->[$i]) 0 0 0
18 0 my $token_type = $token->{type};
19 0 my $token_data = $token->{data};
20  
21 0 $next_token = $tokens->[$i+1];
22 0 $next_token_type = $next_token->{type};
23 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($next_token_type and $token_type == 93 || $token_type == 71 || $token_type == 70 && $token_data eq "no" and $next_token_type == 172 || $next_token_type == 173 || $next_token_type == 145 || $next_token_type == 146) 0 0 0
Condition0%0/24
$next_token_type and $token_type == 93 || $token_type == 71 || $token_type == 70 && $token_data eq "no" and $next_token_type == 172 || $next_token_type == 173 || $next_token_type == 145 || $next_token_type == 146
!ll&&!rl&&r
000
$next_token_type and $token_type == 93 || $token_type == 71 || $token_type == 70 && $token_data eq "no"
!ll&&!rl&&r
000
$token_type == 93 or $token_type == 71 or $token_type == 70 and $token_data eq "no"
l!l&&r!l&&!r
000
$token_type == 93 or $token_type == 71
l!l&&r!l&&!r
000
$token_type == 70 and $token_data eq "no"
!ll&&!rl&&r
000
$next_token_type == 172 or $next_token_type == 173 or $next_token_type == 145 or $next_token_type == 146
l!l&&r!l&&!r
000
$next_token_type == 172 or $next_token_type == 173 or $next_token_type == 145
l!l&&r!l&&!r
000
$next_token_type == 172 or $next_token_type == 173
l!l&&r!l&&!r
000
MC/DC0%0/9
$next_token_type and $token_type == 93 || $token_type == 71 || $token_type == 70 && $token_data eq "no" and $next_token_type == 172 || $next_token_type == 173 || $next_token_type == 145 || $next_token_type == 146
$next_token_type $token_type == 93 $token_type == 71 $token_type == 70 $token_data eq "no" $next_token_type == 172 $next_token_type == 173 $next_token_type == 145 $next_token_type == 146
Truth table0%0/18
A and B or C or D and E and F or G or H or I
A= $next_token_typeB= $token_type == 93C= $token_type == 71D= $token_type == 70E= $token_data eq "no"F= $next_token_type == 172G= $next_token_type == 173H= $next_token_type == 145I= $next_token_type == 146
ABCDEFGHIresult
0XXXXXXXX0
1000XXXXX0
10010XXXX0
11XXX00000
101XX00000
1001100000
11XXX1XXX1
11XXX01XX1
11XXX001X1
11XXX00011
101XX1XXX1
101XX01XX1
101XX001X1
101XX00011
100111XXX1
1001101XX1
10011001X1
1001100011
24 $next_token_type &&
25 (
26 $token_type == USE_DECL ||
27 $token_type == REQUIRE_DECL ||
28 ($token_type == BUILTIN_FUNC && $token_data eq 'no')
29 ) &&
30 (
31 $next_token_type == STRING ||
32 $next_token_type == RAW_STRING ||
33 $next_token_type == REG_QUOTE ||
34 $next_token_type == REG_DOUBLE_QUOTE
35 )
36 ) {
37 push @violations, {
38 filename => $file,
39 line => $token->{line},
40 0 description => sprintf(DESC, $token_data),
41 explanation => EXPL,
42 policy => __PACKAGE__,
43 };
44 }
45 }
46  
47 0 return \@violations;
48 }
49  
50 2 1;
51  
« Perl/Lint/Policy/BuiltinFunctions/RequireSimpleSortBlock.pm ↑ Summary Perl/Lint/Policy/Variables/ProhibitAugmentedAssignmentInDeclaration.pm »