Skip to main content

Flake8 plugin that checks SQL code against opinionated style rules

Project description

Build Status

Flake8-SQL is a flake8 plugin that looks for SQL queries and checks then against some opinionated styles. These styles mostly follow SQL Style Guide, but differ as detailed below.

Warnings

Q440 Keyword is not uppercase

All the SQL reserved keywords should be uppercase.

Q441 Name is not snake_case

All the non SQL keywords should be snake_case, which due to a limitation means simply that the word is lowercase.

Q442 Avoid abbreviated keywords

Avoid using abbreviated keywords instead use the full length version.

Q443 Incorrect whitespace around comma

Commas should be followed by whitespace, but not preceded.

Q444 Incorrect whitespace around equals

Equals should be surrounded with whitespace.

Q445 Missing linespace between phrases

The phrases SELECT, FROM, INSERT INTO, VALUES, DELETE FROM, WHERE, UPDATE, and SET should be on separate lines (unless the entire query is on one line).

Q446 Missing newline after semicolon

Semicolons must be at the end of the line.

Limitations

String constants are sought out in the code and considered SQL if they contain select from, insert into values, update set or delete from in order. This may and is likely to lead to false positives, in which case simply add # noqa to have this plugin ignore the string.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8-SQL-0.1.tar.gz (8.9 kB view hashes)

Uploaded Source

Built Distribution

flake8_SQL-0.1-py2.py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page