From 535e4b47833552cb5c97c330583e971d1ff30bfd Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 10 Mar 2020 01:37:24 +0100 Subject: [PATCH 01/10] CI: switch to fork of Parallel-lint package ... as the original appears not to be maintained anymore and is not compatible with PHP 7.4. --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 39380f6..099ed55 100644 --- a/composer.json +++ b/composer.json @@ -27,8 +27,8 @@ "require-dev" : { "roave/security-advisories" : "dev-master", "phpunit/phpunit" : "^4.5 || ^5.0 || ^6.0 || ^7.0", - "jakub-onderka/php-parallel-lint": "^1.0", - "jakub-onderka/php-console-highlighter": "^0.4", + "php-parallel-lint/php-parallel-lint": "^1.0", + "php-parallel-lint/php-console-highlighter": "^0.4", "phpcsstandards/phpcsdevcs": "^1.0.0" }, "bin": [ @@ -36,7 +36,7 @@ ], "scripts" : { "lint": [ - "@php ./vendor/jakub-onderka/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude .git" + "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude .git" ], "check-cs": [ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs" From dc18ed40a0ecd1ba1f679942c8f4c9684c7139da Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 31 Mar 2020 19:42:46 +0200 Subject: [PATCH 02/10] Travis: fix the build The Travis docs say that `$TRAVIS_BUILD_STAGE_NAME` is in "proper case" form: > TRAVIS_BUILD_STAGE_NAME: The build stage in capitalized form, e.g. Test or Deploy. If a build does not use build stages, this variable is empty (""). However, it looks like they made an (undocumented) change (probably a bug in their script handling) which means that the `$TRAVIS_BUILD_STAGE_NAME` name is now in the case as given, which in this case is _lowercase_. This means that some of the comparisons are failing and the wrong things are executed for certain builds. As I expect this to be a bug in Travis, I'm not changing the case for the comparisons at this time. Instead I'm fixing this by inline fixing the case of the variable for the comparisons. Refs: * https://docs.travis-ci.com/user/environment-variables#default-environment-variables (near the bottom of the list) --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index affe683..0095871 100644 --- a/.travis.yml +++ b/.travis.yml @@ -108,7 +108,7 @@ before_install: # On stable PHPCS versions, allow for PHP deprecation notices. # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore. - | - if [[ "$TRAVIS_BUILD_STAGE_NAME" != "Sniff" && "$PHPCS_VERSION" != "dev-master" && "$PHPCS_VERSION" != "n/a" ]]; then + if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" && "$PHPCS_VERSION" != "dev-master" && "$PHPCS_VERSION" != "n/a" ]]; then echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini fi @@ -116,7 +116,7 @@ before_install: # Set up test environment using Composer. - | - if [[ "$TRAVIS_BUILD_STAGE_NAME" != "Sniff" ]]; then + if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" ]]; then # Remove the PHPCSDevCS dependency as it has different PHPCS requirements and would block installs. composer remove --dev phpcsstandards/phpcsdevcs --no-update --no-scripts fi @@ -125,7 +125,7 @@ before_install: composer require --no-update --no-scripts squizlabs/php_codesniffer:${PHPCS_VERSION} fi - | - if [[ "$TRAVIS_BUILD_STAGE_NAME" == "Sniff" || $PHPCS_VERSION == "n/a" ]]; then + if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Sniff" || $PHPCS_VERSION == "n/a" ]]; then # The sniff stage doesn't run the unit tests, so no need for PHPUnit. composer remove --dev phpunit/phpunit --no-update --no-scripts elif [[ "$PHPCS_VERSION" < "3.1.0" ]]; then From d5dcee2546241620518fb1d7045be4672b883c64 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 5 May 2020 23:50:43 +0200 Subject: [PATCH 03/10] Composer: set minimum Composer PHPCS plugin dependency version to `0.4.1` Support for the `installed_paths` being set when the plugin is a requirement of a standard itself, was only added in version `0.4.0` and a pertinent bug in this feature was fixed in `0.4.1`, which effectively makes version `0.4.1` the minimum workable version for both use as a stand-alone standard, as well as when this standard is required as a dependency. Refs: * https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases/tag/v0.4.0 * https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases/tag/v0.4.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 099ed55..885606c 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "require" : { "php" : ">=5.4", "squizlabs/php_codesniffer" : "^3.0.2", - "dealerdirect/phpcodesniffer-composer-installer" : "^0.3 || ^0.4.1 || ^0.5 || ^0.6.2" + "dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2" }, "require-dev" : { "roave/security-advisories" : "dev-master", From aec7fb283c62106a837b9587f8215f4aeeb9d378 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 13 Feb 2020 01:06:54 +0100 Subject: [PATCH 04/10] QA: minor code tweak Remove some duplication. --- phpunit-bootstrap.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpunit-bootstrap.php b/phpunit-bootstrap.php index b15395e..9689d19 100644 --- a/phpunit-bootstrap.php +++ b/phpunit-bootstrap.php @@ -79,5 +79,4 @@ \putenv("PHPCS_IGNORE_TESTS={$standardsToIgnoreString}"); // Clean up. -unset($ds, $phpcsDir, $composerPHPCSPath); unset($ds, $phpcsDir, $composerPHPCSPath, $allStandards, $standardsToIgnore, $standard, $standardsToIgnoreString); From a4908d1f29b649daff652e5bc0997bff52ad483f Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 28 Jun 2020 00:28:22 +0200 Subject: [PATCH 05/10] Composer: update PHPCS Composer plugin dependency The DealerDirect Composer plugin has just released version `0.7.0`. As Composer treats minors < 1.0 as majors, updating to this version requires an update to the `composer.json` requirements. > For pre-1.0 versions it also acts with safety in mind and treats `^0.3` as `>=0.3.0 <0.4.0`. Refs: * https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases/tag/v0.7.0 * https://getcomposer.org/doc/articles/versions.md#caret-version-range- --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 885606c..666934d 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "require" : { "php" : ">=5.4", "squizlabs/php_codesniffer" : "^3.0.2", - "dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2" + "dealerdirect/phpcodesniffer-composer-installer" : "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7" }, "require-dev" : { "roave/security-advisories" : "dev-master", From e7dbcd290764b3f1a0d469c515c68cf7440a1f86 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 28 Jun 2020 15:15:38 +0200 Subject: [PATCH 06/10] Composer: update some dependencies --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 666934d..e8abe93 100644 --- a/composer.json +++ b/composer.json @@ -28,8 +28,8 @@ "roave/security-advisories" : "dev-master", "phpunit/phpunit" : "^4.5 || ^5.0 || ^6.0 || ^7.0", "php-parallel-lint/php-parallel-lint": "^1.0", - "php-parallel-lint/php-console-highlighter": "^0.4", - "phpcsstandards/phpcsdevcs": "^1.0.0" + "php-parallel-lint/php-console-highlighter": "^0.5", + "phpcsstandards/phpcsdevcs": "^1.0" }, "bin": [ "bin/phpcs-check-feature-completeness" From 8e71e5d77f6af9cc04fbd5be4908a2137705f47b Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 28 Jun 2020 14:29:11 +0200 Subject: [PATCH 07/10] Travis: add testing against PHPCS 4.x and other tweaks * Run the sniff build against PHP 7.4. * Add a new build on PHP 7.4 to test against PHPCS 4.x. * Enable running the unit tests on PHP nightly (8.0). * Tweak the installation conditions to allow the builds to run & potentially pass. --- .travis.yml | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0095871..dda8624 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ cache: # Cache directory for more recent Composer versions. - $HOME/.cache/composer/files +# Note: PHP 7.3, 7.4 and nightly are added via "jobs". php: - 5.4 - 5.5 @@ -42,7 +43,7 @@ jobs: include: #### SNIFF STAGE #### - stage: sniff - php: 7.3 + php: 7.4 env: PHPCS_VERSION="dev-master" addons: apt: @@ -67,7 +68,7 @@ jobs: # This is a much quicker test which only runs the unit tests and linting against the low/high # supported PHP/PHPCS combinations. - stage: quicktest - php: 7.3 + php: 7.4 env: PHPCS_VERSION="dev-master" LINT=1 - stage: quicktest php: 7.2 @@ -93,12 +94,18 @@ jobs: # PHPCS is only compatible with PHP 7.4 as of version 3.5.0. - php: 7.4 env: PHPCS_VERSION="3.5.0" + + # Builds against unstable versions which are allowed to fail for now. + - stage: test + php: 7.4 + env: PHPCS_VERSION="4.0.x-dev" - php: "nightly" - env: PHPCS_VERSION="n/a" LINT=1 + env: PHPCS_VERSION="dev-master" LINT=1 allow_failures: # Allow failures for unstable builds. - php: "nightly" + - env: PHPCS_VERSION="4.0.x-dev" before_install: @@ -108,7 +115,7 @@ before_install: # On stable PHPCS versions, allow for PHP deprecation notices. # Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore. - | - if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" && "$PHPCS_VERSION" != "dev-master" && "$PHPCS_VERSION" != "n/a" ]]; then + if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" && "$PHPCS_VERSION" != "dev-master" && "$PHPCS_VERSION" != "4.0.x-dev" ]]; then echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini fi @@ -125,7 +132,7 @@ before_install: composer require --no-update --no-scripts squizlabs/php_codesniffer:${PHPCS_VERSION} fi - | - if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Sniff" || $PHPCS_VERSION == "n/a" ]]; then + if [[ "${TRAVIS_BUILD_STAGE_NAME^}" == "Sniff" ]]; then # The sniff stage doesn't run the unit tests, so no need for PHPUnit. composer remove --dev phpunit/phpunit --no-update --no-scripts elif [[ "$PHPCS_VERSION" < "3.1.0" ]]; then @@ -138,7 +145,16 @@ before_install: # --prefer-dist will allow for optimal use of the travis caching ability. # The Composer PHPCS plugin takes care of setting the installed_paths for PHPCS. - - composer install --prefer-dist --no-suggest + - | + if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then + # Not all dependencies allow for installing on nightly yet, so ignore platform requirements. + composer install --prefer-dist --no-suggest --ignore-platform-reqs + elif [[ "$PHPCS_VERSION" == "4.0.x-dev" ]]; then + # PHPCS 4.x does not ship by default with the base test case, so source is needed. + composer install --prefer-source --no-suggest + else + composer install --prefer-dist --no-suggest + fi script: From b3e1d6f024a5c01b064547fe8f5b4b39c8452671 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 28 Jun 2020 16:28:01 +0200 Subject: [PATCH 08/10] Misc updates for the `master` branch being renamed to `stable` * Update the branch conditions for the Travis script. * Update the badges in the Readme. --- .travis.yml | 6 +++--- README.md | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index dda8624..f8be8d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ php: - 7.2 env: - # `master` + # PHPCS `master` - PHPCS_VERSION="dev-master" LINT=1 # Lowest supported PHPCS version. - PHPCS_VERSION="3.0.2" @@ -34,9 +34,9 @@ env: stages: - name: sniff - name: quicktest - if: type = push AND branch NOT IN (master, develop) + if: type = push AND branch NOT IN (stable, develop) - name: test - if: branch IN (master, develop) + if: branch IN (stable, develop) jobs: fast_finish: true diff --git a/README.md b/README.md index c74d118..1c74ecb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ PHPCSDevTools for developers of PHP_CodeSniffer sniffs ===================================================== [![Latest Stable Version](https://poser.pugx.org/phpcsstandards/phpcsdevtools/v/stable)](https://packagist.org/packages/phpcsstandards/phpcsdevtools) -[![Travis Build Status](https://travis-ci.com/PHPCSStandards/PHPCSDevTools.svg?branch=master)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools/branches) +[![Travis Build Status](https://travis-ci.com/PHPCSStandards/PHPCSDevTools.svg?branch=stable)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools/branches) [![Release Date of the Latest Version](https://img.shields.io/github/release-date/PHPCSStandards/PHPCSDevTools.svg?maxAge=1800)](https://github.com/PHPCSStandards/PHPCSDevTools/releases) :construction: [![Latest Unstable Version](https://img.shields.io/badge/unstable-dev--develop-e68718.svg?maxAge=2419200)](https://packagist.org/packages/phpcsstandards/phpcsdevtools#dev-develop) @@ -12,7 +12,7 @@ PHPCSDevTools for developers of PHP_CodeSniffer sniffs [![Minimum PHP Version](https://img.shields.io/packagist/php-v/phpcsstandards/phpcsdevtools.svg?maxAge=3600)](https://packagist.org/packages/phpcsstandards/phpcsdevtools) [![Tested on PHP 5.4 to nightly](https://img.shields.io/badge/tested%20on-PHP%205.4%20|%205.5%20|%205.6%20|%207.0%20|%207.1%20|%207.2%20|%207.3%20|%207.4%20|%20nightly-brightgreen.svg?maxAge=2419200)](https://travis-ci.com/PHPCSStandards/PHPCSDevTools) -[![License: LGPLv3](https://poser.pugx.org/phpcsstandards/phpcsdevtools/license)](https://github.com/PHPCSStandards/PHPCSDevTools/blob/master/LICENSE) +[![License: LGPLv3](https://poser.pugx.org/phpcsstandards/phpcsdevtools/license)](https://github.com/PHPCSStandards/PHPCSDevTools/blob/stable/LICENSE) ![Awesome](https://img.shields.io/badge/awesome%3F-yes!-brightgreen.svg) From d00dca5debfa42328538d1807f2e6d89299eb0d8 Mon Sep 17 00:00:00 2001 From: Juliette <663378+jrfnl@users.noreply.github.com> Date: Sun, 28 Jun 2020 17:12:29 +0200 Subject: [PATCH 09/10] Readme/Changelog: update for release of v 1.0.1 --- CHANGELOG.md | 12 +++++++++++- README.md | 12 ++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2063917..707b6a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,14 @@ This projects adheres to [Keep a CHANGELOG](http://keepachangelog.com/) and uses _Nothing yet._ +## [1.0.1] - 2020-06-28 + +### Changed +* The `master` branch has been renamed to `stable`. +* The version requirements for the [Dealerdirect Composer PHPCS plugin] have been widened to allow installation of releases from the `0.7.x` range, which brings compatibility with Composer 2.0. +* Miscellaneous updates to the development environment and CI scripts. + + ## 1.0.0 - 2020-02-12 Initial release containing: @@ -17,5 +25,7 @@ Initial release containing: * A `PHPCSDebug` standard to help debugging sniffs. -[Unreleased]: https://github.com/PHPCSStandards/PHPCSDevTools/compare/1.0.0...HEAD +[Unreleased]: https://github.com/PHPCSStandards/PHPCSDevTools/compare/master...HEAD +[1.0.1]: https://github.com/PHPCSStandards/PHPCSDevTools/compare/1.0.0...1.0.1 +[Dealerdirect Composer PHPCS plugin]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/ diff --git a/README.md b/README.md index 1c74ecb..fcd1831 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ composer require --dev phpcsstandards/phpcsdevtools:^1.0 If you work on several different sniff repos, you may want to install this toolset globally: ```bash -composer global require phpcsstandards/phpcsdevtools:^1.0 +composer global require --dev phpcsstandards/phpcsdevtools:^1.0 ``` Composer will automatically install dependencies and register the PHPCSDebug standard with PHP_CodeSniffer using the [DealerDirect Composer PHPCS plugin](https://github.com/Dealerdirect/phpcodesniffer-composer-installer/). @@ -59,7 +59,7 @@ Composer will automatically install dependencies and register the PHPCSDebug sta ```bash phpcs --config-set installed_paths /path/to/PHPCSDevTools ``` - **Warning**: :warning: The `installed_paths` command overwrites any previously set `installed_paths`. If you have previously set `installed_paths` for other external standards, run `phpcs --config-show` first and then run the `installed_paths` command with all the paths you need separated by comma's, i.e.: + :warning: **Warning**: The `installed_paths` command overwrites any previously set `installed_paths`. If you have previously set `installed_paths` for other external standards, run `phpcs --config-show` first and then run the `installed_paths` command with all the paths you need separated by comma's, i.e.: ```bash phpcs --config-set installed_paths /path/1,/path/2,/path/3 ``` @@ -70,9 +70,9 @@ Features ### Checking whether all sniffs in a PHPCS standard are feature complete -You can now easily check whether each and every sniff in your standard is accompanied by a documentation XML file (warning) as well as unit test files (error). +You can now check whether each and every sniff in your standard is accompanied by a documentation XML file (warning) as well as unit test files (error). -To use the tool, run it from the root of the your standards repo like so: +To use the tool, run it from the root of your standards repo like so: ```bash # When installed as a project dependency: vendor/bin/phpcs-check-feature-completeness @@ -122,7 +122,7 @@ Once this project is installed, you will see a new `PHPCSDebug` ruleset in the l For now, this standard only contains one sniff: `PHPCSDebug.Debug.TokenList`. This sniff will display compact, but detailed information about the tokens found in a (test case) file. -This sniff is compatible with PHPCS 3.0+. +This sniff is compatible with PHPCS 3.0.2+. Typical usage: * Set up a test case file for a new sniff you intend to write. @@ -172,7 +172,7 @@ PHPCS itself can also display similar information using the `-vv` or `-vvv` verb Contributing ------- -Contributions to this project are welcome. Just clone the repo, branch off from `develop`, make your changes, commit them and send in a pull request. +Contributions to this project are welcome. Clone this repository, branch off from `develop`, make your changes, commit them and send in a pull request. If unsure whether the changes you are proposing would be welcome, open an issue first to discuss your proposal. From 132d5bcda26ce0b87ccccc6222d06c1fc9f1283e Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 28 Jun 2020 17:44:26 +0200 Subject: [PATCH 10/10] Update the version nr for the release --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index afaf360..7f20734 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0 \ No newline at end of file +1.0.1 \ No newline at end of file