From 3581d34bb09c1173240b10b0f5ea6d041a9b83cd Mon Sep 17 00:00:00 2001 From: jrf Date: Fri, 15 Jun 2018 15:56:58 +0000 Subject: [PATCH] Build/Tools: Update PHPCS ruleset for WP Core and related Composer setup. `.gitignore` + `svn:ignore`: * Add the typical filenames of overloaded PHPCS configs to `.gitignore`. Composer: * Use the `develop` (Packagist `dev-master`) version of WPCS as it contains lots of bugfixes. * Remove the PHPCS dependency. This is a dependency of WPCS, not of WP Core itself. This will also make sure that the PHPCS version used is always one which is supported by WPCS. * Refreshed the `composer.lock` file. PHPCS ruleset: * Removed a reference to a sniff which doesn't exist in WPCS yet. * Use the PHPCS 3.x `basepath` option to clean up the file paths PHPCS shows in the reports. * Use the PHPCS 3.x `parallel` option to enable parallel scanning whenever possible to speed up the scans. * Whitelist the `wp-includes/l10n.php` file from issues being reported by the `WordPress.WP.I18n` sniff. Fixes #44366. git-svn-id: https://develop.svn.wordpress.org/trunk@43348 602fd350-edb4-49c9-b593-d223f7449a82 --- .gitignore | 2 ++ composer.json | 3 +-- composer.lock | 22 +++++++++++----------- phpcs.xml.dist | 13 ++++++++++++- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index fcccc17759..b1ce13bf19 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ wp-tests-config.php # Files and folders related to build/test tools /phpunit.xml +/.phpcs.xml +/phpcs.xml /tests/phpunit/data/plugins/wordpress-importer /tests/phpunit/data/.trac-ticket-cache* /tests/qunit/compiled.html diff --git a/composer.json b/composer.json index a95151612a..c612cbbfa3 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,7 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", - "squizlabs/php_codesniffer": "^3.2.3", - "wp-coding-standards/wpcs": "dev-feature/new-multi-line-comment-formatting-sniffs" + "wp-coding-standards/wpcs": "dev-master" }, "scripts": { "format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source", diff --git a/composer.lock b/composer.lock index 9176795c8c..2d88e21514 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "4b409623b2bc5d8e87b7f45d57a60990", + "content-hash": "9c2c871b813e89682ef445611d2f5363", "packages": [], "packages-dev": [ { @@ -77,16 +77,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.2.3", + "version": "3.3.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "4842476c434e375f9d3182ff7b89059583aa8b27" + "reference": "d86873af43b4aa9d1f39a3601cc0cfcf02b25266" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4842476c434e375f9d3182ff7b89059583aa8b27", - "reference": "4842476c434e375f9d3182ff7b89059583aa8b27", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d86873af43b4aa9d1f39a3601cc0cfcf02b25266", + "reference": "d86873af43b4aa9d1f39a3601cc0cfcf02b25266", "shasum": "" }, "require": { @@ -124,20 +124,20 @@ "phpcs", "standards" ], - "time": "2018-02-20T21:35:23+00:00" + "time": "2018-06-06T23:58:19+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "dev-feature/new-multi-line-comment-formatting-sniffs", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git", - "reference": "ce4d719296ebbecd01f57bc3729833e89b39ad99" + "reference": "cf6b310caad735816caef7573295f8a534374706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/ce4d719296ebbecd01f57bc3729833e89b39ad99", - "reference": "ce4d719296ebbecd01f57bc3729833e89b39ad99", + "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/cf6b310caad735816caef7573295f8a534374706", + "reference": "cf6b310caad735816caef7573295f8a534374706", "shasum": "" }, "require": { @@ -164,7 +164,7 @@ "standards", "wordpress" ], - "time": "2017-11-30T18:28:51+00:00" + "time": "2018-02-16T01:57:48+00:00" } ], "aliases": [], diff --git a/phpcs.xml.dist b/phpcs.xml.dist index e119e13d08..bd476e3e19 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -4,10 +4,15 @@ - + + + + + + @@ -69,6 +74,12 @@ /tests/phpunit/tests/db\.php + + + /src/wp-includes/l10n\.php + + /wp-config\.php /wp-config-sample\.php