Perl/Lint/Policy/InputOutput/ProhibitBarewordFileHandles.pm

filter: Statementstmt 57.5% 19 / 33 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 1 totaltotal 46.3% 25 / 54 CC 6 SCAR 30.7
CC
6
Cov
43%
evaluate
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 21.5
« Perl/Lint/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm ↑ Summary Perl/Lint/Policy/Objects/IndirectSyntax.pm »
1 package Perl::Lint::Policy::InputOutput::ProhibitBarewordFileHandles;
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 Perl::Lint::Constants::Kind;
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 => 'Bareword file handle opened',
10 EXPL => [202, 204],
11 2 };
12  
13 0 ▶sub evaluate {
Subroutine evaluate: not called CC=6 SCAR=37.4
Pod undocumented
14 0 my ($class, $file, $tokens, $src, $args) = @_;
15  
16 0 my @violations;
17 0 ▶ for (my $i = 0; 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 ▶ if ($token_type == BUILTIN_FUNC && $token_data eq 'open') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 70 and $token_data eq "open") 0 0 0
Condition0%0/3
$token_type == 70 and $token_data eq "open"
!ll&&!rl&&r
000
MC/DC0%0/2
$token_type == 70 and $token_data eq "open"
$token_type == 70 $token_data eq "open"
Truth table0%0/3
A and B
A= $token_type == 70B= $token_data eq "open"
ABresult
0X0
100
111
22 0 $token = $tokens->[++$i];
23 0 $token_type = $token->{type};
24  
25 0 ▶ if ($token_type == LEFT_PAREN) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 107) 0 0 0
26 0 $token = $tokens->[++$i];
27 0 $token_type = $token->{type};
28 }
29  
30 0 ▶ if ($token_type == KEY) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 122) 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 }
41  
42 0 return \@violations;
43 }
44  
45 2 1;
46  
« Perl/Lint/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm ↑ Summary Perl/Lint/Policy/Objects/IndirectSyntax.pm »