Try to replace stickler with github actions

This commit is contained in:
Laurent Destailleur 2023-06-30 09:39:08 +02:00
parent 8c98fecf64
commit 01d8be4447
2 changed files with 24 additions and 4 deletions

19
.github/workflows/phpcbf.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: GitHub CI PHPCS and PHPCBF
on: push
jobs:
linter_name:
name: Run & fix PHP Code Sniffer
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: shalior/wordpress-phpcs-action@master
with:
github_token: ${{ secrets.github_token }}
use_default_configuration_file: false
phpcs_standard: 'dev/setup/codesniffer/ruleset.xml'
phpcs_args: '-n' # ignore warnings
#- uses: stefanzweifel/git-auto-commit-action@v4 # auto commit the fixes action for GitHub
# with:
# commit_message: Fix PHPCS errors

View File

@ -45,12 +45,11 @@ if [ "$FILES" != "" ]
then
echo "Running PHPCS Code Sniffer..."
#~/vendor/bin/phpcs --version
#phpcs --standard=PSR2 --encoding=utf-8 -n -p $FILES
# Check Dolibarr standard
${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
# Check your own standard
#${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=htdocs/custom/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
# Check a common standard
#${DIRPHPCS}phpcs -s -p -d memory_limit=-1 --parallel=2 --extensions=php --colors --tab-width=4 --standard=PSR2 --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
result2=$?
@ -60,7 +59,9 @@ then
if [ "x$AUTOFIX" != "x0" ]
then
${DIRPHPCS}phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
#${DIRPHPCS}phpcbf -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=htdocs/custom/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true $FILES
echo "Found some errors in syntax rules. An automatic fix has been applied. Check it before commit." 1>&2;
exit 1
else