Rubocop::Bitcrowd
The bitcrowd rubocop.yml as a gem.
Installation
Add this lines to your application's Gemfile:
gem 'rubocop'
gem 'rubocop-bitcrowd'
And then execute:
$ bundle
Usage
To use the configuration in your project create a .rubocop.yml with:
inherit_gem:
rubocop-bitcrowd: .rubocop.yml
Using rubocop-rspec
There is also a config file for rubocop-rspec. To use it add rubocop-rspec to your Gemfile.
gem 'rubocop-rspec'
inherit_gem:
rubocop-bitcrowd:
- .rubocop.yml
- .rubocop-rspec.yml
Autofixing issues
At bitcrowd we discovered it to be a very good practice to put each automatically fixable Cop into a single commit when initially adding rubocop into a bigger project.
This gem provides a simple script, that can help you with this task:
- Create your rubocop configuration (either with the instructions above or your own)
- Create a rubocop_todo.yml with:
rubocop --auto-gen-config - Make sure you have a clean state in git, since the script will make commits for you (you may want to commit your rubocop_todo.yml)
- Run the script (may take a while, when you want to continue working on your project meanwhile run this in a separate checkout):
rubocop-autofix - Review all commits made by the script and run your tests. You can now drop certain commits of cops you don't want. Often it may make some sense to run the script again with changed settings, since rebasing 100+ commits is no fun.
License
The gem is available as open source under the terms of the MIT License.