Skip to content

Commit 595da31

Browse files
committed
WPCS 2.0.0: Remove the PHPCSAliases file
After extensive testing based on issues which were previously reported, I've concluded that the `PHPCSAliases.php` file can now be safely removed. Test setup I've used to confirm this: * Clean Composer install of PHPCS + WPCS _without the `installed_paths` config directive being set. ```json { "require": {}, "require-dev": { "squizlabs/php_codesniffer": "^3.3", "wp-coding-standards/wpcs": "^1.1" } } ``` * Basic PHPCS ruleset: ```xml <?xml version="1.0"?> <ruleset name="AliasFileTest"> <file>.</file> <exclude-pattern>vendor/*</exclude-pattern> <arg value="p"/> <config name="installed_paths" value="vendor/wp-coding-standards/wpcs"/> <rule ref="WordPress"/> </ruleset> ``` * A PHP test file which would generate issues. Tests I've run: * Running `vendor/bin/phpcs` on the above (which would be with WPCS 1.2.1) works fine. * Changed the `config` directive value to point to my local WPCS dev install: `<config name="installed_paths" value="I:/path/to/WordPress-Coding-Standards/WordPress-Coding-Standards"/>` * Tested again against the `develop` branch, still was working fine. * Now we get to the interesting part: changed to this branch and ran it again. Still working fine. * Changed the `<rule ref..>` to `<rule ref="WordPress-Core"/>` and still working fine. * Changed the `<rule ref..>` to `<rule ref="WordPress.Security"/>`, i.e. not a registered standard, but a subcategory and still working fine. Based on all this, I'm concluding that the WPCS autoloader in the PHPCSAlias file is no longer needed and can now be safely removed. Refs: * 1087 * squizlabs/PHP_CodeSniffer 1591
1 parent e73a10e commit 595da31

File tree

4 files changed

+0
-52
lines changed

4 files changed

+0
-52
lines changed

WordPress-Core/ruleset.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
<description>Non-controversial generally-agreed upon WordPress Coding Standards</description>
55

6-
<autoload>./../WordPress/PHPCSAliases.php</autoload>
7-
86
<!-- Default tab width for indentation fixes and such. -->
97
<arg name="tab-width" value="4"/>
108

WordPress-Extra/ruleset.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
<description>Best practices beyond core WordPress Coding Standards</description>
55

6-
<autoload>./../WordPress/PHPCSAliases.php</autoload>
7-
86
<rule ref="WordPress-Core"/>
97

108
<!-- Generic PHP best practices.

WordPress/PHPCSAliases.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

WordPress/ruleset.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
<description>WordPress Coding Standards</description>
55

6-
<autoload>./PHPCSAliases.php</autoload>
7-
86
<rule ref="WordPress-Core"/>
97
<rule ref="WordPress-Docs"/>
108
<rule ref="WordPress-Extra"/>

0 commit comments

Comments
 (0)