Branch Coverage

blib/lib/Perl/Critic/Policy/ValuesAndExpressions/PreventSQLInjection.pm
Criterion Covered Total %
branch 88 104 84.6


line true false branch
331 32 53 unless is_sql_statement($element)
337 27 26 defined $sql_injections && scalar @$sql_injections != 0 ? :
370 77 205 if ($token->isa('PPI::Token::HereDoc') or $token->isa('PPI::Token::Quote')) { }
55 150 elsif ($token->isa('PPI::Token::Operator') and $token->content eq '.') { }
44 106 elsif ($token->isa('PPI::Token::Structure') and $token->content eq ';') { }
3 103 elsif ($token->isa('PPI::Token::Operator') and $token->content eq ':') { }
1 102 elsif ($token->isa('PPI::Token::Operator') and $token->content eq ',') { }
21 81 elsif ($token->isa('PPI::Token::Symbol')) { }
22 59 elsif ($token->isa('PPI::Token::Word')) { }
372 0 77 unless analyze_string_injections($self, $token)
404 15 6 unless ($is_quoted)
408 11 4 unless exists $safe_elements->{$variable}
417 9 13 if (defined $function_name and not $is_quoted)
421 4 5 unless exists $$safe_elements{'&' . $function_name}
447 0 22 unless $token->isa('PPI::Token::Word')
452 0 22 if not defined $next_sibling or $next_sibling eq ''
457 4 18 if ($next_sibling->isa('PPI::Token::Operator') and $next_sibling->content eq '->') { }
18 0 elsif ($next_sibling->isa('PPI::Structure::List')) { }
462 0 4 if not defined $function or $function eq ''
464 0 4 unless $function->isa('PPI::Token::Word')
481 12 6 if $previous_sibling->isa('PPI::Token::Operator') and $previous_sibling->content eq '->'
486 3 3 if (not $content =~ /::/) { }
502 1 9 defined $self->{'_safe_functions_regex'} && $full_name =~ /$self->{'_safe_functions_regex'}/ ? :
527 0 21 unless $token->isa('PPI::Token::Symbol')
536 0 58 if not defined $sibling or $sibling eq ''
538 20 38 if ($sibling->isa('PPI::Token::Operator') and $sibling->content eq '->') { }
17 21 elsif ($sibling->isa('PPI::Structure::Subscript')) { }
6 15 elsif ($sibling->isa('PPI::Token::Word') and $sibling->method_call and defined $self->{'_quoting_methods_regex'} and $sibling->content =~ /$self->{'_quoting_methods_regex'}/) { }
578 53 32 $content =~ /^ \s* (?: SELECT | INSERT | UPDATE | DELETE ) \b/six ? :
598 12 129 if ($token->isa('PPI::Token::HereDoc')) { }
129 0 elsif ($token->isa('PPI::Token::Quote')) { }
638 21 56 if $token->isa('PPI::Token::Quote::Single')
653 6 50 $is_heredoc ? :
668 49 7 if ($token->isa('PPI::Token::Quote::Double')) { }
1 6 elsif ($token->isa('PPI::Token::Quote::Interpolate')) { }
6 0 elsif ($is_heredoc) { }
670 7 42 if scalar @$unsafe_variables != 0
677 0 1 unless defined $lead
681 0 1 if $lead eq 'q'
683 1 0 if scalar @$unsafe_variables != 0
693 1 5 if $token->{'_mode'} ne 'interpolate'
695 4 1 if scalar @$unsafe_variables != 0
707 12 65 defined $sql_injections ? :
730 0 80 unless defined $self->{'_sqlsafe'}
731 0 80 unless defined $line_number and $line_number =~ /\A\d+\Z/
736 50 30 unless exists $self->{'_sqlsafe'}{$line_number}
765 31 54 if defined $self->{'_sqlsafe'}
774 0 19 unless defined $safe_elements
801 54 31 unless (exists $self->{'_quoting_methods_regex'})
803 53 1 if ($self->{'_quoting_methods'} =~ /\w/) { }
814 54 31 unless (exists $self->{'_safe_functions_regex'})
816 1 53 if ($self->{'_safe_functions'} =~ /\w/) { }