Perl/Lint/Policy/InputOutput/ProhibitJoinedReadline.pm

filter: Statementstmt 48.4% 16 / 33 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 34.4% 21 / 61 CC 10 SCAR 43.0
CC
10
Cov
31%
evaluate
110.0
BEGIN
1.0
BEGIN
1.0
CRAP 73.7
« Perl/Lint/Policy/ValuesAndExpressions/ProhibitVersionStrings.pm ↑ Summary Perl/Lint/Policy/Modules/ProhibitEvilModules.pm »
1 package Perl::Lint::Policy::InputOutput::ProhibitJoinedReadline;
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 => 'Use "local $/ = undef" or File::Slurp instead of joined readline',
9 EXPL => [213],
10 2 };
11  
12 0 ▶sub evaluate {
Subroutine evaluate: not called CC=10 SCAR=47.0
Pod undocumented
13 0 my ($class, $file, $tokens, $src, $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 0 my $token_data = $token->{data};
19 0 ▶ if ($token_type == BUILTIN_FUNC && $token_data eq 'join') {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 70 and $token_data eq "join") 0 0 0
Condition0%0/3
$token_type == 70 and $token_data eq "join"
!ll&&!rl&&r
000
MC/DC0%0/2
$token_type == 70 and $token_data eq "join"
$token_type == 70 $token_data eq "join"
Truth table0%0/3
A and B
A= $token_type == 70B= $token_data eq "join"
ABresult
0X0
100
111
20 0 ▶ for ($i++; my $token = $tokens->[$i]; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = $tokens->[$i]) 0 0 0
21 0 my $token_type = $token->{type};
22  
23 0 ▶ if ($token_type == DIAMOND) {
Branch: 3 branches
BranchTrueFalseTotal
if ($token_type == 32) { } 0 0 0
elsif ($token_type == 152) { } 0 0 0
elsif ($token_type == 106) { } 0 0 0
24 push @violations, {
25 filename => $file,
26 line => $token->{line},
27 0 description => DESC,
28 explanation => EXPL,
29 policy => __PACKAGE__,
30 };
31 }
32 elsif ($token_type == HANDLE_DELIM) {
33 0 ▶ for ($i++; my $token = $tokens->[$i]; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = $tokens->[$i]) 0 0 0
34 0 my $token_type = $token->{type};
35 0 ▶ if ($token_type == HANDLE_DELIM) {
Branch: 1 branch
BranchTrueFalseTotal
if ($token_type == 152) 0 0 0
36 push @violations, {
37 filename => $file,
38 line => $token->{line},
39 0 description => DESC,
40 explanation => EXPL,
41 policy => __PACKAGE__,
42 };
43 0 last;
44 }
45 }
46 }
47 elsif ($token_type == SEMI_COLON) {
48 0 last;
49 }
50 }
51 }
52 }
53  
54 0 return \@violations;
55 }
56  
57 2 1;
58  
« Perl/Lint/Policy/ValuesAndExpressions/ProhibitVersionStrings.pm ↑ Summary Perl/Lint/Policy/Modules/ProhibitEvilModules.pm »