VIP Go platform specific
This document is for sites running on VIP Go.
When you create a Pull Request (PR) on a VIP client site repository in the VIP GitHub organization (https://github.com/wpcomvip/), you may see a review from our automated VIP Code Analysis bot. The bot’s GitHub username is
wpcomvip-vipgoci-bot, and you can see their GitHub user account.
What does the bot do? #
The bot runs our PHP_CodeSniffer (PHPCS) ruleset with the WordPress-VIP-Go standards, and also the PHP linter.
The PHP linter will highlight code syntax and compilation errors, these are usually fatal and so need to be addressed before the code is deployed.
PHPCS is a tool that will help you write VIP approved code by ensuring it meets VIP coding standards. The rules are designed to identify where code will not work, and to help you follow VIP best practices for writing secure, performant, and future-friendly code. We recommend you install the PHPCS and the ruleset locally by following the documentation here, and this will give you even more immediate feedback as you develop.
The bot works by adding a GitHub PR review (or reviews) detailing the feedback based on our ruleset. A review with no issues will show no interaction from the bot, whereas if the bot finds either PHPCS or PHP linting errors the bot will comment on and review the PR:
What should I do about the bot feedback? #
You should review the feedback from the bot, and decide how to act on it. You have several choices for each item of feedback:
- Address the feedback by amending your code
- Choose to ignore the feedback, and add code comments to instruct the bot to ignore the issue (see below)
- Dismiss the review issue via the GitHub PR interface
Many issues will be correct and should be addressed, but as with all automated feedback there will be some wrongly flagged issues that it is safe to ignore (false positives). There may also be some issues that the bot feedback misses (false negatives). We aim to reduce false positives and false negatives over time, please feel free to open a ticket if you find such and we’ll be happy to discuss.
If you have any concerns about a review added by this bot, please open a ticket and we’ll be happy to help.
Code comments to ignore PHPCS feedback #
You can configure the bot to ignore certain parts of the when running the PHPCS ruleset as described in “Ignoring Parts of a File” from the PHPCS documentation. Here’s an example:
// Ignore a single line: $xmlPackage = new XMLPackage; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase -- reasons // Disable the a check for multiple lines, and then enable all checks at the end: // phpcs:disable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase -- reasons $xmlPackage['error_code'] = get_default_error_code_value(); $xmlPackage->send(); // phpcs:enable
Read the PHPCS documentation for other methods to have the scanner ignore portions of a file or whole files.