Whitespace should be limited to a single space unless while indenting or preceding a comment.
Tables should not be aliased if that alias is not used. An usused alias makes code harder to read without changing any functionality.
References cannot reference objects not present in FROM
clause. It is recommended to remove the reference.
References should be qualified if SELECT
has more than one referenced table/view. NB: Except if they’re present in a USING
clause.
References should be consistent in statements with a single table. You can configure this in the [analyzers.meta]
section of the .deepsource.toml
vonfiguration file.
Keywords should not be used as identifiers.
Trailing whitespace is any spaces or tabs after the last non-whitespace character on the line until the newline.
A single section of whitespace contains both tabs and spaces.
AS
SQL-L023A single whitespace is expected after AS
in WITH
clause.
USING
SQL-L024A single whitespace expected after USING
in JOIN
clause to avoid confusing it for a function.
Each file should end with a trailing newline. Ref: https://unix.stackexchange.com/questions/18743/whats-the-point-in-adding-a-new-line-to-the-end-of-a-file
Inconsistent capitalization found for unquoted identifiers. All keywords should be of same case to maintain consistency.
Line length of the SQL statement exceeds the defined limit. This includes - Maximum line length allowed.
Inconsistent capitalisation of function names.
Operators near newlines should be placed after, not before the newline.
Table aliases should be unique within each clause. It is recommended to name the aliases differently.
Commas should be followed by a single whitespace unless followed by a comment.
All keywords should be of same case to maintain consistency. The defaults can be configured per your needs with the following parameters.
Implicit aliasing of table not allowed. Use explicit AS
clause.