From aac44b074b7e3e5ea292c8634fb7a87db5a7da44 Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Thu, 29 Dec 2022 12:50:41 +0900 Subject: [PATCH] build: Added GitHub Actions workflow to run phpcs. --- .github/workflows/phpcs.yml | 54 ++++++++++++++++++++++++ lib/Cake/Network/Email/MailTransport.php | 1 - ruleset.xml | 21 +++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/phpcs.yml create mode 100644 ruleset.xml diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml new file mode 100644 index 000000000..174620946 --- /dev/null +++ b/.github/workflows/phpcs.yml @@ -0,0 +1,54 @@ +name: PHP Coding Standard + +on: + push: + branches: + - 'master' + pull_request: + branches: + - '*' + +permissions: + contents: read + +jobs: + phpcs: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php-version: + - '7.4' + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + ini-values: assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On + tools: composer + + - name: Composer get cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache Composer + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: | + ${{ runner.os }}-php${{ matrix.php-version }}-composer- + + - name: Install Composer Packages + run: composer install --no-ansi --no-interaction --no-progress --ignore-platform-req=php + + - name: Install CodeSniffer Rule + run: vendors/bin/phpcs --config-set installed_paths vendors/cakephp/cakephp-codesniffer + + - name: Check CodeSniffer + run: vendors/bin/phpcs -p --extensions=php --standard=ruleset.xml ./lib/Cake diff --git a/lib/Cake/Network/Email/MailTransport.php b/lib/Cake/Network/Email/MailTransport.php index 3cfb0cc66..a57519a81 100644 --- a/lib/Cake/Network/Email/MailTransport.php +++ b/lib/Cake/Network/Email/MailTransport.php @@ -32,7 +32,6 @@ class MailTransport extends AbstractTransport { * @throws SocketException When mail cannot be sent. */ public function send(CakeEmail $email) { - // https://github.com/cakephp/cakephp/issues/2209 // https://bugs.php.net/bug.php?id=47983 $eol = "\r\n"; diff --git a/ruleset.xml b/ruleset.xml new file mode 100644 index 000000000..353cb3f89 --- /dev/null +++ b/ruleset.xml @@ -0,0 +1,21 @@ + + + + + + + + lib/Cake/Network/Http/HttpSocketResponse.php + + + + + lib/Cake/View/Helper.php + + lib/Cake/Utility/Security.php + + + + lib/Cake/TestSuite/Fixture/CakeFixtureInjector.php + +