Perl/Lint/Policy/TestingAndDebugging/ProhibitNoStrict.pm

filter: Statementstmt 40.4% 19 / 47 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 10 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 25.0% 25 / 100 CC 17 SCAR 54.2
CC
17
Cov
23%
evaluate
306.0
BEGIN
1.0
BEGIN
1.0
CRAP 226.4
« Perl/Lint/Policy/InputOutput/RequireEncodingWithUTF8Layer.pm ↑ Summary Perl/Lint/Policy/RegularExpressions/ProhibitComplexRegexes.pm »
1 package Perl::Lint::Policy::TestingAndDebugging::ProhibitNoStrict;
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 utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Perl::Lint::Constants::Type;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use parent "Perl::Lint::Policy";
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 DESC => 'Stricture disabled',
10 EXPL => [429],
11 2 };
12  
13 0 ▶sub evaluate {
Subroutine evaluate: not called CC=17 SCAR=57.2
Pod undocumented
14 0 my ($class, $file, $tokens, $src, $args) = @_;
15  
16 0 my @arg_allows;
17 0 ▶ if (my $this_policies_arg = $args->{prohibit_no_strict}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $this_policies_arg = $args->{"prohibit_no_strict"}) 0 0 0
18 0 ▶ if (my $allow = $this_policies_arg->{allow}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $allow = $this_policies_arg->{"allow"}) 0 0 0
19 0 @arg_allows = map { lc $_ } split(/[\s,]/, $allow);
20 }
21 }
22  
23 0 my @violations;
24 0 my $token_num = scalar @$tokens;
25 0 ▶ for (my $i = 0; $i < $token_num; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $token_num) 0 0 0
26 0 my $token = $tokens->[$i];
27 0 my $token_type = $token->{type};
28  
29 0 ▶ if ($token_type == BUILTIN_FUNC and $token->{data} eq 'no') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 70 and $token->{"data"} eq "no") 0 0 0
Condition0%0/3
$token_type == 70 and $token->{"data"} eq "no"
!ll&&!rl&&r
000
MC/DC0%0/2
$token_type == 70 and $token->{"data"} eq "no"
$token_type == 70 $token->{"data"} eq "no"
Truth table0%0/3
A and B
A= $token_type == 70B= $token->{"data"} eq "no"
ABresult
0X0
100
111
30 0 $token = $tokens->[++$i];
31  
32 0 my @allows;
33 0 ▶ if ($token->{type} == KEY && $token->{data} eq 'strict') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token->{"type"} == 122 and $token->{"data"} eq "strict") 0 0 0
Condition0%0/3
$token->{"type"} == 122 and $token->{"data"} eq "strict"
!ll&&!rl&&r
000
MC/DC0%0/2
$token->{"type"} == 122 and $token->{"data"} eq "strict"
$token->{"type"} == 122 $token->{"data"} eq "strict"
Truth table0%0/3
A and B
A= $token->{"type"} == 122B= $token->{"data"} eq "strict"
ABresult
0X0
100
111
34 0 ▶ for ($i++; $i < $token_num; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $token_num) 0 0 0
35 0 $token = $tokens->[$i];
36 0 $token_type = $token->{type};
37  
38 0 ▶ if ($token_type == STRING || $token_type == RAW_STRING) {
Branch: 3 branches
BranchTrueFalseTotal
if ($token_type == 172 or $token_type == 173) { } 0 0 0
elsif ($token_type == 187) { } 0 0 0
elsif ($token_type == 106 or not $$tokens[$i + 1]) { } 0 0 0
Condition0%0/3
$token_type == 172 or $token_type == 173
l!l&&r!l&&!r
000
MC/DC0%0/2
$token_type == 172 or $token_type == 173
$token_type == 172 $token_type == 173
Truth table0%0/3
A or B
A= $token_type == 172B= $token_type == 173
ABresult
1X1
011
000
39 0 push @allows, $token->{data};
40 }
41 elsif ($token_type == REG_EXP) {
42 0 push @allows, split(/ /, $token->{data});
43 }
44 ▶ elsif ($token_type == SEMI_COLON || !$tokens->[$i+1]) {
Condition0%0/3
$token_type == 106 or not $$tokens[$i + 1]
l!l&&r!l&&!r
000
MC/DC0%0/2
$token_type == 106 or not $$tokens[$i + 1]
$token_type == 106 not $$tokens[$i + 1]
Truth table0%0/3
A or not(B)
A= $token_type == 106B= not $$tokens[$i + 1]
ABresult
1X1
011
000
45 0 for my $arg_allow (@arg_allows) {
46 0 @allows = grep { $_ ne $arg_allow } @allows;
47 }
48 0 ▶ if (!@arg_allows || @allows) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @arg_allows or @allows) 0 0 0
Condition0%0/3
not @arg_allows or @allows
l!l&&r!l&&!r
000
MC/DC0%0/2
not @arg_allows or @allows
not @arg_allows @allows
Truth table0%0/3
not(A) or B
A= not @arg_allowsB= @allows
ABresult
1X1
011
000
49 push @violations, {
50 filename => $file,
51 line => $token->{line},
52 0 description => DESC,
53 explanation => EXPL,
54 policy => __PACKAGE__,
55 };
56 0 last;
57 }
58 }
59 }
60 }
61 }
62 }
63  
64 0 return \@violations;
65 }
66  
67 2 1;
68  
« Perl/Lint/Policy/InputOutput/RequireEncodingWithUTF8Layer.pm ↑ Summary Perl/Lint/Policy/RegularExpressions/ProhibitComplexRegexes.pm »