diff --git a/.claude/scripts/hooks/post-edit-quality.sh b/.claude/scripts/hooks/post-edit-quality.sh index 768081a..3f7c738 100755 --- a/.claude/scripts/hooks/post-edit-quality.sh +++ b/.claude/scripts/hooks/post-edit-quality.sh @@ -38,7 +38,8 @@ WARNINGS="" # ── 1. Ruff 格式 + lint 检查 ── if command -v ruff &> /dev/null; then - RUFF_OUTPUT=$(ruff check "$FILE_PATH" 2>&1 || true) + # --quiet: 成功时零输出(避免把 "All checks passed!" 误判为问题),失败时只打印诊断行 + RUFF_OUTPUT=$(ruff check --quiet --output-format concise "$FILE_PATH" 2>&1 || true) if [[ -n "$RUFF_OUTPUT" ]]; then ERRORS+="[ruff] 风格/lint 问题:\n$RUFF_OUTPUT\n\n" fi diff --git a/.claude/scripts/hooks/pre-commit-guard.sh b/.claude/scripts/hooks/pre-commit-guard.sh index 10ea7b0..a3b1441 100755 --- a/.claude/scripts/hooks/pre-commit-guard.sh +++ b/.claude/scripts/hooks/pre-commit-guard.sh @@ -33,7 +33,8 @@ for CODE_DIR in "${CODE_DIRS[@]}"; do # ── 1. 全量代码质量检查 ── if command -v ruff &> /dev/null; then - RUFF_OUTPUT=$(ruff check "$CODE_DIR" 2>&1 || true) + # --quiet: 成功时零输出(避免把 "All checks passed!" 误判为问题),失败时只打印诊断行 + RUFF_OUTPUT=$(ruff check --quiet --output-format concise "$CODE_DIR" 2>&1 || true) if [[ -n "$RUFF_OUTPUT" ]]; then ERROR_COUNT=$(echo "$RUFF_OUTPUT" | wc -l) ERRORS+="[ruff] $CODE_DIR/ 中有 ${ERROR_COUNT} 个问题。运行 ruff check $CODE_DIR/ 查看详情。\n"