10up / 10up-code-review

Custom PHP_CodeSniffer rules to help flag common issues during code review
43 stars 5 forks source link

Automatically register PHP_CodeSniffer standards' paths #4

Closed stevegrunwell closed 8 years ago

stevegrunwell commented 8 years ago

As mentioned in #3, it would be nice if the various standards' paths were registered automatically upon installation. In order to do this cleanly, we'll need to do the following (preferably via a PHP-CLI script in this package's bin directory):

  1. Read the existing PHP_CodeSniffer configuration (if it exists – PHP_CodeSniffer keeps this as an array in CodeSniffer.conf in the local copy of that package)
  2. Ensure the paths we're registering aren't already there, then append them (probably explode on a comma, add the new paths, then run array_unique())
  3. Save the updated config file.

Once we have a script to do that automatically we can call it on Composer's post-install-cmd and post-update-cmd actions.

stevegrunwell commented 8 years ago

This is almost there, but the logic needs improvement in order to handle being installed on a global level (right now it's working on a branch level in the feature/installation-script branch).

stevegrunwell commented 8 years ago

With the release of v0.2.0 I think we've made this about as straight-forward as we can while being installed as a dependency, so I'm going to go ahead and close out this issue.