Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor CS scripts #9066

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions .github/workflows/test-coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,5 @@ jobs:
- name: Install dependencies
run: composer update --ansi --no-interaction

- name: Run lint on `app/`, `admin/`, `public/`
run: utils/vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.no-header.php --using-cache=no --diff

- name: Run lint on `system/`, `utils/`, and root PHP files
run: utils/vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff

- name: Run lint on `tests`
run: utils/vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.tests.php --using-cache=no --diff

- name: Run lint on `user_guide_src/source/`
run: utils/vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.php-cs-fixer.user-guide.php --using-cache=no --diff
- name: Run lint
run: composer cs
33 changes: 2 additions & 31 deletions admin/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -24,39 +24,10 @@ if [ "$FILES" != "" ]; then
echo "Running PHP CS Fixer..."

# Run on whole codebase to skip on unnecessary filtering
# Run first on app, admin, public
if [ -d /proc/cygdrive ]; then
./utils/vendor/bin/php-cs-fixer fix --verbose --dry-run --diff --config=.php-cs-fixer.no-header.php
else
php ./utils/vendor/bin/php-cs-fixer fix --verbose --dry-run --diff --config=.php-cs-fixer.no-header.php
fi

if [ $? != 0 ]; then
echo "Files in app, admin, or public are not following the coding standards. Please fix them before commit."
exit 1
fi

# Next, run on system, tests, utils, and root PHP files
if [ -d /proc/cygdrive ]; then
./utils/vendor/bin/php-cs-fixer fix --verbose --dry-run --diff
else
php ./utils/vendor/bin/php-cs-fixer fix --verbose --dry-run --diff
fi

if [ $? != 0 ]; then
echo "Files in system, tests, utils, or root are not following the coding standards. Please fix them before commit."
exit 1
fi

# Next, run on user_guide_src/source PHP files
if [ -d /proc/cygdrive ]; then
./utils/vendor/bin/php-cs-fixer fix --verbose --dry-run --diff --config=.php-cs-fixer.user-guide.php
else
php ./utils/vendor/bin/php-cs-fixer fix --verbose --dry-run --diff --config=.php-cs-fixer.user-guide.php
fi
composer cs

if [ $? != 0 ]; then
echo "Files in user_guide_src/source are not following the coding standards. Please fix them before commit."
echo "There are PHP files which are not following the coding standards. Please fix them before commit."
exit 1
fi
fi
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
],
"cs": [
"Composer\\Config::disableProcessTimeout",
"utils/vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run --diff --config=.php-cs-fixer.user-guide.php",
"utils/vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run --diff --config=.php-cs-fixer.no-header.php",
"utils/vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run --diff --config=.php-cs-fixer.tests.php",
"utils/vendor/bin/php-cs-fixer fix --ansi --verbose --dry-run --diff"
"utils/vendor/bin/php-cs-fixer check --ansi --verbose --diff --config=.php-cs-fixer.user-guide.php",
"utils/vendor/bin/php-cs-fixer check --ansi --verbose --diff --config=.php-cs-fixer.no-header.php",
"utils/vendor/bin/php-cs-fixer check --ansi --verbose --diff --config=.php-cs-fixer.tests.php",
"utils/vendor/bin/php-cs-fixer check --ansi --verbose --diff"
],
"cs-fix": [
"Composer\\Config::disableProcessTimeout",
Expand Down
Loading