forked from Rockachopa/Timmy-time-dashboard
* fix: reserve red for real errors, reduce log noise, allow Tailscale access - Add _ColorFormatter: red = ERROR/CRITICAL only, yellow = WARNING, green = INFO - Override uvicorn's default colors to use our scheme - Downgrade discord "not installed" from ERROR to WARNING (optional dep) - Downgrade DuckDuckGo unavailable from INFO to DEBUG - Stop discord token watcher retry loop when discord.py not installed - Add configurable trusted_hosts setting; dev mode allows all hosts - Exclude .claude/ from uvicorn reload watcher (worktree isolation) - Fix pre-commit hook: use tox -e unit, bump timeout to 60s Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: auto-format with black Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: pre-commit hook auto-formats with black+isort before testing Formatting should never block a commit — just fix it automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Trip T <trip@local> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pre-commit hook: auto-format, then test via tox.
|
|
# Blocks the commit if tests fail. Formatting is applied automatically.
|
|
#
|
|
# Auto-activated by `make install` via git core.hooksPath.
|
|
|
|
set -e
|
|
|
|
MAX_SECONDS=60
|
|
|
|
# Auto-format staged files so formatting never blocks a commit
|
|
echo "Auto-formatting with black + isort..."
|
|
tox -e format -- 2>/dev/null || tox -e format
|
|
git add -u
|
|
|
|
echo "Running pre-commit gate via tox (${MAX_SECONDS}s limit)..."
|
|
|
|
# macOS lacks GNU timeout; use perl as a portable fallback.
|
|
if command -v timeout &>/dev/null; then
|
|
timeout "${MAX_SECONDS}" tox -e unit
|
|
else
|
|
perl -e "alarm ${MAX_SECONDS}; exec @ARGV" -- tox -e unit
|
|
fi
|
|
exit_code=$?
|
|
|
|
# Re-stage any files that were reformatted
|
|
git add -u
|
|
|
|
if [ "$exit_code" -eq 142 ] || [ "$exit_code" -eq 124 ]; then
|
|
echo ""
|
|
echo "BLOCKED: pre-commit gate exceeded ${MAX_SECONDS}s wall-clock limit."
|
|
echo "Speed up slow tests before committing."
|
|
exit 1
|
|
elif [ "$exit_code" -ne 0 ]; then
|
|
echo ""
|
|
echo "BLOCKED: pre-commit gate failed."
|
|
exit 1
|
|
fi
|