Documentation How to install PHP CodeSniffer for VIP

How to install PHP CodeSniffer for VIP

Did you know that you could get much of the feedback given by the VIP team shown to you in real time, as you code?

PHP CodeSniffer is a tool that will help you write VIP approved code by ensuring it meets VIP coding standard. Many IDEs and text editors (e.g. PHPStorm, Sublime Text, Atom and Vim) have packages which will highlight any code which departs from VIP coding standards, or which has security or performance issues. Running this tool in your development environment or code editor allows you to fix the errors as you code, helping you develop to VIP best practices.

The first step is to install PHP CodeSniffer inside your IDE or text editor.

First start by installing PHP CodeSniffer:

Then proceed with installing the WordPress PHP CodeSniffer rules here:

You can then integrade PHP CodeSniffer inside your favourite IDE, we have examples for a few popular ones:

It’s also possible to run PHP CodeSniffer in your Continuous Integration build process, e.g. via Travis or Circle CI, which allows you to see issues reported against any pull requests and to receive reports of issues via email and other channels. If you’d like us to configure the rules to run on your VIP Go GitHub repository, then please let us know and we’ll be happy to set this up for you.

When submitting your code to VIP for the initial theme we expect code to not trigger any PHP CodeSniffer blockers and as few warnings as possible. We also expect it to pass the VIP coding standard. When working on an existing codebase we expect code to pass the VIP minimum standard but strongly encourage you to follow the VIP standards.

Documentation is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.