Installing PHP_CodeSniffer

Authored by

You can install it on your host machine and then install the WordPress Coding Standards. See the instructions here. This will ensure that it will be run as part of the pre-commit hook. In short:

git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs
git clone -b develop https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs
cd phpcs
./scripts/phpcs --config-set installed_paths ../wpcs

And then add this ...phpcs/scripts directory to your PATH environment variable.

You should then see WordPress-VIP listed when you run phpcs -i. You should then select this standard in your IDE for checking your code with PHP_CodeSniffer. See PhpStorm instructions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.