Thanks for taking the time. Contributions of any size are welcome.
make dev-setup # creates .venv, installs deps, pre-commit hooks, builds wheelsor, for Rust-only work:
cargo build --workspace
cargo test --workspaceThe Rust toolchain is pinned via rust-toolchain.toml. Rustup will install the
right version automatically when you run cargo inside the repo.
CI runs the same checks — failing any of these will fail your PR.
cargo fmt --all --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --workspace --all-features
cargo deny check # licenses + RUSTSEC advisoriesCommits must follow Conventional Commits
(enforced by pre-commit). Common prefixes: feat, fix, refactor, chore,
docs, test, perf. Use ! (e.g. feat!:) for breaking changes.
Every SQL clause that needs schema-aware checks implements
validation::clauses::ClauseValidation (see sqlshield/src/validation/clauses/mod.rs).
The canonical example is clauses/select.rs.
Rough recipe:
- Add
mod <clause>;inclauses/mod.rs. - Create
clauses/<clause>.rsandimpl ClauseValidation for sqlparser::ast::<Type>. - Wire it into
validation::validate_query_with_schema(or the statement dispatch invalidate_statements_with_schema). - Add fixtures under
sqlshield/tests/fixtures/and a unit test in the module.
Source file (*.py, *.rs, *.go, *.js, *.ts, *.tsx)
│ tree-sitter extracts string literals
▼
SQL string (with {…} / ${…} / fmt verbs replaced by `1`)
│ sqlparser parses
▼
AST (Vec<Statement>)
│ ClauseValidation walks the tree
▼
Vec<SqlValidationError>
sqlshield— core library (no I/O concerns beyond reading files to scan)sqlshield-cli— thin clap-based CLI wrappersqlshield-py— PyO3 bindings exposingvalidate_query/validate_filessqlshield-lsp— Language Server for editor integrationsqlshield-introspect— live schema reader for Postgres / SQLite, consumed by the CLI's--db-urlflageditors/vscode— first-party VS Code extension wrappingsqlshield-lsp
Releases are automated via release-plz. Merging a
conventional-commit PR into main triggers the workflow to open (or update) a
release PR that bumps versions and generates changelog entries. Merging the
release PR tags the commit and publishes to crates.io + PyPI.