diff --git a/README.md b/README.md index 36b2ed6b..de878a2f 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,14 @@ # squawk [![npm](https://img.shields.io/npm/v/squawk-cli)](https://www.npmjs.com/package/squawk-cli) -> linter for Postgres migrations +> Linter for Postgres migrations & SQL -[quick start](https://squawkhq.com/docs/) | [rules documentation](https://squawkhq.com/docs/rules) | [github action](https://github.com/sbdchd/squawk-action) | [diy github integration](https://squawkhq.com/docs/github_app) +[Quick Start](https://squawkhq.com/docs/) | [Playground](https://play.squawkhq.com) | [Rules Documentation](https://squawkhq.com/docs/rules) | [GitHub Action](https://github.com/sbdchd/squawk-action) | [DIY GitHub Integration](https://squawkhq.com/docs/github_app) ## Why? Prevent unexpected downtime caused by database migrations and encourage best practices around Postgres schemas and SQL. -Also it seemed like a nice project to spend more time with Rust. - ## Install ```shell @@ -179,11 +177,11 @@ repos: Note the `files` parameter as it specifies the location of the files to be linted. -## prior art +## Prior Art - -### related tools +### Related Tools - - @@ -195,7 +193,7 @@ Note the `files` parameter as it specifies the location of the files to be linte - - -## related blog posts / SE Posts / PG Docs +## Related Blog Posts / SE Posts / PG Docs - - @@ -207,7 +205,7 @@ Note the `files` parameter as it specifies the location of the files to be linte - - -## dev +## Dev ```shell cargo install @@ -228,7 +226,7 @@ $ nix develop [nix-shell]$ ./s/fmt ``` -### adding a new rule +### Adding a New Rule When adding a new rule, the `s/new-rule` script will create stubs for your rule in Rust and in Documentation site. @@ -236,7 +234,7 @@ When adding a new rule, the `s/new-rule` script will create stubs for your rule s/new-rule 'prefer big serial' ``` -### releasing a new version +### Releasing a New Version 1. Update the `CHANGELOG.md` @@ -253,17 +251,12 @@ s/new-rule 'prefer big serial' Use the text and version from the `CHANGELOG.md` -### algolia +### Algolia The squawkhq.com Algolia index can be found on [the crawler website](https://crawler.algolia.com/admin/crawlers/9bf0dffb-bc5a-4d46-9b8d-2f1197285213/overview). Algolia reindexes the site every day at 5:30 (UTC). -## how it works - -squawk wraps calls to [libpg_query-sys](https://github.com/tdbgamer/libpg_query-sys) in a safe -interface and parses the JSON into easier to work with structures. -libpg_query-sys in turn uses [bindgen](https://rust-lang.github.io/rust-bindgen/) to bind to -[libpg_query](https://github.com/lfittl/libpg_query), which itself wraps Postgres' SQL -parser in a bit of C code that outputs the parsed AST into a JSON string. +## How it Works -Squawk then runs the rule functions over the parsed AST, gathers and pretty -prints the rule violations. +Squawk uses its parser (based on rust-analyzer's parser) to create a CST. The +linters then use an AST layered on top of the CST to navigate and record +warnings, which are then pretty printed! diff --git a/docs/src/pages/index.js b/docs/src/pages/index.js index fbd9d750..04eee503 100644 --- a/docs/src/pages/index.js +++ b/docs/src/pages/index.js @@ -204,7 +204,9 @@ function Home() {

Squawk

-

A linter for Postgres migrations

+

+ A linter for Postgres migrations & SQL +

+ ## dev ```shell diff --git a/playground/package.json b/playground/package.json index f7ad8748..c1379b03 100644 --- a/playground/package.json +++ b/playground/package.json @@ -5,8 +5,8 @@ "type": "module", "scripts": { "dev": "vite", - "build": "wasm-pack build --target web ../crates/wasm --out-dir ../../playground/src/pkg && vite build", - "deploy": "netlify deploy --prod", + "build": "wasm-pack build --target web ../crates/squawk_wasm --out-dir ../../playground/src/pkg && vite build", + "deploy": "netlify deploy --prod --dir dist", "lint": "eslint .", "preview": "vite preview" },