msonnabaum/chef-drush — pull request #35 by mparker17 (2014-03-26 03:06:17+00:00)
Title: Use Rubocop to check coding style, perform static code analysis.

To make it easier for contributors, it's helpful to have follow a consistent set of coding standards across your project. Drupal has the [Coder module](http://drupal.org/project/coder), and the PHP community has [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for this reason.

A number of the projects at https://github.com/opscode-cookbooks/ are starting to use the awesome-sounding [Rubocop static code analyzer](https://github.com/bbatsov/rubocop/) to enforce coding standards.

Since we're already using Bundler, it's really easy to add Rubocop support... just add the gem and write a `.rubocop.yml` file.

***

For the `rubocop.yml` file, I would suggest using the standards used by the most popular cookbook, which is [mysql](https://github.com/opscode-cookbooks/mysql) (note I originally got this wrong and fixed it in a later commit :blush: ).

***

Once I had successfully installed and run Rubocop, it noted there were a bunch of coding standards violations. Most were to do with unnecessary double-quotes and indentation. The only potentially-weird one complained that an if-statement with only one conditional statement wasn't as compact as it could be... I fixed that one in a separate commit in case we wanted to easily revert it.