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: fix-cs
#!/usr/bin/env bash echo "Running php-cs-fixer to format the code on git diff..." # Variables # shellcheck disable=SC2164 CURRENT_DIRECTORY="$(cd "$(dirname "$0")"; pwd -P)" PROJECT_DIRECTORY="$(dirname "${CURRENT_DIRECTORY}")" # shellcheck disable=SC2164 cd "${PROJECT_DIRECTORY}"; PHP_CS_FIXER="${PROJECT_DIRECTORY}/vendor/bin/php-cs-fixer" PHP_CS_CONFIG=".php-cs-fixer.php" git diff --cached --name-only --diff-filter=ACMR HEAD -- '*.php'| grep -v -e 'tests/Fixtures/' -e 'test-files/' | while read line; do echo " - Fixing: ${line}" # PHP CS Fixer PHP_CS_FIXER_IGNORE_ENV=1 php "${CURRENT_DIRECTORY}/run" ${PHP_CS_FIXER} fix --config=${PHP_CS_CONFIG} --verbose ${line}; git diff "$line"; echo "NOTE: consider adding these changes to the commit with git add --patch $line; git commit --amend" done # shellcheck disable=SC2164 cd "${CURRENT_DIRECTORY}"; echo "[Done] Operation completed!"
Save