« Perl/Lint/Policy/InputOutput/ProhibitTwoArgOpen.pm
↑ Summary
Perl/Lint/Policy/ValuesAndExpressions/ProhibitLeadingZeros.pm »
| 1 | package Perl::Lint::Policy::Variables::ProhibitPunctuationVars; | ||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use Compiler::Lexer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use List::Util qw/any/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Perl::Lint::Constants::Type; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use parent "Perl::Lint::Policy"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use constant { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 3 | DESC => 'Magic punctuation variable %s used', | |||||||||||||||||||||||||||
| 11 | EXPL => [79], | ||||||||||||||||||||||||||||
| 12 | 3 | }; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 3 | my %var_token_types = ( | |||||||||||||||||||||||||||
| 15 | &VAR => 1, | ||||||||||||||||||||||||||||
| 16 | &ARRAY_VAR => 1, | ||||||||||||||||||||||||||||
| 17 | &HASH_VAR => 1, | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | &GLOBAL_VAR => 1, | ||||||||||||||||||||||||||||
| 20 | &GLOBAL_ARRAY_VAR => 1, | ||||||||||||||||||||||||||||
| 21 | &GLOBAL_HASH_VAR => 1, | ||||||||||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 3 | my %expands_regexp_token_types = ( | |||||||||||||||||||||||||||
| 25 | ®_EXEC => 1, | ||||||||||||||||||||||||||||
| 26 | ®_DECL => 1, | ||||||||||||||||||||||||||||
| 27 | ®_DOUBLE_QUOTE => 1, | ||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 3 | my %special_variable_token_types = ( | |||||||||||||||||||||||||||
| 31 | &SPECIFIC_VALUE => 1, | ||||||||||||||||||||||||||||
| 32 | &ARRAY_SIZE => 1, | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 3 | my %magic_variables = ( | |||||||||||||||||||||||||||
| 36 | '$1' => 1, '$2' => 1, '$3' => 1, | ||||||||||||||||||||||||||||
| 37 | '$4' => 1, '$5' => 1, '$6' => 1, | ||||||||||||||||||||||||||||
| 38 | '$7' => 1, '$8' => 1, '$9' => 1, | ||||||||||||||||||||||||||||
| 39 | '$_' => 1, '$&' => 1, '$`' => 1, | ||||||||||||||||||||||||||||
| 40 | '$+' => 1, '@+' => 1, '@*' => 1, | ||||||||||||||||||||||||||||
| 41 | '%+' => 1, '$*' => 1, '$.' => 1, | ||||||||||||||||||||||||||||
| 42 | '$/' => 1, '$|' => 1, '$(' => 1, | ||||||||||||||||||||||||||||
| 43 | '$"' => 1, '$;' => 1, '$%' => 1, | ||||||||||||||||||||||||||||
| 44 | '$=' => 1, '$-' => 1, '@-' => 1, | ||||||||||||||||||||||||||||
| 45 | '%-' => 1, '$)' => 1, '$~' => 1, | ||||||||||||||||||||||||||||
| 46 | '$^' => 1, '$:' => 1, '$?' => 1, | ||||||||||||||||||||||||||||
| 47 | '$!' => 1, '%!' => 1, '$@' => 1, | ||||||||||||||||||||||||||||
| 48 | '$$' => 1, '$<' => 1, '$>' => 1, | ||||||||||||||||||||||||||||
| 49 | '$0' => 1, '$[' => 1, '$]' => 1, | ||||||||||||||||||||||||||||
| 50 | '@_' => 1, | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | q{$'} => 1, | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | '$^L' => 1, '$^A' => 1, '$^E' => 1, | ||||||||||||||||||||||||||||
| 55 | '$^C' => 1, '$^D' => 1, '$^F' => 1, | ||||||||||||||||||||||||||||
| 56 | '$^H' => 1, '$^I' => 1, '$^M' => 1, | ||||||||||||||||||||||||||||
| 57 | '$^N' => 1, '$^O' => 1, '$^P' => 1, | ||||||||||||||||||||||||||||
| 58 | '$^R' => 1, '$^S' => 1, '$^T' => 1, | ||||||||||||||||||||||||||||
| 59 | '$^V' => 1, '$^W' => 1, '$^X' => 1, | ||||||||||||||||||||||||||||
| 60 | '%^H' => 1, | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | '$\\' => 1, | ||||||||||||||||||||||||||||
| 63 | '$::|' => 1, | ||||||||||||||||||||||||||||
| 64 | '$}' => 1, | ||||||||||||||||||||||||||||
| 65 | '$,' => 1, | ||||||||||||||||||||||||||||
| 66 | '$#' => 1, | ||||||||||||||||||||||||||||
| 67 | '$#+' => 1, | ||||||||||||||||||||||||||||
| 68 | '$#-' => 1, | ||||||||||||||||||||||||||||
| 69 | ); | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 3 | my %ignore_for_interpolation = ( | |||||||||||||||||||||||||||
| 72 | q{$'} => 1, | ||||||||||||||||||||||||||||
| 73 | q{$$} => 1, | ||||||||||||||||||||||||||||
| 74 | q{$#} => 1, | ||||||||||||||||||||||||||||
| 75 | q{$:} => 1, | ||||||||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 2 | ▶ | sub evaluate { | ||||||||||||||||||||||||||
|
Subroutine
evaluate: called CC=46 SCAR=70.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 79 | 2 | my ($class, $file, $tokens, $src, $args) = @_; | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 2 | my $string_mode = ''; | |||||||||||||||||||||||||||
| 82 | 2 | my %exempt_vars = ( | |||||||||||||||||||||||||||
| 83 | '$_' => 1, '@_' => 1, '$]' => 1, | ||||||||||||||||||||||||||||
| 84 | '$1' => 1, '$2' => 1, '$3' => 1, | ||||||||||||||||||||||||||||
| 85 | '$4' => 1, '$5' => 1, '$6' => 1, | ||||||||||||||||||||||||||||
| 86 | '$7' => 1, '$8' => 1, '$9' => 1, | ||||||||||||||||||||||||||||
| 87 | ); | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 2 | ▶ | if (my $this_policies_arg = $args->{prohibit_punctuation_vars}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | $string_mode = $this_policies_arg->{string_mode} || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$this_policies_arg->{'string_mode'} || ''
MC/DC0%0/1
$this_policies_arg->{'string_mode'} || ''
$this_policies_arg->{'string_mode'}
Truth table0%0/2
A
A= $this_policies_arg->{'string_mode'}
| |||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if ($string_mode eq 'thorough') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 0 | %exempt_vars = (); | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | 0 | ▶ | for my $exempt_var (split(/\s+/, $this_policies_arg->{allow} || '')) { | ||||||||||||||||||||||||||
|
Condition0%0/2
$this_policies_arg->{'allow'} || ''
MC/DC0%0/1
$this_policies_arg->{'allow'} || ''
$this_policies_arg->{'allow'}
Truth table0%0/2
A
A= $this_policies_arg->{'allow'}
| |||||||||||||||||||||||||||||
| 96 | 0 | $exempt_vars{$exempt_var} = 1; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 2 | my $lexer_for_str = Compiler::Lexer->new; | |||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 2 | my @violations; | |||||||||||||||||||||||||||
| 103 | 2 | ▶ | for ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 104 | my $i = 0, my $token_type, my $token_data, my $is_ref = 0, my $is_raw_heredoc_tag = 0; | ||||||||||||||||||||||||||||
| 105 | my $token = $tokens->[$i]; | ||||||||||||||||||||||||||||
| 106 | $i++ | ||||||||||||||||||||||||||||
| 107 | ) { | ||||||||||||||||||||||||||||
| 108 | 51 | $token_type = $token->{type}; | |||||||||||||||||||||||||||
| 109 | 51 | $token_data = $token->{data}; | |||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 51 | ▶ | if ($special_variable_token_types{$token_type}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 112 | 0 | ▶ | if ($is_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 0 | $is_ref = 0; | |||||||||||||||||||||||||||
| 114 | 0 | next; | |||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if ($exempt_vars{$token_data}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 118 | 0 | next; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 0 | ▶ | if (! $magic_variables{$token_data}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | 0 | next; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | push @violations, { | ||||||||||||||||||||||||||||
| 126 | filename => $file, | ||||||||||||||||||||||||||||
| 127 | line => $token->{line}, | ||||||||||||||||||||||||||||
| 128 | 0 | description => sprintf(DESC, $token_data), | |||||||||||||||||||||||||||
| 129 | explanation => EXPL, | ||||||||||||||||||||||||||||
| 130 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||
| 131 | }; | ||||||||||||||||||||||||||||
| 132 | 0 | next; | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 51 | ▶ | if ($var_token_types{$token_type}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | 2 | ▶ | if ($is_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | 0 | $is_ref = 0; | |||||||||||||||||||||||||||
| 138 | 0 | next; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 2 | ▶ | if ($exempt_vars{$token_data}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | 0 | next; | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 2 | ▶ | if (! $magic_variables{$token_data}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | 2 | next; | |||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if (substr($token_data, 1, 1) =~ /\A[^a-zA-Z]\Z/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 150 | push @violations, { | ||||||||||||||||||||||||||||
| 151 | filename => $file, | ||||||||||||||||||||||||||||
| 152 | line => $token->{line}, | ||||||||||||||||||||||||||||
| 153 | 0 | description => sprintf(DESC, $token_data), | |||||||||||||||||||||||||||
| 154 | explanation => EXPL, | ||||||||||||||||||||||||||||
| 155 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||
| 156 | }; | ||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | 0 | next; | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 49 | ▶ | if ($token_type == REF) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | 0 | $is_ref = 1; | |||||||||||||||||||||||||||
| 163 | 0 | next; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 49 | ▶ | if ($token_type == HERE_DOCUMENT_RAW_TAG) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | 0 | $is_raw_heredoc_tag = 1; | |||||||||||||||||||||||||||
| 168 | 0 | next; | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 49 | ▶ | if ($token_type == HERE_DOCUMENT_END) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | 0 | $is_raw_heredoc_tag = 0; | |||||||||||||||||||||||||||
| 173 | 0 | next; | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | 49 | ▶ | if ($expands_regexp_token_types{$token_type}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 0 | $i += 2; | |||||||||||||||||||||||||||
| 178 | 0 | $token = $tokens->[$i]; | |||||||||||||||||||||||||||
| 179 | 0 | ▶ | if ($token->{type} != REG_EXP) { # when content is empty | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | 0 | next; | |||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||
| 182 | 0 | $token_data = $token->data; | |||||||||||||||||||||||||||
| 183 | 0 | $token_type = STRING; | |||||||||||||||||||||||||||
| 184 | } # fall through | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 49 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$token_type == 172 or $token_type == 174
MC/DC0%0/2
$token_type == 172 or $token_type == 174
$token_type == 172
$token_type == 174
Truth table33%1/3
A or B
A= $token_type == 172B= $token_type == 174
| |||||||||||||||||||||||||||||
| 187 | $token_type == STRING || | ||||||||||||||||||||||||||||
| 188 | $token_type == EXEC_STRING | ||||||||||||||||||||||||||||
| 189 | # ($token_type == HERE_DOCUMENT && $is_raw_heredoc_tag) | ||||||||||||||||||||||||||||
| 190 | ) { | ||||||||||||||||||||||||||||
| 191 | 0 | ▶ | if ($string_mode eq 'disable') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 0 | next; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 0 | my $parts = $lexer_for_str->tokenize($token_data); | |||||||||||||||||||||||||||
| 196 | 0 | my $ref_count = 0; | |||||||||||||||||||||||||||
| 197 | 0 | ▶ | for (my $j = 0, my $part_type, my $used_var; my $part = $parts->[$j]; $j++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 198 | 0 | $part_type = $part->{type}; | |||||||||||||||||||||||||||
| 199 | 0 | $used_var = $part->{data}; | |||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if ($part_type == REF) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 202 | 0 | $ref_count++; | |||||||||||||||||||||||||||
| 203 | 0 | next; | |||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 0 | ▶ | if ($ref_count % 2 != 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | 0 | $ref_count = 0; | |||||||||||||||||||||||||||
| 208 | 0 | next; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 0 | ▶ | if ($part_type == SPECIFIC_VALUE) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 212 | 0 | ▶ | if ($used_var eq '$:') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 0 | $part = $parts->[$j+1]; | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 0 | ▶ | if ($part && $part->{type} == COLON) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$part and $part->{"type"} == 105
MC/DC0%0/2
$part and $part->{"type"} == 105
$part
$part->{"type"} == 105
Truth table0%0/3
A and B
A= $partB= $part->{"type"} == 105
| |||||||||||||||||||||||||||||
| 216 | 0 | $part = $parts->[$j+2]; | |||||||||||||||||||||||||||
| 217 | 0 | ▶ | if ($part && $part->{type} == BIT_OR) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$part and $part->{"type"} == 13
MC/DC0%0/2
$part and $part->{"type"} == 13
$part
$part->{"type"} == 13
Truth table0%0/3
A and B
A= $partB= $part->{"type"} == 13
| |||||||||||||||||||||||||||||
| 218 | 0 | $used_var = '$::|'; | |||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | else { | ||||||||||||||||||||||||||||
| 221 | 0 | next; | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | # TODO | ||||||||||||||||||||||||||||
| 226 | # elsif ($used_var eq q{$'}) { | ||||||||||||||||||||||||||||
| 227 | # $part = $parts->[$j+1]; | ||||||||||||||||||||||||||||
| 228 | # if ($part && $part->{type} == KEY) { | ||||||||||||||||||||||||||||
| 229 | # # next; | ||||||||||||||||||||||||||||
| 230 | # } | ||||||||||||||||||||||||||||
| 231 | # } | ||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||
| 233 | elsif ($part_type != ARRAY_SIZE) { | ||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if (!$var_token_types{$part_type}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 235 | 0 | next; | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | $part = $parts->[++$j]; | |||||||||||||||||||||||||||
| 239 | 0 | ▶ | if ($part) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ($used_var eq '$') { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if ($part->{type} == RIGHT_BRACE) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | 0 | $used_var = '$}'; | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | elsif ($used_var eq '@') { | ||||||||||||||||||||||||||||
| 246 | 0 | ▶ | if ($part->{type} == MUL) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 247 | 0 | $used_var = '@*'; | |||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||
| 250 | elsif ($used_var eq '%-') { | ||||||||||||||||||||||||||||
| 251 | 0 | ▶ | if ($part->{type} == INT) { # for formatting. e.g. "%-04f" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 252 | 0 | next; | |||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | 0 | ▶ | if ($exempt_vars{$used_var}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 259 | 0 | next; | |||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | 0 | ▶ | if ($string_mode eq 'simple' && $ignore_for_interpolation{$used_var}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$string_mode eq "simple" and $ignore_for_interpolation{$used_var}
MC/DC0%0/2
$string_mode eq "simple" and $ignore_for_interpolation{$used_var}
$string_mode eq "simple"
$ignore_for_interpolation{$used_var}
Truth table0%0/3
A and B
A= $string_mode eq "simple"B= $ignore_for_interpolation{$used_var}
| |||||||||||||||||||||||||||||
| 263 | 0 | next; | |||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | 0 | ▶ | if ($magic_variables{$used_var}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | push @violations, { | ||||||||||||||||||||||||||||
| 268 | filename => $file, | ||||||||||||||||||||||||||||
| 269 | line => $token->{line}, | ||||||||||||||||||||||||||||
| 270 | 0 | description => sprintf(DESC, $used_var), | |||||||||||||||||||||||||||
| 271 | explanation => EXPL, | ||||||||||||||||||||||||||||
| 272 | policy => __PACKAGE__, | ||||||||||||||||||||||||||||
| 273 | }; | ||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | 0 | next; | |||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | } | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | 2 | return \@violations; | |||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||
| 284 | 3 | 1; | |||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||