A RuboCop extension focused on enforcing RSpec. A place where no one is officially employed, but where useful cops can gather.
Just install the rubocop-rspec-extra gem
gem install rubocop-rspec-extraor if you use bundler put this in your Gemfile
gem 'rubocop-rspec-extra', require: falseYou need to tell RuboCop to load the RSpec Extra extension. There are two ways to do this:
Put this into your .rubocop.yml.
plugins: rubocop-rspec-extraAlternatively, use the following array notation when specifying multiple extensions.
plugins:
- rubocop-rspec
- rubocop-rspec-extraNow you can run rubocop and it will automatically load the RuboCop RSpec Extra
cops together with the standard cops.
Note
The plugin system is supported in RuboCop 1.72+. In earlier versions, use require instead of plugins.
rubocop --plugins rubocop-rspec-extraRuboCop::RakeTask.new do |task|
task.plugins << 'rubocop-rspec-extra'
endAll cops are located under
lib/rubocop/cop/rspec/extra, and contain
examples/documentation.
In your .rubocop.yml, you may treat the RSpec extra cops just like any other
cop. For example:
RSpec/Extra/RestrictBlockTag:
Exclude:
- spec/my_poorly_named_spec_file.rbCheckout the contribution guidelines.
rubocop-rspec-extra is MIT licensed. See the accompanying file for
the full text.