-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CI with WP-Core code sniffs. #37
Comments
Thanks for that @peterwilsoncc. I've done a bit of research into Travis but I'm not sure where to start. Is there some sort of tutorial or resource you could point me to? There's a few things I'm uncertain on, like for instance if |
There's some documentation to run the sniffs on Travis CI in the project. To use Doing some tests, I found the custom ruleset that follows to get best results. It needs to be saved as phpcs.xml in your root directory. To code sniff run: To fix: On travis CI, replace the suggested line with the custom ruleset. Feel free to reach out to me or @BronsonQuick on the wpaus slack if you have any questions. <?xml version="1.0"?>
<ruleset name="Example Project">
<description>A custom set of rules to check for a WPized WordPress project</description>
<!-- Exclude the Composer Vendor directory. -->
<exclude-pattern>/wpcs/*</exclude-pattern>
<!-- Exclude the Node Modules directory. -->
<exclude-pattern>/node_modules/*</exclude-pattern>
<!-- Exclude minified Javascript files. -->
<exclude-pattern>*.min.js</exclude-pattern>
<!-- Include the WordPress-Extra standard. -->
<rule ref="WordPress-Core">
</rule>
<!-- Check for PHP cross-version compatibility. -->
<!--
To enable this, the PHPCompatibility standard needs
to be installed.
See the readme for installation instructions:
https://github.com/wimg/PHPCompatibility
-->
<!--
<config name="testVersion" value="5.2-99.0"/>
<rule ref="PHPCompatibility"/>
-->
<!--
To get the optimal benefits of using WPCS, we should add a couple of
custom properties.
Adjust the values of these properties to fit our needs.
For information on additional custom properties available, check out
the wiki:
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
-->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array" value="facebook-page-feed-graph-api,library-facebook-page-feed-graph-api"/>
</properties>
</rule>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array" value="cameronjonesweb_facebook_page_plugin,facebook_page_plugin,CJW_FBPP_PLUGIN"/>
</properties>
</rule>
</ruleset> |
Add either Travis CI or Circle CI with code sniffs against the WP-Core coding standards.
Running
phpcs
the WP coding standards produces a number of errors, most of which can be fixed automatically withphpcbf
.I've got both Travis and Cirlce set up in my theme repo with a phpcs config file. You'll need to swap out the HM styles in my config with the WP-Core standards.
The text was updated successfully, but these errors were encountered: