You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0fe3fa5
Browse filesBrowse the repository at this point in the historyBrowse files
fix: close correctness gaps in Rules, SQL scanners and sqb query (#848)
* fix: report unused table aliases written without AS
SQBRSQL023 only recognised aliases introduced by AS, so an unused implicit alias such as `FROM orders o` went unreported. Implicit aliases after relation names, subqueries and table functions now follow the same unused-alias contract.
Refs CHI-376
* fix: report numeric BETWEEN bounds and IN lists as named decisions
SQBRDECLARATION102 only inspected binary comparison operators, so literal BETWEEN bounds and numeric IN/NOT IN members bypassed the rule. Range and value-list predicates are now evaluated like the equivalent comparisons, and value lists point to a list or set constant used through IN @const(...).
Refs CHI-397
* fix: treat dollar-quoted strings as opaque literals in compiler scanners
The compiler's reference, macro, declaration, interpolation and resolution scanners only recognised quote characters, so an apostrophe inside a $$...$$ literal opened a phantom quote and compilation failed with an unclosed quoted string, while reference-shaped text inside dollar quotes could be extracted as a dependency. The Python scanners and the native compiler scan policy now skip $$ and $tag$ literals like single-quoted strings.
Refs CHI-375
* fix: report sqb query warehouse errors as CLI errors
A warehouse error from sqb query escaped the CLI error projection and printed a Python traceback. Query execution failures now raise a coded CLI error, error[C108], carrying the warehouse message on stderr with exit code 2 and no stdout output.
Refs CHI-343
* fix: skip type-proof rules when SQL analysis is disabled
SQBRCONTRACT105 needs inferred type proofs, which only exist when SQL analysis runs, so compile --no-sql-analysis (or sql_analysis = false) reported it for essentially every typed contract column. Type-proof rules are now not evaluated when the run or project disables SQL analysis, and compile prints one note naming the skipped rules on stderr before the final summary. With analysis enabled, behaviour is unchanged.
Refs CHI-353
* fix: keep join modifiers and whole-row alias uses out of unused-alias findings
SQBRSQL023 treated an unaliased relation's join or relation modifier, such as POSITIONAL in `FROM orders POSITIONAL JOIN customers`, as an implicit alias and offered to delete it. It also counted an alias as used only when followed by a dot, so whole-row uses such as `to_json(o)`, `SELECT o` or `WHERE o IS NOT NULL` were reported and their deletion broke binding. Modifier and clause keywords are no longer implicit-alias candidates, and any bare identifier reference to the alias counts as a use for both implicit and AS aliases.
Refs CHI-376
* fix: keep WINDOW clauses out of unused-alias findings
* fix: report aliases that repeat their relation name when unused
Copy file name to clipboardExpand all lines: crates/sqlbuild-rules-native/src/rules/_helpers/evaluation.rs
+40-18Lines changed: 40 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,7 @@ use std::ops::ControlFlow;
30
30
31
31
constMIXED_STAR_REMEDIATION:&str = "SELECT *, a, b mixes a passthrough star with derived columns. The * exemption permits a lone SELECT * only. Move a and b into an earlier CTE so they are computed upstream, leaving the final select a pure SELECT *. If you need those columns in the output, drop the * exemption and enumerate every column explicitly.";
32
32
constRULES_PARSER_RECURSION_LIMIT:usize = 128;
33
+
constNUMERIC_VALUE_LIST_REMEDIATION:&str = "Declare the values as a list or set CONSTANT and compare through [NOT] IN @const(\"<name>\"); only -1, 0, and 1 are self-explanatory.";
0 commit comments