Permalink
Browse files

Install `phpcs` using Composer (#1022)

  • Loading branch information...
1 parent ccbb343 commit 7c9cfe4e2c25865c43326a72a31030c9e55671e1 @nylen nylen committed Jun 6, 2017
Showing with 152 additions and 30 deletions.
  1. +1 −1 .editorconfig
  2. +2 −3 .travis.yml
  3. +11 −0 composer.json
  4. +132 −0 composer.lock
  5. +4 −25 docs/coding-guidelines.md
  6. +2 −1 vendor/.gitignore
View
@@ -8,7 +8,7 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
-[{package.json,.travis.yml}]
+[{*.json,*.yml}]
indent_style = space
indent_size = 2
View
@@ -44,8 +44,7 @@ before_script:
fi
- |
if [[ "$TRAVISCI" == "phpcs" ]] ; then
- composer global require wp-coding-standards/wpcs
- phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
+ composer install
fi
script:
@@ -58,7 +57,7 @@ script:
fi
- |
if [[ "$TRAVISCI" == "phpcs" ]] ; then
- phpcs
+ ./vendor/bin/phpcs
fi
- |
if [[ "$TRAVISCI" == "js" ]] ; then
View
@@ -0,0 +1,11 @@
+{
+ "require-dev": {
+ "squizlabs/php_codesniffer": "2.9.x",
+ "wp-coding-standards/wpcs": "^0.11.0"
+ },
+ "scripts": {
+ "post-install-cmd": [
+ "phpcs --config-set installed_paths ../../wp-coding-standards/wpcs/"
+ ]
+ }
+}
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -92,28 +92,7 @@ When making any changes to the PHP code in this project, it's recommended to
install and run `phpcs` on your computer. This is a step in our Travis CI
build as well, but it is better to catch errors locally.
-You will need to install `phpcs` version 2.9.x, because the 3.x versions are
-not yet compatible with the WordPress coding standards. For more information see
-[this issue](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/718).
-
-The easiest way to get `phpcs` is to download the .phar archive from the latest
-2.9.x release on GitHub:
-[PHP\_CodeSniffer releases](https://github.com/squizlabs/PHP_CodeSniffer/releases).
-
-For example:
-
-```sh
-wget \
- https://github.com/squizlabs/PHP_CodeSniffer/releases/download/2.9.1/phpcs.phar \
- -O ~/bin/phpcs
-chmod +x ~/bin/phpcs
-```
-
-(If `~/bin` is not in your `$PATH`, pick another directory that is.)
-
-Then you must install the `WordPress-Coding-Standards` repository and tell
-`phpcs` where it lives. See instructions here:
-
-https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards#standalone
-
-You should now be able to run `phpcs` from the root directory of this project.
+The easiest way to do this is using `composer`.
+[Install `composer`](https://getcomposer.org/download/)
+on your computer, then run `composer install`. This will install `phpcs` and
+`WordPress-Coding-Standards` which you can the run via `vendor/bin/phpcs`.
View
@@ -1 +1,2 @@
-*.js
+*
+!.gitignore

0 comments on commit 7c9cfe4

Please sign in to comment.