From c682b8049a674ffaec9ed55fb310cf4e36dbfb26 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Tue, 13 Aug 2019 15:00:19 +0200 Subject: [PATCH 1/5] Travis/QA: always check that all sniffs are feature complete The new `phpcsstandards/phpcsdevtools` package includes a script which can check whether sniffs are feature complete, i.e. whether all sniffs have unit tests and documentation. By adding this check to the Travis script, we prevent untested and/or undocumented sniffs from entering the repo. P.S.: the `PHPCSDevTools` package contains a few more goodies, have a look at the [readme](https://github.com/PHPCSStandards/PHPCSDevTools) for more information. --- .travis.yml | 3 +++ composer.json | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index e3870a0e..9384c886 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,6 +63,9 @@ matrix: # Check the code-style consistency of the xml files. - diff -B --tabsize=4 ./Yoast/ruleset.xml <(xmllint --format "./Yoast/ruleset.xml") + # Check that the sniffs available are feature complete. + - composer check-complete + #### QUICK TEST STAGE #### # This is a much quicker test which only runs the unit tests and linting against low/high # supported PHP/PHPCS/WPCS combinations. diff --git a/composer.json b/composer.json index 701362c6..5a7cd699 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ "roave/security-advisories": "dev-master", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0", "jakub-onderka/php-parallel-lint": "^1.0", - "jakub-onderka/php-console-highlighter": "^0.4" + "jakub-onderka/php-console-highlighter": "^0.4", + "phpcsstandards/phpcsdevtools": "^1.0" }, "minimum-stability": "dev", "prefer-stable": true, @@ -53,6 +54,9 @@ ], "test": [ "@php ./vendor/phpunit/phpunit/phpunit --filter Yoast --bootstrap=\"./vendor/squizlabs/php_codesniffer/tests/bootstrap.php\" ./vendor/squizlabs/php_codesniffer/tests/AllTests.php" + ], + "check-complete": [ + "@php ./vendor/phpcsstandards/phpcsdevtools/bin/phpcs-check-feature-completeness ./Yoast" ] } } From 140499601f16de0e4301a26099a0cd1cce4d0caf Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 2 Apr 2020 17:22:38 +0200 Subject: [PATCH 2/5] 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9384c886..177c7bf7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,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_BRANCH != "dev-master" && $WPCS != "dev-develop" ]]; then + if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" && $PHPCS_BRANCH != "dev-master" && $WPCS != "dev-develop" ]]; then echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini fi @@ -100,7 +100,7 @@ before_install: # Set the WPCS version to test against. - composer require wp-coding-standards/wpcs:${WPCS} --no-update --no-suggest --no-scripts - | - if [[ "$TRAVIS_BUILD_STAGE_NAME" != "Sniff" ]]; then + if [[ "${TRAVIS_BUILD_STAGE_NAME^}" != "Sniff" ]]; then # For testing the YoastCS native sniffs, the rest of the packages aren't needed. composer remove phpcompatibility/phpcompatibility-wp phpcompatibility/php-compatibility --no-update fi From 85a1f36b27310b6fecb844daf9430d2b9d49ab78 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 2 Apr 2020 17:20:13 +0200 Subject: [PATCH 3/5] Ruleset: change minimum versions to WP 5.3 --- Yoast/ruleset.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Yoast/ruleset.xml b/Yoast/ruleset.xml index 9aaa2554..31654fea 100644 --- a/Yoast/ruleset.xml +++ b/Yoast/ruleset.xml @@ -31,7 +31,7 @@ Ref: https://github.com/WordPress/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#minimum-wp-version-to-check-for-usage-of-deprecated-functions-classes-and-function-parameters --> - + From e61ba47907639e79adfa65badc3b7ed4e9e5412a Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 2 Apr 2020 17:31:04 +0200 Subject: [PATCH 4/5] Changelog for the YoastCS 2.0.2 release Release date set at April 2, 2020. Includes the open PRs. --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9298fd0..24445478 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/). +### [2.0.2] - 2020-04-02 + +#### Changed +* PHPCS: The default value for the `minimum_supported_wp_version` property which is used by various WPCS sniffs has been updated to WP `5.3` (was `5.2`). + + ### [2.0.1] - 2020-02-06 #### Changed @@ -71,7 +77,7 @@ This project adheres to [Semantic Versioning](https://semver.org/) and [Keep a C * :warning: PHPCS: `Yoast.Files.FileName` sniff: the public `$exclude` property, which can be used to indicate which files to exclude from the file name versus object name check, has been renamed to `$excluded_files_strict_check`. Custom repo specific rulesets using the property should be updates to reflect this change. * PHPCS: The default setting for the minimum supported PHP version for repos using YoastCS is now PHP 5.6 (was 5.2). -* PHPCS: The default value for the `minimum_supported_wp_version` property which is used by various WPCS sniffs has been update to WP `5.2` (was `4.9`). +* PHPCS: The default value for the `minimum_supported_wp_version` property which is used by various WPCS sniffs has been updated to WP `5.2` (was `4.9`). * Composer: Supported version of [PHP_CodeSniffer] has been changed from `^3.4.2` to `^3.5.0`. Note: this makes the option `--filter=gitstaged` available which can be used in git `pre-commit` hooks to only check staged files. * Composer: Supported version of [WordPressCS] has been changed from `^2.1.1` to `^2.2.0`. From 26e17a2ef3308e09103c11e48ad2fdc2b68cb314 Mon Sep 17 00:00:00 2001 From: IreneStr Date: Thu, 2 Apr 2020 19:14:53 +0200 Subject: [PATCH 5/5] Add compare link to the 2.0.2 changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24445478..6e50b190 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -375,6 +375,7 @@ Initial public release as a stand-alone package. [DealerDirect Composer PHPCS plugin]: https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases [Parallel-Lint]: https://packagist.org/packages/jakub-onderka/php-parallel-lint +[2.0.2]: https://github.com/Yoast/yoastcs/compare/2.0.1...2.0.2 [2.0.1]: https://github.com/Yoast/yoastcs/compare/2.0.0...2.0.1 [2.0.0]: https://github.com/Yoast/yoastcs/compare/1.3.0...2.0.0 [1.3.0]: https://github.com/Yoast/yoastcs/compare/1.2.2...1.3.0