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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 2Python 3

File details

Details for the file flake8-SQL-0.1.tar.gz.

File metadata

  • Download URL: flake8-SQL-0.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for flake8-SQL-0.1.tar.gz
Algorithm Hash digest
SHA256 f15b49c9212ab8f2b60e4cee020906b8169173fe4c90b65fe7e9296decdf4e6f
MD5 f22d55c560cfb6ac3991557252dc4316
BLAKE2b-256 2cddcc41e1d4063e450e6483ebff1db16e84da47d8bc40ca476d1fd4b4b4dab1

See more details on using hashes here.

File details

Details for the file flake8_SQL-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for flake8_SQL-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2185468f6ca6decf8f9934e47c80c36eb8ab873796402137f61793d1e093b55d
MD5 2b11ba265e4a0e3da05588fdae9ebb13
BLAKE2b-256 bf655066bd32121fb95699011e456da8efdb2602c5ec66eb498deea0d44a7184

See more details on using hashes here.

Supported by

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