From 576ea5628bf4d2be94c2b4c47bcd0c14fe765fcd Mon Sep 17 00:00:00 2001 From: MCJ Vasseur <14887731+mvr320@users.noreply.github.com> Date: Sat, 30 Jan 2021 21:43:24 +0100 Subject: [PATCH] Comment on PSR12 warnings in PR This GitHub action will not fail the pipeline but comments on violations, optionally we can fix away most of these or turn off rules in the provided xml. The fork is because of the original project not receiving much comments, optionally we can fork against another repo. --- .github/workflows/phpcodesniffer.yml | 24 ++ .github/workflowscripts/phpruleset.xml | 346 +++++++++++++++++++++++++ 2 files changed, 370 insertions(+) create mode 100644 .github/workflows/phpcodesniffer.yml create mode 100644 .github/workflowscripts/phpruleset.xml diff --git a/.github/workflows/phpcodesniffer.yml b/.github/workflows/phpcodesniffer.yml new file mode 100644 index 0000000000..bbc4d4de51 --- /dev/null +++ b/.github/workflows/phpcodesniffer.yml @@ -0,0 +1,24 @@ +name: PHP CodeSniffer + +# Controls when the action will run. +on: ['pull_request','push','pull_request_target'] +jobs: + phpcs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # important! + - name: Install PHP_CodeSniffer + run: | + curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar + php phpcs.phar --version + + - uses: domjudge/action-php-codesniffer@master + with: + files: "**.php" # you may customize glob as needed + scope: files + phpcs_path: php phpcs.phar + standard: .github/workflowscripts/phpruleset.xml + fail_on_errors: false + fail_on_warnings: false diff --git a/.github/workflowscripts/phpruleset.xml b/.github/workflowscripts/phpruleset.xml new file mode 100644 index 0000000000..1467004353 --- /dev/null +++ b/.github/workflowscripts/phpruleset.xml @@ -0,0 +1,346 @@ + + + The PSR-12 coding standard. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + error + Method name "%s" must not be prefixed with an underscore to indicate visibility + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + + + + + + + + + + + + + + + + + 0 + + + 0 + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +