chore: exclude test fixtures from the sql-sop dogfooding pre-commit hook#51
Merged
Pawansingh3889 merged 1 commit intoMay 9, 2026
Merged
Conversation
The .pre-commit-config.yaml ran sql-sop with `--severity error` against every `*.sql` file in the repo. The only SQL files currently in the repo are the unit-test fixtures under tests/fixtures/ -- and those fixtures deliberately contain bad SQL (E001 DELETE without WHERE, E002 DROP without IF EXISTS, E003 GRANT/REVOKE, E004 string concatenation in WHERE, E005 INSERT without column list, E006 UPDATE without WHERE, plus warning- and structural-rule fixtures) so the rule unit tests can assert on those exact patterns. Result: pre-commit.ci has been reporting "Found 6 issues (6 errors) in 1 file" against tests/fixtures/errors.sql on every single PR for months. The pre-commit-ci status has been red the whole time but hidden behind the also-always-red validate check (just fixed by #50); on PRs that don't touch SQL fixtures, the dogfooding hook adds no diagnostic value because the failures are by design. Adding `exclude: ^tests/fixtures/` so the hook only runs against real SQL files outside the fixtures tree. No real .sql files exist in the repo today, so the hook is effectively dormant; the moment someone adds a migration script or an example query outside tests/fixtures/ it kicks in. Verified locally that the exclude pattern matches all four fixture files (clean.sql, contract_drift.sql, errors.sql, warnings.sql).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The sql-sop dogfooding hook in
.pre-commit-config.yamlransql-sop --severity erroron every*.sqlfile in the repo. The only SQL files in the repo are unit-test fixtures undertests/fixtures/, and those fixtures deliberately contain bad SQL so the rule unit tests can assert on them (E001 DELETE without WHERE, E002 DROP without IF EXISTS, etc.).Result: pre-commit.ci has been red on every PR with
Found 6 issues (6 errors) in 1 file. The failure was hidden behind the also-always-red validate check (just fixed by #50); on PRs that don't touch SQL fixtures the dogfooding adds no diagnostic value because the failures are by design.Fix
Add
exclude: ^tests/fixtures/to the hook so it only runs against real SQL files outside the fixtures tree. There are no real.sqlfiles in the repo today, so the hook is effectively dormant -- it kicks in the moment someone adds a migration script, an example query, or a scratch file outsidetests/fixtures/.The rule unit tests in
tests/test_rules.py(and similar) continue to consume those fixtures via pytest as before.