TSMMark / rubocop-minitest

Code style checking for Minitest files.

Home Page:https://docs.rubocop.org/rubocop-minitest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RuboCop Minitest

Gem Version CircleCI

A RuboCop extension focused on enforcing Minitest best practices and coding conventions. The library is based on the guidelines outlined in the community Minitest Style Guide.

Installation

Just install the rubocop-minitest gem

gem install rubocop-minitest

or if you use bundler put this in your Gemfile

gem 'rubocop-minitest', require: false

Usage

You need to tell RuboCop to load the Minitest extension. There are three ways to do this:

RuboCop configuration file

Put this into your .rubocop.yml.

require: rubocop-minitest

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.

Command line

rubocop --require rubocop-minitest

Rake task

RuboCop::RakeTask.new do |task|
  task.requires << 'rubocop-minitest'
end

The Cops

All cops are located under lib/rubocop/cop/minitest, and contain examples/documentation. The documentation is published here.

In your .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

Documentation

You can read a lot more about RuboCop Minitest in its official docs.

Contributing

Checkout the contribution guidelines.

License

rubocop-minitest is MIT licensed. See the accompanying file for the full text.

About

Code style checking for Minitest files.

https://docs.rubocop.org/rubocop-minitest

License:MIT License


Languages

Language:Ruby 99.9%Language:Shell 0.1%