Add WordPress Coding Standards to NetBeans

wp-netbeans

The open source NetBeans IDE has support for several different languages and frameworks and a worldwide community of developers who depend on it to code more efficiently. A recent survey conducted by SitePoint placed NetBeans as the third most favored IDE among PHP developers, capturing 15.6% of the votes, trailing not far behind Sublime Text at 18.5%. PhpStorm locked up nearly 40% of those surveyed and recently added official support for WordPress.

WordPress developers who favor NetBeans as their IDE of choice can install a set of preferences that will help make their development environments a little more WordPress-friendly. Inspired by the NetBeans Settings for Laravel 4, PHP developer Leon Rowland decided to create NetBeans WordPress Coding Standards. It adds all the necessary settings for having your projects follow WordPress Coding Standards.

netbeans-wordpress-coding-standards

Rowland created the settings separately, because NetBeans doesn’t yet support a proper export of sub categories (PHP, JavaScript, etc). To use it, simply download the zip file from GitHub and import it at Netbeans > Preferences. Your NetBeans setup will now correctly get the PHP, JavaScript, and CSS Coding Standards as defined in the WordPress Handbook.

Rowland notes one small exception in the formatting – it doesn’t correctly account for spaces before JavaScript variables inside callbacks but not functions. Overall, the settings pack puts WordPress developers in a good place for using NetBeans while following the project’s official coding standards. It’s inspiring to see more WordPress tools and support availalbe for the most popular PHP IDEs. Any NetBeans fans have more WordPress-related tools to share?

6

6 responses to “Add WordPress Coding Standards to NetBeans”

  1. This is cool, but there are a couple of tests that it fails on:

    * Array keys should NOT be surrounded by spaces if they only contain a string or an integer.
    * Expected 1 space after “!”; 0 found

    It seems like this is a limitation of NetBeans. You can tick the “Unary operator” option under Formatting > Spaces > Around Operators to add the space after ! but this causes `$i++` to become `$i ++` which passes WordPress-Extra standards, but is damn ugly.

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.