The VIP Code Analysis bot

VIP Go platform specific

This document is for sites running on VIP Go.

Learn more

Overview #

When you create a Pull Request (PR) on a VIP client site repository in the VIP GitHub organisation (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.

↑ Top ↑

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.

PHP CodeSniffer (aka 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:

↑ Top ↑

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.

↑ Top ↑

Code comments to ignore PHPCS feedback #

You can configure the bot to ignore certain parts of the when running the PHPCS ruleset using the // phpcs:disable and // phpcs:enable comments as described in “Ignoring Parts of a File” from the PHPCS documentation. Here’s an example:

$xmlPackage = new XMLPackage;
// phpcs:disable
$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.

Ready to get started?

Drop us a note.

No matter where you are in the planning process, we’re happy to help, and we’re actual humans here on the other side of the form. 👋 We’re here to discuss your challenges and plans, evaluate your existing resources or a potential partner, or even make some initial recommendations. And, of course, we’re here to help any time you’re in the market for some robust WordPress awesomeness.