golden hour
/opt/PHP-Antimalware-Scanner/bin
⬆️ Go Up
Upload
File/Folder
Size
Actions
build
1.59 KB
Del
OK
composer
2.27 MB
Del
OK
fix-cs
908 B
Del
OK
fix-cs-all
621 B
Del
OK
lint
777 B
Del
OK
pre-commit
355 B
Del
OK
run
2.14 KB
Del
OK
Edit: lint
#!/usr/bin/env bash # Variables # shellcheck disable=SC2164 CURRENT_DIRECTORY="$(cd "$(dirname "$0")"; pwd -P)" PROJECT_DIRECTORY="$(dirname "${CURRENT_DIRECTORY}")" # shellcheck disable=SC2164 cd "${PROJECT_DIRECTORY}"; echo "Checking PHP Lint..." if [ -z "$1" ] then git diff --cached --name-only --diff-filter=ACMR HEAD -- '*.php' | while read line; do php -l -d display_errors=1 "${PROJECT_DIRECTORY}/$line" if [ $? != 0 ] then echo "[!] Fix the error before(s) commit." exit 1 fi FILES="$FILES $PROJECT_DIRECTORY/$line" done else php -l -d display_errors=1 "${PROJECT_DIRECTORY}/$1" if [ $? != 0 ] then echo "[!] Fix the error before(s) commit." exit 1 fi fi echo "[Done] Operation completed!"
Save