paper-dynasty-discord/.githooks/pre-commit
Cal Corum 5bed0f3164
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m20s
feat: add /resend_scout admin command and pre-commit hooks
Adds /resend_scout slash command to manually re-post a scout opportunity
with a custom timeout window. Updates the scout_opportunity's expires_at
in the database before posting. Also adds ruff pre-commit hook for
staged Python files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 10:39:08 -05:00

34 lines
784 B
Bash
Executable File

#!/bin/bash
#
# Pre-commit hook: ruff lint check on staged Python files.
# Catches syntax errors, unused imports, and basic issues before commit.
# To bypass in emergency: git commit --no-verify
#
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
REPO_ROOT=$(git rev-parse --show-toplevel)
cd "$REPO_ROOT"
STAGED_PY=$(git diff --cached --name-only --diff-filter=ACM -- '*.py')
if [ -z "$STAGED_PY" ]; then
exit 0
fi
echo "ruff check on staged files..."
echo "$STAGED_PY" | xargs ruff check
RUFF_EXIT=$?
if [ $RUFF_EXIT -ne 0 ]; then
echo ""
echo -e "${RED}Pre-commit checks failed. Commit blocked.${NC}"
echo -e "${YELLOW}To bypass (not recommended): git commit --no-verify${NC}"
exit 1
fi
echo -e "${GREEN}All checks passed.${NC}"
exit 0