#!/bin/bash # .git/hooks/pre-push # 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-push checks...${NC}" PY_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.py$') # Python checks echo -e "${YELLOW}Checking Python files...${NC}" # Lint if ! uvx ruff check --extend-exclude=.*,build*; then PASS=false fi # Compile uv sync # Run different test suites based on changed files echo -e "${YELLOW}Running Python tests...${NC}" if ! uv run nosetests; then echo -e "Tests failed. Push aborted." PASS=false 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