Add ruff lint check PreToolUse hook for git commits #81
No reviewers
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!81
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "78-add-ruff-pre-commit-hook"
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?
Summary
Adds a PreToolUse hook that blocks
git commitin Python repos whenruff checkfinds lint violations. This prevents CI breakage from committed lint issues (e.g., basketball-api #59 incident).Changes
hooks/check-ruff-before-commit.sh(new) -- PreToolUse hook that fires on Bash commands containinggit commit. Detects Python repos viapyproject.toml, resolves repo root (works in worktrees), runsruff check, and blocks with a helpful error message showing violations and fix command. Fails open on any error (missing ruff, non-Python repo, non-git directory).settings.json-- Wires the new hook into the Bash PreToolUse matcher list, afterpypi-pr-checklist.sh.Test Plan
git add && git commit) are detected correctlyReview Checklist
trap 'exit 0' ERRgit rev-parse --show-toplevel)Related
basketball-api #59-- the incident that motivated thispal-e-agency-- project this belongs to22713a943atoa24086b754