Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPCS 2.0.0: Remove the PHPCSAliases file #1596

Merged
merged 1 commit into from
Dec 24, 2018

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Dec 24, 2018

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.
    {
        "require": {},
        "require-dev": {
            "squizlabs/php_codesniffer": "^3.3",
            "wp-coding-standards/wpcs": "^1.1"
        }
    }
  • Basic PHPCS ruleset:
    <?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:

This is the last PR in the series to drop PHPCS 2.x support and the work related to issue #1048 can now be considered finished.

Closes #1048

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
@GaryJones GaryJones merged commit ab41be9 into develop Dec 24, 2018
@GaryJones GaryJones deleted the feature/wpcs2.0.0-remove-alias-file branch December 24, 2018 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants