Skip to content

Commit f91e45b

Browse files
authored
v2: remove libpg refs & link to playground (#443)
1 parent dc4dd7b commit f91e45b

File tree

5 files changed

+28
-27
lines changed

5 files changed

+28
-27
lines changed

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ glob = "0.3.1"
1717
insta = "1.39.0"
1818
jsonwebtoken = "8.1.1"
1919
lazy_static = "1.5.0"
20-
libpg_query-sys = { git = "https://github.com/chdsbd/libpg_query-sys.git", rev = "ac223c7b197459d657d166449ccf99883f23bbcb" }
2120
log = "0.4.25"
2221
reqwest = { version = "0.9.18", features = ["default-tls-vendored"]}
2322
serde = { version = "1.0.215", features = ["derive"] }
@@ -48,8 +47,6 @@ convert_case = "0.7.1"
4847
clap = { version = "4.5.8", features = ["derive"] }
4948

5049
# local
51-
squawk-parser = { version = "0.0.0", path = "./crates/parser" }
52-
squawk-linter = { version = "0.0.0", path = "./crates/linter" }
5350
squawk-github = { version = "0.0.0", path = "./crates/github" }
5451
squawk_lexer = { version = "0.0.0", path = "./crates/squawk_lexer" }
5552
squawk_parser = { version = "0.0.0", path = "./crates/squawk_parser" }

docs/docs/quick_start.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,15 @@ slug: /
77

88
## Install
99

10-
Note: due to `squawk`'s dependency on
11-
[`libpg_query`](https://github.com/lfittl/libpg_query/issues/44), `squawk`
12-
only supports Linux and macOS
13-
1410
```shell
1511
npm install -g squawk-cli
1612

1713
# or install binaries directly via the releases page
1814
https://github.com/sbdchd/squawk/releases
1915
```
2016

17+
**NOTE**: You can also try Squawk in the browser via the [Squawk Playground](https://play.squawkhq.com)!
18+
2119
## Usage
2220

2321
<details><summary><code>example-migration.sql</code></summary>
@@ -40,20 +38,34 @@ squawk example-migration.sql
4038

4139
<br/>
4240

43-
```shell
41+
```
4442
❯ squawk example-migration.sql
45-
example-migration.sql:2:1: warning: disallowed-unique-constraint
46-
47-
2 | ALTER TABLE table_name ADD CONSTRAINT field_name_constraint UNIQUE (field_name);
48-
49-
note: Adding a UNIQUE constraint requires an ACCESS EXCLUSIVE lock which blocks reads.
50-
help: Create an index CONCURRENTLY and create the constraint using the index.
43+
warning[constraint-missing-not-valid]: By default new constraints require a table scan and block writes to the table while that scan occurs.
44+
--> example-migration.sql:2:24
45+
|
46+
2 | ALTER TABLE table_name ADD CONSTRAINT field_name_constraint UNIQUE (field_name);
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48+
|
49+
warning[disallowed-unique-constraint]: Adding a `UNIQUE` constraint requires an `ACCESS EXCLUSIVE` lock which blocks reads and writes to the table while the index is built.
50+
--> example-migration.sql:2:28
51+
|
52+
2 | ALTER TABLE table_name ADD CONSTRAINT field_name_constraint UNIQUE (field_name);
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
|
55+
= help: Create an index CONCURRENTLY and create the constraint using the index.
56+
57+
Find detailed examples and solutions for each rule at https://squawkhq.com/docs/rules
58+
Found 2 issues in 1 file (checked 1 source file)
5159
```
5260

5361
See ["Running Migrations"](./safe_migrations.md#safety-requirements) for information about safely applying migrations in Postgres.
5462

5563
The [CLI docs](./cli.md) have more information about the `squawk` CLI tool and the [GitHub Integration docs](./github_app.md) outline configuring Squawk to work with GitHub pull requests.
5664

65+
## Playground
66+
67+
You can also lint your SQL in the [Squawk Playground](https://play.squawkhq.com) using the WASM compiled version!
68+
5769
## GitHub Action
5870

5971
```yml

docs/docs/troubleshooting.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,3 @@ title: Troubleshooting
44
---
55

66
If you encounter an issue using Squawk that can't be resolved with these docs, please [open an issue](https://github.com/sbdchd/squawk/issues/new).
7-
8-
9-
## common error messages
10-
11-
### postgres failed to parse query
12-
13-
Squawk was unable to parse the query using the PostgreSQL parser.
14-
15-
Usually the provided statement contains an error and isn't a valid Postgres statement.
16-
17-
Squawk uses the [libpg_query-sys](https://github.com/tdbgamer/libpg_query-sys) Rust bindings to [libpg_query](https://github.com/pganalyze/libpg_query) to parse Postgres queries using the Postgres parser.

docs/docusaurus.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ module.exports = {
5353
label: "Rules",
5454
position: "left",
5555
},
56+
{
57+
href: "https://play.squawkhq.com",
58+
label: "Playground",
59+
position: "right",
60+
},
5661
{
5762
to: "docs/",
5863
label: "Quick Start",

flake.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@
3939
Security
4040
]);
4141

42-
LIBPG_QUERY_PATH = final.libpg_query;
43-
4442
meta = with lib; {
4543
description = "Linter for PostgreSQL, focused on migrations";
4644
homepage = "https://github.com/sbdchd/squawk";

0 commit comments

Comments
 (0)