D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
PHP-Antimalware-Scanner
/
bin
/
Filename :
lint
back
Copy
#!/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!"