keyword-case
What it does
Section titled “What it does”Reports a keyword not in the case that the policy option sets. With consistent (the default) the first one written fixes the case (upper, lower or capitalise) and a later one that cannot be in it is reported; the other values name the case. The fix writes the word in that case.
Why it matters
Section titled “Why it matters”Keywords in one case stand out from the names of tables and columns, and a file that mixes cases looks like it was merged from different sources.
To fix, write the keyword in the case that the policy gives.
Example
Section titled “Example”SELECT a, B, COUNT(c), sum(d), NULL, true, cast(e as INT), cast(f as text)from tWHERE a = 1;SELECT a, b, COUNT(c), SUM(d), NULL, TRUE, CAST(e AS INT), CAST(f AS TEXT)FROM tWHERE a = 1;Configuration
Section titled “Configuration”sql: lint: rules: keyword-case: level: warn # off (default), warn, error options: policy: "consistent"| Option | Type | Default | Description |
|---|---|---|---|
policy |
string | "consistent" |
The case the words must be in: consistent follows the first one written.Values: consistent, upper, lower, capitalise |
Enabled by the presets: sql/sqlfluff.
Suppress one line with sudsy-disable-next-line keyword-case in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| sqlfluff | CP01 |
full |