Expand description
Lint rules for SQL, independent of any editor protocol.
lint (and its options/dialect-aware variants) checks source text against the SDF rule set
and returns LintDiagnostics located at byte ranges, so the CLI can render path:line:col
findings and the language server can convert them to LSP diagnostics without this crate ever
depending on LSP types.
§Rules
| code | rule |
|---|---|
SDF001 | SELECT * in a select list |
SDF002 | large literal IN (...) list |
SDF003 | unsupported embedded LANGUAGE ... AS $$...$$ |
SDF004 | DELETE without WHERE |
SDF005 | UPDATE without WHERE |
SDF006 | comma join in FROM (implicit cross join) |
SDF007 | ORDER BY ordinal (e.g. ORDER BY 1) |
§Suppression
A finding is suppressed by a line comment on the previous line:
-- sql-dialect-fmt: disable-next-line SDF001
SELECT * FROM t;Omitting the code (or writing all/lint) suppresses every rule for the next line.
Structs§
- Lint
Diagnostic - One lint finding, located at a byte range into the linted source text.
- Lint
Options - Lint knobs. Every rule is on by default; each can be disabled independently.
Enums§
- Dialect
- The SQL dialect a lex/parse/format request targets.
- Lint
Code - The stable identity of a lint rule; rendered as
SDFxxxviaLintCode::as_str. - Lint
Severity - How severe a finding is. Every current rule emits
LintSeverity::Warning.
Functions§
- lint
- Lint
textas Snowflake SQL with defaultLintOptions. - lint_
with_ dialect - Lint
textasdialect, honoringoptionsand suppression comments. Findings are sorted by source position. - lint_
with_ options - Lint
textas Snowflake SQL with explicit options.