« Perl/Lint/Policy/InputOutput/RequireBriefOpen.pm
↑ Summary
Perl/Lint/Policy/ErrorHandling/RequireCarping.pm »
| 1 | package Perl::Lint::Policy::InputOutput::RequireCheckedOpen; | ||||||||||||||||||||||||||||||||||||||||||
| 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 => 'Return value of "open" ignored', | |||||||||||||||||||||||||||||||||||||||||
| 10 | EXPL => 'Check the return value of "open" for success', | ||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub evaluate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
evaluate: not called CC=64 SCAR=83.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | my ($class, $file, $tokens, $src, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my $is_in_assign_context = 0; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | my $is_in_statement_context = 0; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | my $is_called_open_in_void = 0; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | my $is_enabled_autodie = 0; | |||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my @violations; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | for (my $i = 0; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my $token_kind = $token->{kind}; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my $token_data = $token->{data}; | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ($token_type == ASSIGN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $is_in_assign_context = 1; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | if ($token_type == USED_NAME) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | if ($token_data eq 'Fatal') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $next_token = $tokens->[$i+1]; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my $next_token_type = $next_token->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if ($next_token_type == REG_LIST) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | for ($i += 3; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | if ($token_type == REG_EXP && $token->{data} eq 'open') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$token_type == 187 and $token->{"data"} eq "open"
MC/DC0%0/2
$token_type == 187 and $token->{"data"} eq "open"
$token_type == 187
$token->{"data"} eq "open"
Truth table0%0/3
A and B
A= $token_type == 187B= $token->{"data"} eq "open"
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | return []; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | elsif ($token_type == REG_DELIM) { | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | elsif ($next_token_type == LEFT_PAREN) { | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $left_paren_num = 1; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | for ($i += 2; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | if ($token_type == LEFT_PAREN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $left_paren_num++; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | ▶ | elsif (($token_type == STRING || $token_type == RAW_STRING) && $token->{data} eq 'open') { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$token_type == 172 || $token_type == 173 and $token->{"data"} eq "open"
$token_type == 172 or $token_type == 173
MC/DC0%0/3
$token_type == 172 || $token_type == 173 and $token->{"data"} eq "open"
$token_type == 172
$token_type == 173
$token->{"data"} eq "open"
Truth table0%0/5
A or B and C
A= $token_type == 172B= $token_type == 173C= $token->{"data"} eq "open"
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | return []; | |||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||
| 56 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | last if --$left_paren_num <= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | ▶ | elsif (($next_token_type == STRING || $next_token_type == RAW_STRING) && $next_token->{data} eq 'open') { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$next_token_type == 172 || $next_token_type == 173 and $next_token->{"data"} eq "open"
$next_token_type == 172 or $next_token_type == 173
MC/DC0%0/3
$next_token_type == 172 || $next_token_type == 173 and $next_token->{"data"} eq "open"
$next_token_type == 172
$next_token_type == 173
$next_token->{"data"} eq "open"
Truth table0%0/5
A or B and C
A= $next_token_type == 172B= $next_token_type == 173C= $next_token->{"data"} eq "open"
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | elsif ($token_data eq 'autodie') { | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | if ($tokens->[$i+1]->{type} == REG_LIST) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | for ($i += 3; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ($token_type == REG_EXP && $token->{data} =~ /\A\s*:io\s*\Z/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$token_type == 187 and $token->{"data"} =~ /\A\s*:io\s*\Z/
MC/DC0%0/2
$token_type == 187 and $token->{"data"} =~ /\A\s*:io\s*\Z/
$token_type == 187
$token->{"data"} =~ /\A\s*:io\s*\Z/
Truth table0%0/3
A and B
A= $token_type == 187B= $token->{"data"} =~ /\A\s*:io\s*\Z/
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $is_enabled_autodie = 1; | |||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | elsif ($token_type == REG_DELIM) { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $is_enabled_autodie = 1; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if ($token_type == NAMESPACE && $token_data eq 'Fatal') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$token_type == 127 and $token_data eq "Fatal"
MC/DC0%0/2
$token_type == 127 and $token_data eq "Fatal"
$token_type == 127
$token_data eq "Fatal"
Truth table0%0/3
A and B
A= $token_type == 127B= $token_data eq "Fatal"
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $skipped_token = $tokens->[$i+2]; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if ($skipped_token && $skipped_token->{type} == NAMESPACE && $skipped_token->{data} eq 'Exception') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$skipped_token and $skipped_token->{"type"} == 127 and $skipped_token->{"data"} eq "Exception"
$skipped_token and $skipped_token->{"type"} == 127
MC/DC0%0/3
$skipped_token and $skipped_token->{"type"} == 127 and $skipped_token->{"data"} eq "Exception"
$skipped_token
$skipped_token->{"type"} == 127
$skipped_token->{"data"} eq "Exception"
Truth table0%0/4
A and B and C
A= $skipped_tokenB= $skipped_token->{"type"} == 127C= $skipped_token->{"data"} eq "Exception"
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | for ($i += 3; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | if ($token_type == REG_LIST) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | for ($i += 2; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | if ($token_type == REG_EXP && $token->{data} eq 'open') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$token_type == 187 and $token->{"data"} eq "open"
MC/DC0%0/2
$token_type == 187 and $token->{"data"} eq "open"
$token_type == 187
$token->{"data"} eq "open"
Truth table0%0/3
A and B
A= $token_type == 187B= $token->{"data"} eq "open"
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | return []; | |||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||
| 96 | elsif ($token_type == REG_DELIM) { | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | elsif ($token_type == LEFT_PAREN) { | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $left_paren_num = 1; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | for ($i++; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | if ($token_type == LEFT_PAREN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $left_paren_num++; | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | ▶ | elsif (($token_type == STRING || $token_type == RAW_STRING) && $token->{data} eq 'open') { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$token_type == 172 || $token_type == 173 and $token->{"data"} eq "open"
$token_type == 172 or $token_type == 173
MC/DC0%0/3
$token_type == 172 || $token_type == 173 and $token->{"data"} eq "open"
$token_type == 172
$token_type == 173
$token->{"data"} eq "open"
Truth table0%0/5
A or B and C
A= $token_type == 172B= $token_type == 173C= $token->{"data"} eq "open"
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | return []; | |||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | last if --$left_paren_num <= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | ▶ | elsif (($token_type == STRING || $token_type == RAW_STRING) && $token->{data} eq 'open') { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$token_type == 172 || $token_type == 173 and $token->{"data"} eq "open"
$token_type == 172 or $token_type == 173
MC/DC0%0/3
$token_type == 172 || $token_type == 173 and $token->{"data"} eq "open"
$token_type == 172
$token_type == 173
$token->{"data"} eq "open"
Truth table0%0/5
A or B and C
A= $token_type == 172B= $token_type == 173C= $token->{"data"} eq "open"
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | elsif ($token->{kind} == KIND_STMT_END) { | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | if ($token_kind == KIND_STMT) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $is_in_statement_context = 1; | |||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | if ($tokens->[$i+1]->{type} == LEFT_PAREN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | my $left_paren_num = 1; | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | for ($i++; my $token = $tokens->[$i]; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my $token_type = $token->{type}; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | if ($token_type == LEFT_PAREN) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $left_paren_num++; | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | last if --$left_paren_num <= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if ($token_type == BUILTIN_FUNC) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if ($token_data eq 'open') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if (!$is_in_assign_context && !$is_in_statement_context) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$is_in_assign_context or $is_in_statement_context
MC/DC0%0/2
$is_in_assign_context or $is_in_statement_context
$is_in_assign_context
$is_in_statement_context
Truth table0%0/3
A or B
A= $is_in_assign_contextB= $is_in_statement_context
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | $is_called_open_in_void = 1; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | elsif ($token_data eq 'no') { | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $next_token = $tokens->[++$i]; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ($next_token->{type} == KEY && $next_token->{data} eq 'autodie') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$next_token->{"type"} == 122 and $next_token->{"data"} eq "autodie"
MC/DC0%0/2
$next_token->{"type"} == 122 and $next_token->{"data"} eq "autodie"
$next_token->{"type"} == 122
$next_token->{"data"} eq "autodie"
Truth table0%0/3
A and B
A= $next_token->{"type"} == 122B= $next_token->{"data"} eq "autodie"
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $is_enabled_autodie = 0; | |||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if ($token_kind == KIND_OP) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $is_called_open_in_void = 0; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | if ($token_kind == KIND_STMT_END) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | next if $is_enabled_autodie; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | if ($is_called_open_in_void) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | push @violations, { | ||||||||||||||||||||||||||||||||||||||||||
| 172 | filename => $file, | ||||||||||||||||||||||||||||||||||||||||||
| 173 | line => $token->{line}, | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | description => DESC, | |||||||||||||||||||||||||||||||||||||||||
| 175 | explanation => EXPL, | ||||||||||||||||||||||||||||||||||||||||||
| 176 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||
| 177 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $is_in_assign_context = 0; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $is_in_statement_context = 0; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $is_called_open_in_void = 0; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | return \@violations; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||