For those who have read my Atom and WordPress Coding Standards post, then you should have everything you need when it comes to setting up the editor to evaluate your code with the WordPress Coding Standards.
Recently, though, the 0.10.0 release of the coding standards were published on GitHub, and it brings a lot of changes.
If you’re looking to begin upgrading to this new change, there’re a few caveats that you may experience when working with Atom and the WordPress Coding Standards.
They’re easy to address, though.
Atom and the WordPress Coding Standards
There are two packages you need to make sure that you have installed. If you have one, then you likely have the other but, for one reason or another, you may have disabled one.
- Linter-PHPCS. This linter plugin for Linter provides an interface to phpcs. It will be used with files that have the “PHP” and “HTML” syntax.
- Linter. This provides a top-level API to its consumer that allows them to visualize errors and other kind-of messages, easily.
Note that if you have Linter-PHPCS installed, you’ll need to make sure you have Linter installed, as well (and that it’s enabled, of course). This is found in the fine print on the Linter-PHPCS configuration screen:
Note: If you do not already have the
linter
package installed it will be installed for you to provide an interface for this package.
Once done, you can update the coding standards package using Composer – yes, this is an older post but the steps for installing it globally on your machine still stand.
After that, you can follow the instructors in the project’s README, or you can issue a command like this:
$ composer create-project wp-coding-standards/wpcs:0.10.0 --no-dev
And you should be good to go with the latest version of the coding standards. Next, you’ll need to make sure you have the proper paths set up in Atom.
These really shouldn’t change from version to version, but the values should be as follows (obviously mine are relevant to my system):
- Executable Path: /Users/tommcfarlin/Dropbox/Projects/wpcs/vendor/bin/phpcs
- Config File: WordPress-VIP
- Check “Search for configuration files.”
The last step is optional, but it’s something that I like to have just in case.
Leave a Reply
You must be logged in to post a comment.