| Server IP : 216.238.66.20 / Your IP : 216.73.216.199 Web Server : nginx/1.30.4 System : Linux woropds 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/sweetheart.mx/htdocs/wp-content/plugins/wp-slimstat/.githooks/ |
Upload File : |
#!/usr/bin/env bash
#
# wp-slimstat pre-commit gate.
# Runs `php -l` (syntax lint) on every staged PHP file.
# Fast, dependency-free, catches syntax errors before they land.
# /simplify is enforced via CLAUDE.md (shell hooks cannot call Claude skills).
#
set -euo pipefail
echo "→ running fast gate before commit (wp-slimstat)"
staged_php="$(git diff --cached --name-only --diff-filter=ACMR -z | tr '\0' '\n' | grep -E '\.php$' || true)"
if [ -z "$staged_php" ]; then
echo " no PHP changes, gate skipped"
exit 0
fi
fail=0
while IFS= read -r file; do
[ -z "$file" ] && continue
if ! php -l "$file" > /dev/null 2>&1; then
echo " ✗ syntax error in $file"
php -l "$file" || true
fail=1
fi
done <<< "$staged_php"
if [ "$fail" -ne 0 ]; then
echo " gate failed — commit rejected"
exit 1
fi
echo " ✓ all staged PHP files pass php -l"
exit 0