From 9a915daa710f54675c23032e8f1a00a3f0851baa Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 28 Mar 2021 23:35:19 +0200 Subject: [PATCH] PHPCS: various improvements * Composer: update the PHPCS version used to PHPCS 3.5.0+. * PHPCS: add a PHPCS configuration file containing all the common command-line parameters. This file will be automatically picked up by PHPCS and can be overruled locally by a `[.]phpcs.xml` file. * Ant: remove the configuration CLI arguments which are now contained in the `phpcs.xml.dist` file from the `build.xml` task configuration. * Ant: add a CLI argument which will ignore CS warnings when determining the exit code, but will still _show_ warnings in the report. Using this will also allow for enabling `failonerror` for the build step. * Git: Add the `phpcs.xml.dist` file to the `.gitattributes` file to be ignored when packaging a release. * Git: Add the potential local overload files to the `.gitignore` file. --- .gitattributes | 1 + .gitignore | 2 ++ build.xml | 6 ++---- composer.json | 2 +- phpcs.xml.dist | 18 ++++++++++++++++++ 5 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 phpcs.xml.dist diff --git a/.gitattributes b/.gitattributes index b640645..6efd058 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,4 @@ .travis.yml export-ignore build.xml export-ignore phpunit.xml.dist export-ignore +phpcs.xml.dist export-ignore diff --git a/.gitignore b/.gitignore index 50f8d9e..a154d47 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ build vendor composer.lock phpunit.xml +.phpcs.xml +phpcs.xml diff --git a/build.xml b/build.xml index 9d95c2e..4f30c31 100644 --- a/build.xml +++ b/build.xml @@ -52,12 +52,10 @@ - - - + - + diff --git a/composer.json b/composer.json index f65682e..83b9785 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "phpunit/phpunit": "^4.8.36 || ^5.0 || ^6.0 || ^7.0", "php-parallel-lint/php-parallel-lint": "^1.0", "php-parallel-lint/php-var-dump-check": "0.*", - "squizlabs/php_codesniffer": "1.*", + "squizlabs/php_codesniffer": "3.*", "php-parallel-lint/php-code-style": "1.0" }, "replace": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..eec5d27 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,18 @@ + + + A coding standard for Jakub Onderka's projects. + + ./src/ + + + + + + + + + + + + +