public release 4.2.0 - see README.md and CHANGES.md for details
This commit is contained in:
34
.githooks/pre-commit
Executable file
34
.githooks/pre-commit
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# .git/hooks/pre-commit
|
||||
# requires uv
|
||||
|
||||
# Track overall status
|
||||
PASS=true
|
||||
|
||||
# Color output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
echo -e "${YELLOW}Running pre-commit checks...${NC}"
|
||||
|
||||
PY_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.py$')
|
||||
|
||||
# Python checks
|
||||
if [ -n "$PY_FILES" ]; then
|
||||
echo -e "${YELLOW}Checking Python files...${NC}"
|
||||
|
||||
if ! uvx ruff check --extend-exclude=.*,build*; then
|
||||
PASS=false
|
||||
fi
|
||||
fi
|
||||
|
||||
# Final status
|
||||
if [ "$PASS" = true ]; then
|
||||
echo -e "${GREEN}All checks passed!${NC}"
|
||||
exit 0
|
||||
else
|
||||
echo -e "${RED}Some checks failed. Please fix issues before committing.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user