This is one of the Vox Pupuli meta gems. It provides a convenient way to
configure RuboCop. RuboCop is the de facto standard Ruby
Linter and Formatter. voxpupuli-rubocop
depends on the correct RuboCop version
- dependencies that we want to use in our CI pipelines. There is also a rubocop.yml that configures RuboCop. and preconfigured rake tasks.
The goal of this gem is to provide a central configuration for RuboCop that's used in all Vox Pupuli gems.
In your Gemfile, add the following:
gem 'voxpupuli-rubocop', '~> 1.1'
In your Rakefile, include our Rake task:
require 'voxpupuli/rubocop/rake'
Now you can list your rake tasks and should see three new ones:
bundle exec rake -T
rake rubocop # Run RuboCop
rake rubocop:autocorrect # Autocorrect RuboCop offenses (only when it's safe)
rake rubocop:autocorrect_all # Autocorrect RuboCop offenses (safe and unsafe)
To use our default config, create a .rubocop.yml
:
---
inherit_gem:
voxpupuli-rubocop: rubocop.yml
You maybe see a bunch of violations with the new configuration. A common path forward is to accept them but prevent future/more violations. You can generate a "RuboCop ToDo file", which is basically an allow-list of all current violations:
bundle exec rubocop --regenerate-todo