Skip to content

Commit 293cacd

Browse files
authored
feat(format): lay out clauses, parenthesised groups and windows as SQLQuack 0.6.0 does (#67)
* fix(deps): pin SQLQuack 0.6.0 All six direct sqlquack-* pins (11 locked packages) move from e1a583eb (0.5.1) to 8d28aa4c (0.6.0), so SQLBuild can link one SQLQuack copy. Work in progress: SQLQuack 0.6.0 changes the formatter's layout, and the format expectations are not updated yet. * feat(format): lay out clauses, parenthesised groups and windows as SQLQuack 0.6.0 does SQLQuack 0.6.0 changes three layout rules, and SQLClean's formatter is SQLQuack's: - A clause with a single short item stays on its header line (ORDER BY a DESC, GROUP BY customer_id, JOIN b ON b.id = a.id). - A parenthesised group that spans lines gets its own lines instead of hugging the call's parenthesis (ARRAY(\n (\n SELECT ...)). - A window specification too wide for one line is broken into PARTITION BY, ORDER BY and frame lines. Parse errors now name what was expected ("Expected an expression after BY") instead of the unexpected token. The format corpus records the old layout as previously_formatted, and one SQL Server departure is dropped because SQLQuack now matches SQLClean's recorded layout. * test(format): describe the STRUCT field-access departure's parenthesis layout
1 parent be41ae2 commit 293cacd

6 files changed

Lines changed: 132 additions & 94 deletions

File tree

‎Cargo.lock‎

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ sha2 = "0.10"
3030
similar = "2"
3131
sqlclean = { path = "crates/sqlclean" }
3232
# SQLQuack's formatter and lint engine, and the tokens and trees they read, which replace Polyglot.
33-
sqlquack-fingerprint = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66", features = ["bigquery", "databricks", "duckdb", "postgres", "snowflake", "sqlite", "sqlserver"] }
34-
sqlquack-format = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66", features = ["bigquery", "databricks", "duckdb", "postgres", "snowflake", "sqlserver"] }
35-
sqlquack-lint = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66", features = ["bigquery", "databricks", "duckdb", "postgres", "snowflake", "sqlite"] }
36-
sqlquack-parse = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
37-
sqlquack-syntax = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
38-
sqlquack-syntax-sqlserver = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "e1a583eb6d4180ff4121ef82b3f08b2982edca66" }
33+
sqlquack-fingerprint = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a", features = ["bigquery", "databricks", "duckdb", "postgres", "snowflake", "sqlite", "sqlserver"] }
34+
sqlquack-format = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a", features = ["bigquery", "databricks", "duckdb", "postgres", "snowflake", "sqlserver"] }
35+
sqlquack-lint = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a", features = ["bigquery", "databricks", "duckdb", "postgres", "snowflake", "sqlite"] }
36+
sqlquack-parse = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
37+
sqlquack-syntax = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
38+
sqlquack-syntax-sqlserver = { git = "https://github.com/sqlstack-io/sqlquack.git", rev = "8d28aa4c4b6c3d8c5345ddef3d620fa24e26741a" }
3939

4040
[workspace.lints.rust]
4141
unsafe_code = "forbid"

0 commit comments

Comments
 (0)