Add pre-commit ruff enforcement hook for all Python repos #78
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ldraney/claude-custom#78
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Lineage
pal-e-agency— standalone improvement (no plan phase — platform-wide dev tooling)Repo
forgejo_admin/claude-customUser Story
As a platform operator
I want ruff lint violations to be caught before any git commit in any Python repo
So that CI never breaks due to formatting/lint issues again
Context
basketball-api CI was broken for multiple pipelines (#59) because ruff violations were committed without being caught. The fix was trivial (6 violations in 2 files) but required manual intervention and a PR cycle. This has happened repeatedly — basketball-api's git history shows 5 separate ruff fix commits.
The platform has 8 Python repos, all with
ruff check+ruff format --checkin Woodpecker CI. But CI catches violations too late (after push). A Claude Code PreToolUse hook can catch them before commit.pal-e-docs already has
.pre-commit-config.yaml— the other 7 repos don't.File Targets
Files to create:
hooks/check-ruff-before-commit.sh— PreToolUse hook, fires on Bash tool use containinggit commit, runsruff check .if Python repo (pyproject.toml exists), blocks if violations foundFiles to modify:
settings.json— wire hook into Bash PreToolUse matchersFiles NOT to touch:
.pre-commit-config.yaml— separate issue, not this scopeAcceptance Criteria
git commitin a Python repo with ruff violations is blocked with helpful errorgit commitin a Python repo with clean ruff passes throughgit commitin a non-Python repo (no pyproject.toml) passes throughTest Expectations
Constraints
hooks/directorygit pullon claude-custom auto-deploysChecklist
Related
basketball-api #59— the incident that motivated thispal-e-agency— project this belongs to