chore: migrate to lefthook for git hooks
Replace custom bash pre-commit hook with lefthook for: - Parallel execution of ruff + pytest - Quieter output (pytest -q instead of -v) - Version-controlled config (lefthook.yml) - Smart skipping when no .py files staged 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -46,3 +46,4 @@ build/
|
|||||||
.env
|
.env
|
||||||
*.local
|
*.local
|
||||||
.sesskey
|
.sesskey
|
||||||
|
lefthook-local.yml
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
pkgs.jq
|
pkgs.jq
|
||||||
pkgs.sqlite
|
pkgs.sqlite
|
||||||
pkgs.skopeo # For pushing Docker images
|
pkgs.skopeo # For pushing Docker images
|
||||||
|
pkgs.lefthook # Git hooks manager
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|||||||
15
lefthook.yml
Normal file
15
lefthook.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# ABOUTME: Git hooks configuration using lefthook.
|
||||||
|
# ABOUTME: Runs ruff linting/formatting and pytest before commits.
|
||||||
|
|
||||||
|
pre-commit:
|
||||||
|
parallel: true
|
||||||
|
commands:
|
||||||
|
ruff-check:
|
||||||
|
glob: "**/*.py"
|
||||||
|
run: ruff check src/ tests/
|
||||||
|
ruff-format:
|
||||||
|
glob: "**/*.py"
|
||||||
|
run: ruff format --check src/ tests/
|
||||||
|
pytest:
|
||||||
|
glob: "**/*.py"
|
||||||
|
run: pytest tests/ -q --tb=short
|
||||||
Reference in New Issue
Block a user