Hooks: PHPUnit in Pre-Commit (#67) #70
@@ -1 +1,3 @@
|
|||||||
npx lint-staged
|
# Delegiert an scripts/pre-commit-checks.sh
|
||||||
|
# (gleiche Logik wie safe-commit.sh-Safety-Net, nur einmalig)
|
||||||
|
./scripts/pre-commit-checks.sh
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# safe-commit.sh – Commit with pre-commit hooks guaranteed to run
|
# safe-commit.sh – Commit with pre-commit hooks guaranteed to run
|
||||||
# Usage: ./scripts/safe-commit.sh "commit message"
|
# Usage: ./scripts/safe-commit.sh "commit message"
|
||||||
#
|
#
|
||||||
# This script ensures lint checks always execute, even when committing
|
# This script ensures lint + PHPUnit checks always execute, even when committing
|
||||||
# from non-interactive contexts (CI, AI agents, etc.).
|
# from non-interactive contexts (CI, AI agents, etc.).
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
@@ -21,17 +21,9 @@ if [ -d ".husky" ]; then
|
|||||||
git config core.hooksPath .husky
|
git config core.hooksPath .husky
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run lint-staged manually as a safety net (in case hook is skipped)
|
# Run pre-commit checks manually as a safety net (in case hook is skipped)
|
||||||
if command -v npx &>/dev/null && [ -f "node_modules/.bin/lint-staged" ]; then
|
# Same logic as .husky/pre-commit, just in case the hook is bypassed.
|
||||||
echo "🔍 Running pre-commit lint checks..."
|
./scripts/pre-commit-checks.sh
|
||||||
npx lint-staged || {
|
|
||||||
echo ""
|
|
||||||
echo "❌ Lint checks failed. Commit aborted."
|
|
||||||
echo " Fix the errors above and try again."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
echo "✅ All lint checks passed."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Commit with hooks enabled (no --no-verify)
|
# Commit with hooks enabled (no --no-verify)
|
||||||
git commit -m "$MSG"
|
git commit -m "$MSG"
|
||||||
|
|||||||
Reference in New Issue
Block a user