@neralabs/rerail-pack-sql 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,3 +108,95 @@ Scoring one rule with every false positive and false negative printed:
|
|
|
108
108
|
```sh
|
|
109
109
|
node --import tsx conformance/languages/cli.ts --pack sql --rule sqlfluff-al04-aliasing-unique-table --fixtures
|
|
110
110
|
```
|
|
111
|
+
|
|
112
|
+
## Rule details
|
|
113
|
+
|
|
114
|
+
What each rule matches beyond its one-line description: exact matching, edge cases, upstream settings and known divergences.
|
|
115
|
+
|
|
116
|
+
### `sqlfluff-al04-aliasing-unique-table`
|
|
117
|
+
|
|
118
|
+
Port of SQLFluff 4.4.0 AL04. Reports each later table relation whose explicit alias (or, unaliased, its table name) matches an earlier one in the same FROM clause, compared under PostgreSQL name folding.
|
|
119
|
+
|
|
120
|
+
### `sqlfluff-al05-aliasing-unused`
|
|
121
|
+
|
|
122
|
+
Port of SQLFluff 4.4.0 AL05 (aliasing.unused) with default settings. Not reported where the alias is required (a derived table or VALUES list) or where the same table is referenced more than once.
|
|
123
|
+
|
|
124
|
+
### `sqlfluff-al08-aliasing-unique-column`
|
|
125
|
+
|
|
126
|
+
Port of SQLFluff 4.4.0 AL08. In each SELECT list, reports each later reused explicit alias or column-reference name, case-insensitively, with identifier quote delimiters ignored.
|
|
127
|
+
|
|
128
|
+
### `sqlfluff-al09-aliasing-self-alias-column`
|
|
129
|
+
|
|
130
|
+
Port of SQLFluff 4.4.0 AL09 (aliasing.self_alias.column). Reports a column reference aliased to its own last name part, either written identically (quotes and case included) or, both unquoted, differing in case only (the "ambiguous self alias" message). Anchored at the select element's start.
|
|
131
|
+
|
|
132
|
+
### `sqlfluff-am01-ambiguous-distinct`
|
|
133
|
+
|
|
134
|
+
Port of SQLFluff 4.4.0 AM01 (ambiguous.distinct). Implementation note: the grammar puts GROUP BY in the FROM node after the SELECT node.
|
|
135
|
+
|
|
136
|
+
### `sqlfluff-am02-ambiguous-union`
|
|
137
|
+
|
|
138
|
+
Port of SQLFluff 4.4.0 AM02 (ambiguous.union). Flags a UNION not immediately followed by DISTINCT or ALL. SQLFluff skips AM02 in its postgres dialect (it runs in ANSI, MySQL and other dialects with UNION DISTINCT; not SQLite), so the rule would start off and be turned on for MySQL/ANSI repositories (README already covers the start-off part).
|
|
139
|
+
|
|
140
|
+
### `sqlfluff-am05-ambiguous-join`
|
|
141
|
+
|
|
142
|
+
Port of SQLFluff 4.4.0 AM05 (ambiguous.join) with default fully_qualify_join_types=inner: reports a join whose first join keyword is bare JOIN, anchored at the JOIN clause start.
|
|
143
|
+
|
|
144
|
+
### `sqlfluff-am09-ambiguous-order-by-limit`
|
|
145
|
+
|
|
146
|
+
Port of SQLFluff 4.4.0 AM09 (ambiguous.order_by_limit). Anchored at LIMIT. A LIMIT that ends a UNION, INTERSECT or EXCEPT belongs to the set expression, which SQLFluff's AM09 does not read. The grammar parses no OFFSET without LIMIT.
|
|
147
|
+
|
|
148
|
+
### `sqlfluff-cv02-convention-coalesce`
|
|
149
|
+
|
|
150
|
+
Port of SQLFluff 4.4.0 CV02 (convention.coalesce), default settings. Only unqualified IFNULL/NVL are reported; schema-qualified names are user-defined functions and are excluded.
|
|
151
|
+
|
|
152
|
+
### `sqlfluff-cv04-convention-count-rows`
|
|
153
|
+
|
|
154
|
+
Port of SQLFluff 4.4.0 CV04 (convention.count_rows) with prefer_count_1 and prefer_count_0 false. An unqualified COUNT whose only argument is the literal 0 or 1 is reported at the function's start; COUNT(column), COUNT(DISTINCT ...) and other expressions are not.
|
|
155
|
+
|
|
156
|
+
### `sqlfluff-cv05-convention-is-null`
|
|
157
|
+
|
|
158
|
+
Port of SQLFluff 4.4.0 CV05 (convention.is_null). Only =, != and <> whose right operand is the bare NULL literal (not parenthesised), anchored at the operator. A SET clause's assignment and an exclusion constraint's operator are not comparisons in the grammar, as SQLFluff skips them.
|
|
159
|
+
|
|
160
|
+
### `sqlfluff-cv08-convention-left-join`
|
|
161
|
+
|
|
162
|
+
Port of SQLFluff 4.4.0 CV08 (convention.left_join). Reports RIGHT JOIN and RIGHT OUTER JOIN at the start of the join clause.
|
|
163
|
+
|
|
164
|
+
### `sqlfluff-pg01-postgres-excessive-locks`
|
|
165
|
+
|
|
166
|
+
Port of SQLFluff 4.4.0 PG01 (postgres.excessive_locks), force_enable=true. CREATE INDEX (except UNIQUE), DROP INDEX, REINDEX and REFRESH MATERIALIZED VIEW must use CONCURRENTLY; each anchored at the statement start. Statements inside a dollar-quoted routine or DO body (a string to SQLFluff) or an error region are not read.
|
|
167
|
+
|
|
168
|
+
### `sqlfluff-pg02-postgres-not-valid-foreign-key`
|
|
169
|
+
|
|
170
|
+
Port of SQLFluff 4.4.0 PG02 (postgres.not_valid_foreign_key), force_enable=true. ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY must include NOT VALID; anchored at the ALTER TABLE start. Statements inside a dollar-quoted routine or DO body or an error region are not read.
|
|
171
|
+
|
|
172
|
+
### `sqlfluff-rf01-references-from`
|
|
173
|
+
|
|
174
|
+
Port of SQLFluff 4.4.0 RF01 (references.from), default settings. Flags the table qualifier of a column reference that names no table or alias in the FROM clause of its query or of an enclosing query.
|
|
175
|
+
|
|
176
|
+
### `sqlfluff-rf04-references-keywords`
|
|
177
|
+
|
|
178
|
+
Port of SQLFluff 4.4.0 RF04 (references.keywords) with defaults (unquoted_identifiers_policy = aliases, quoted_identifiers_policy = none). Reports a naked identifier of more than one character that names a table or column alias or a CREATE TABLE column definition and is a keyword. SQLFluff reads the file's dialect's unreserved keywords; the engine has no dialect setting, so the regex holds the keywords that SQLFluff's postgres and mysql dialects both list as unreserved (a reserved word cannot be a naked alias there). ALTER TABLE ... ADD COLUMN names are skipped, as SQLFluff's postgres dialect reads them as column references.
|
|
179
|
+
|
|
180
|
+
### `sqlfluff-rf05-references-special-chars`
|
|
181
|
+
|
|
182
|
+
Port of SQLFluff 4.4.0 RF05 (references.special_chars) with defaults (both identifier policies all, no space or additional characters allowed). Reports a naked or quoted identifier whose name, without quotes and underscores, holds a character other than a Unicode letter or digit (a doubled quote included). A name in a SELECT element that has an alias is not read (only the alias is), nor is a PostgreSQL extension name.
|
|
183
|
+
|
|
184
|
+
### `sqlfluff-rf06-references-quoting`
|
|
185
|
+
|
|
186
|
+
Port of SQLFluff 4.4.0 RF06 (references.quoting) with defaults (prefer_quoted_identifiers and prefer_quoted_keywords false, case_sensitive true), under SQLFluff's postgres dialect. Reports a double-quoted identifier whose name has no upper-case letter, matches the postgres naked-identifier template [\p{L}_][\p{L}\p{N}_$]* and is not one of the dialect's reserved words (its anti-template, embedded in the rule). A dollar-quoted routine body is not read.
|
|
187
|
+
|
|
188
|
+
### `sqlfluff-st01-structure-else-null`
|
|
189
|
+
|
|
190
|
+
Port of SQLFluff 4.4.0 ST01 (structure.else_null). Reports a CASE whose ELSE is the bare NULL literal, at the CASE start.
|
|
191
|
+
|
|
192
|
+
### `sqlfluff-st02-structure-simple-case`
|
|
193
|
+
|
|
194
|
+
Port of SQLFluff 4.4.0 ST02 (structure.simple_case). Reports a searched CASE with one WHEN that is boolean (THEN TRUE ELSE FALSE, or the reverse), or whose condition is `column IS NULL` with the column as its ELSE, or `column IS NOT NULL` with the column as its THEN; anchored at the WHEN condition. A simple CASE, several WHENs, a compound condition and IS DISTINCT FROM are not reported.
|
|
195
|
+
|
|
196
|
+
### `sqlfluff-st08-structure-distinct`
|
|
197
|
+
|
|
198
|
+
Port of SQLFluff 4.4.0 ST08 (structure.distinct). Three cases: in a SELECT DISTINCT whose first selected expression is parenthesized alone, reports the parentheses; where the parentheses start an arithmetic expression right after DISTINCT with no space, reports DISTINCT; and reports DISTINCT written as a function, DISTINCT(x), as an aggregate's lone argument (not around a subquery).
|
|
199
|
+
|
|
200
|
+
### `sqlfluff-st10-structure-constant-expression`
|
|
201
|
+
|
|
202
|
+
Port of SQLFluff 4.4.0 ST10 (structure.constant_expression). Reports =, != or <> whose operands are the same non-literal written identically, or two literals other than the allowed 1 = 1 and 1 = 0, anchored at the operator. A typed literal (timestamp '...') is not a literal there. An operand that is itself an arithmetic, bitwise or other binary expression is not one of SQLFluff's adjacent operands, so such comparisons are skipped.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neralabs/rerail-pack-sql",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Rerail rule pack: no rules yet; its SQLFluff ports are candidates until they pass the V1 rule validation gates.",
|
|
5
5
|
"license": "Apache-2.0 AND MIT",
|
|
6
6
|
"repository": {
|