Branch Coverage

lib/Perl/Critic/Policy/ValuesAndExpressions/RequireConsistentQuoting.pm
Criterion Covered Total %
branch 159 166 95.7


line true false branch
42 395 399 if $test_elem->isa("PPI::Token::Quote::Double")
78 204 649 if $delimiter_start eq "("
79 206 443 if $delimiter_start eq "["
80 316 127 if $delimiter_start eq "<"
81 126 1 if $delimiter_start eq "{"
90 116 0 if ($content =~ /\A(?:(qw|qq|qx|q)\s*)?(.)(.*)(.)\z/su)
140 0 104 unless $Perl::Critic::Policy::ValuesAndExpressions::RequireConsistentQuoting::a->{'count'} <=> $Perl::Critic::Policy::ValuesAndExpressions::RequireConsistentQuoting::b->{'count'}
145 100 204 if ($delim->{'start'} eq $start and $delim->{'end'} eq $end)
153 100 25 if $current_is_bracket and $current_delim
161 0 32 unless defined $start
163 2 30 if $start eq "'"
167 12 20 unless $current_is_optimal
185 1 610 unless my $method = $dispatch->{$class}
191 10 84 if $self->_is_in_use_statement($elem)
195 4 80 if $self->_has_newlines($string)
200 2 78 if $has_single_quotes and $has_double_quotes
205 45 24 if $has_double_quotes or $self->_has_quote_sensitive_escapes($string) or $self->would_interpolate_from_single_quotes($string)
216 43 150 if $self->_is_in_use_statement($elem)
222 4 146 if $self->_has_newlines($string)
226 12 8 if $content =~ /\\[\$\@\"]/u and not $self->_has_quote_sensitive_escapes($string) and not $self->would_interpolate($string)
234 7 127 if ($content =~ /\\"/u)
244 7 93 if $self->_is_in_use_statement($elem)
249 3 90 if $self->_has_newlines($string)
255 12 78 if $has_single_quotes and $has_double_quotes
260 6 72 if ($has_single_quotes)
261 2 4 $would_interpolate ? :
266 12 60 if ($has_double_quotes)
267 2 10 $would_interpolate ? :
272 17 43 if $would_interpolate
278 7 46 if $self->_is_in_use_statement($elem)
283 4 42 if $self->_has_newlines($string)
286 7 35 if $self->_has_quote_sensitive_escapes($string)
293 7 28 if ($double_quote_suggestion and $double_quote_suggestion eq "''")
295 3 4 if index($string, "\"") != -1
300 5 23 if $double_quote_suggestion and $double_quote_suggestion eq "qq()"
307 2 21 $has_delimiter_chars ? :
313 8 84 if $self->_is_in_use_statement($elem)
317 0 84 unless defined $current_start
325 53 31 unless $current_is_optimal
334 8 110 if $_->isa("PPI::Token::Operator")
336 126 7 unless $_->isa("PPI::Token::Symbol") or $_->isa("PPI::Structure")
341 158 1 unless $_->isa("PPI::Token::Number::Version")
345 112 11 unless $_->isa("PPI::Token::Quote::Single")
349 148 6 unless $_->isa("PPI::Token::Quote::Literal")
362 2 76 unless $elem->type =~ /^(use|no)$/u
364 4 72 unless my(@args) = $self->_extract_use_arguments($elem)
376 2 70 if $has_version and @args == 1
379 12 58 if @args == 1 and $self->_is_pragma($elem)
382 1 57 if $has_qw and not $qw_uses_parens
386 4 53 if ($has_fat_comma)
387 2 2 if ($has_parens)
395 6 47 if ($has_complex_expr)
396 3 3 if ($has_parens)
406 7 60 if $arg->isa("PPI::Token::QuoteLike::Words")
409 0 60 unless $arg->can("string")
412 12 48 if ($self->would_interpolate($content))
419 28 7 if ($has_simple_strings || $has_q_operators and not $has_qw)
424 3 4 if ($has_qw and $string_count > 0 || $has_q_operators)
437 374 1163 if ($child->isa("PPI::Token::Word") and not $found_module)
438 187 187 if $child->content =~ /^(use|no)$/u
444 976 187 if ($found_module)
445 432 544 if $child->isa("PPI::Token::Whitespace")
446 15 529 if $child->isa("PPI::Token::Structure") and $child->content eq ";"
448 122 407 if $child->isa("PPI::Token::Operator") and $child->content eq ","
451 27 380 if ($child->isa('PPI::Structure::List')) { }
465 23 17 if ($child->isa('PPI::Statement::Expression')) { }
2 15 elsif ($child->isa('PPI::Statement') or $child->isa('PPI::Structure')) { }
467 152 179 if $expr_child->isa("PPI::Token::Whitespace")
470 29 150 if $expr_child->isa("PPI::Token::Operator") and $expr_child->content eq ","
478 15 0 if $child->isa("PPI::Token::Whitespace")
501 16 144 if $elem->isa("PPI::Token::Quote::Single") or $elem->isa("PPI::Token::Quote::Double") or $elem->isa("PPI::Token::Quote::Literal") or $elem->isa("PPI::Token::Quote::Interpolate")
507 11 233 if ($elem->isa("PPI::Token::QuoteLike::Words"))
510 1 10 unless $content =~ /\Aqw\s*\(/u
514 21 223 if ($elem->can("children"))
523 0 66 unless my $module = $elem->module
530 111 1428 if ($current->isa("PPI::Statement::Include") and $current->type =~ /^(use|no)$/u)
536 12 99 if @args == 1 and $self->_is_pragma($current)
541 11 326 if $arg->isa("PPI::Token::QuoteLike::Words")
544 192 134 unless $arg->can("string")
547 24 110 if ($self->would_interpolate($content))
565 4 31 if not $would_interpolate and $string =~ /\\[\$\@]/u
571 8 23 if ($has_double_quotes)
572 5 3 if $would_interpolate or $has_single_quotes