Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset _sqlsafe when scanning multiple documents; added tests #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

cngarrison
Copy link

I was getting false positives for violations marked as safe, when scanning multiple documents.

I have overridden the prepare_to_scan_document method from Perl::Critic::Policy to reset the _sqlsafe attribute. Resetting the attribute for each document fixes the problem.

I also added some tests. Running the test against the current version will fail. The tests pass with the changes in this PR.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.059% when pulling acf41ec on cngarrison:master into 13fa7f0 on guillaumeaubert:master.

@coveralls
Copy link

coveralls commented Jul 19, 2019

Coverage Status

Coverage remained the same at 97.059% when pulling 8941b13 on cngarrison:master into 13fa7f0 on guillaumeaubert:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.059% when pulling acf41ec on cngarrison:master into 13fa7f0 on guillaumeaubert:master.

oalders added a commit to perl-ide/Perl-Critic-Policy-ValuesAndExpressions-PreventSQLInjection that referenced this pull request Mar 4, 2021
        - Added test for heredoc terminators
          guillaumeaubert#17
          (Victor Efimov)
        - Reset `_sqlsafe` when scanning multiple documents; added tests
          guillaumeaubert#22
          (Charlie Garrison)
        - New test cases related to anonymous functions
          guillaumeaubert#18
          (Victor Efimov)
        - Add safe_context configuration option
          guillaumeaubert#23
          (Nelson Ferraz)
        - Added a new "prefer_upper_case_keywords" configuration option (Olaf Alders)
        - Added detection for ALTER, CREATE and DROP statements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants