Just install the
gem install rubocop-minitest
or if you use bundler put this in your
gem 'rubocop-minitest', require: false
You need to tell RuboCop to load the Minitest extension. There are three ways to do this:
RuboCop configuration file
Put this into your
Alternatively, use the following array notation when specifying multiple extensions.
require: - rubocop-other-extension - rubocop-minitest
Now you can run
rubocop and it will automatically load the RuboCop Minitest
cops together with the standard cops.
rubocop --require rubocop-minitest
RuboCop::RakeTask.new do |task| task.requires << 'rubocop-minitest' end
.rubocop.yml, you may treat the Minitest cops just like any other
cop. For example:
Minitest/AssertNil: Exclude: - test/my_file_to_ignore_test.rb
You can read a lot more about RuboCop Minitest in its official docs.
If you use RuboCop Minitest in your project, you can include one of these badges in your readme to let people know that your code is written following the community Minitest Style Guide.
Here are the Markdown snippets for the two badges:
[![Minitest Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop-minitest) [![Minitest Style Guide](https://img.shields.io/badge/code_style-community-brightgreen.svg)](https://minitest.rubystyle.guide)
Checkout the contribution guidelines.
rubocop-minitest is MIT licensed. See the accompanying file for
the full text.