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
* add LICENSE (MIT), CONTRIBUTING.md, authors, keywords, classifiers
* merge auto-tag workflow into ci.yml gated on lint-and-test
* fix CI expression injection by moving tag to env block
* pin snok/install-poetry to SHA, bump pyrefly-pre-commit to 0.53.0
* tighten branch regex to reject leading hyphens and ".." traversal
* handle missing git binary in validate_branch
* fail the run when alembic upgrade --sql errors (GenerateSqlError)
* document env.py execution and DATABASE_URL fallback in README
* rename README title to squawk-pre-commit
* add .ruff_cache/ to .gitignore
Copy file name to clipboardExpand all lines: README.md
+11-2Lines changed: 11 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Kintsugi Squawk
1
+
# squawk-pre-commit
2
2
3
3
A [pre-commit](https://pre-commit.com/) hook that lints SQL in [Alembic](https://alembic.sqlalchemy.org/) migrations using [squawk](https://squawkhq.com/), a PostgreSQL migration linter.
4
4
@@ -59,6 +59,13 @@ When pre-commit runs, the hook:
59
59
60
60
Merge migrations (where `down_revision` is a tuple) are skipped since they produce no DDL.
61
61
62
+
## Known Limitations
63
+
64
+
* The hook runs `alembic upgrade --sql`, which executes your project's `env.py` in offline mode. No database connection is made, but the Python code in `env.py` does run.
65
+
* If `DATABASE_URL` is not set, the hook provides a dummy fallback (`postgresql://localhost/lint`) so alembic's offline mode can generate SQL without a real connection string.
66
+
* If `alembic upgrade --sql` fails for a migration (e.g. due to missing dependencies or env configuration), the hook prints the error to stderr and fails the run.
67
+
* Merge migrations (where `down_revision` is a tuple) produce no DDL and are always skipped.
68
+
62
69
## Squawk Configuration
63
70
64
71
Squawk reads its configuration from `.squawk.toml` in the consumer repo root. See the [squawk docs](https://squawkhq.com/docs/configuration/) for available options.
@@ -67,7 +74,7 @@ Squawk reads its configuration from `.squawk.toml` in the consumer repo root. Se
67
74
68
75
**Prerequisites:**
69
76
70
-
* Python (version 3.12)
77
+
* Python 3.10+ (3.12 recommended for development)
71
78
* Poetry
72
79
* squawk-cli (`pip install squawk-cli`)
73
80
@@ -78,6 +85,8 @@ Squawk reads its configuration from `.squawk.toml` in the consumer repo root. Se
78
85
3. Install the pre-commit hooks: `pre-commit install`
79
86
4. Run tests: `poetry run pytest tests/ -v`
80
87
88
+
Some integration tests in `tests/test_squawk_config.py` require `squawk` on PATH and are automatically skipped if it is not installed.
0 commit comments