stevegrunwell / wp-enforcer

Git hooks to encourage well-written WordPress.
https://stevegrunwell.com/blog/wp-enforcer/
MIT License
112 stars 15 forks source link

Script overwrites installed coding standards #42

Open morganestes opened 7 years ago

morganestes commented 7 years ago

Problem

In version 0.5.0, when I run wp-enforcer it removes the standards already set for a project.

Description

I have multiple coding standards installed in my project (WP Coding Standards and PHPCompatibility) and a script to set them for use with the project's PHPCS. When I runwp-enforcer, it only checks for wp-coding-standards/wpcs and removes the other standard on every run, which causes checks to fail because PHPCS can't find the expected sniffs.

Possible Resolution

It would be nice for WP Enforcer to honor the existing config and not remove the standards set, either by not forcing the standards inside the script or by appending wpcs to the installed_paths only if it's not present already.

stevegrunwell commented 7 years ago

Morgan, thanks for bringing this to my attention!

stevegrunwell commented 6 years ago

Heh, just ran into this myself; I'm going to refactor to use dealerdirect/phpcodesniffer-composer-installer, which will simplify the code in WP Enforcer and reduce conflicts.