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

Failed to run Flake8-sql #17

Open
piusnig opened this issue Sep 24, 2020 · 2 comments
Open

Failed to run Flake8-sql #17

piusnig opened this issue Sep 24, 2020 · 2 comments

Comments

@piusnig
Copy link

piusnig commented Sep 24, 2020

Hey @pgjones, How do I run this plugin so that Linting can take place fo specifically SQL?

When I run using flake8 and put the rule e.g Q440 linting does not take place.

I have tried and searched around but failed to get the correct commands.

Can you please update the readme for guidance on this issue?

@pgjones
Copy link
Owner

pgjones commented Sep 25, 2020

This linter will run over the files you run flake8 over there is nothing special to do after installing. This documentation may help.

@KyleKing
Copy link

I'm troubleshooting a different issue and made a quick test file that might be useful. Save this snippet as flake8_sql_check.py

"""Test of flake8-sql.

Test with: python -m flake8 flake8_sql_check.py

Which should output at a minimum:

flake8_sql_check.py:11:9: Q443 incorrect whitespace around comma
flake8_sql_check.py:12:9: Q443 incorrect whitespace around comma
flake8_sql_check.py:14:9: Q444 incorrect whitespace around equals
flake8_sql_check.py:15:9: Q444 incorrect whitespace around equals

If needed, check installed extensions with: python -m flake8 --bug-report

"""

# https://github.com/pgjones/flake8-sql/blob/0ed4d53dfed6d243254d9065646b17cf8f49708d/tests/test_cases/whitespace.py
query = "SELECT ca,cb FROM tbl"  # Q443
query = "SELECT ca ,cb FROM tbl"  # Q443
query = "SELECT ca, cb FROM tbl"
query = "SELECT ca FROM tbl WHERE ca= 'b'"  # Q444
query = "SELECT ca FROM tbl WHERE ca ='b'"  # Q444
query = "SELECT ca FROM tbl WHERE ca = 'b'"
query = "SELECT ca FROM tbl WHERE ca != 'b'"

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

No branches or pull requests

3 participants