⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
shopware
/
custom
/
plugins
/
SwagPayPal
/
bin
/
Edit File: pre-commit.sh
#!/usr/bin/env bash PLATFORM_ROOT="$(git rev-parse --show-toplevel)" PROJECT_ROOT="${PROJECT_ROOT:-"$(cd "$PLATFORM_ROOT"/.. && git rev-parse --show-toplevel)"}" AUTOLOAD_FILE="$PROJECT_ROOT/vendor/autoload.php" function onExit { if [[ $? != 0 ]] then echo "Fix the error before commit." fi } trap onExit EXIT PHP_FILES="$(git diff --cached --name-only --diff-filter=ACMR HEAD | grep -E '\.(php)$')" JS_ADMIN_FILES="$(git diff --cached --name-only --diff-filter=ACMR HEAD | grep -E '^src/Resources/app/administration/.*\.(js)$')" JS_STOREFRONT_FILES="$(git diff --cached --name-only --diff-filter=ACMR HEAD | grep -E '^src/Resources/app/storefront/.*\.(js)$')" # exit on non-zero return code set -e if [[ -z "$PHP_FILES" && -z "$JS_ADMIN_FILES" && -z "$JS_STOREFRONT_FILES" ]] then exit 0 fi if [[ -n "$PHP_FILES" ]] then for FILE in ${PHP_FILES} do php -l -d display_errors=0 "$FILE" 1> /dev/null done make phpstan make psalm fi UNSTAGED_FILES="$(git diff --name-only -- ${PHP_FILES} ${JS_ADMIN_FILES} ${JS_STOREFRONT_FILES})" if [[ -n "$UNSTAGED_FILES" ]] then echo "Error: There are staged files with unstaged changes. We cannot automatically fix and add those. Please add or revert the following files: $UNSTAGED_FILES " exit 1 fi if [[ -n "$PHP_FILES" ]] then # fix code style and update the commit make ecs-fix fi if [[ -n "$JS_ADMIN_FILES" && -x ../../../vendor/shopware/platform/src/Administration/Resources/app/administration/node_modules/.bin/eslint ]] then make administration-fix fi if [[ -n "$JS_STOREFRONT_FILES" && -x ../../../vendor/shopware/platform/src/Storefront/Resources/app/storefront/node_modules/.bin/eslint ]] then make storefront-fix fi git add ${JS_ADMIN_FILES} ${JS_STOREFRONT_FILES} ${PHP_FILES}
Simpan