rubocop-minitest 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +43 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +39 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +18 -0
- data/.gitignore +61 -0
- data/.rubocop.yml +85 -0
- data/.rubocop_todo.yml +23 -0
- data/CHANGELOG.md +30 -0
- data/CONTRIBUTING.md +68 -0
- data/Gemfile +12 -0
- data/LICENSE.txt +21 -0
- data/README.md +82 -0
- data/Rakefile +38 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/config/default.yml +33 -0
- data/lib/rubocop-minitest.rb +14 -0
- data/lib/rubocop/cop/minitest/assert_empty.rb +50 -0
- data/lib/rubocop/cop/minitest/assert_includes.rb +60 -0
- data/lib/rubocop/cop/minitest/assert_nil.rb +45 -0
- data/lib/rubocop/cop/minitest/assert_truthy.rb +46 -0
- data/lib/rubocop/cop/minitest/refute_nil.rb +45 -0
- data/lib/rubocop/cop/minitest_cops.rb +7 -0
- data/lib/rubocop/minitest.rb +12 -0
- data/lib/rubocop/minitest/inject.rb +18 -0
- data/lib/rubocop/minitest/version.rb +7 -0
- data/manual/cops.md +10 -0
- data/manual/cops_minitest.md +123 -0
- data/manual/index.md +1 -0
- data/manual/installation.md +11 -0
- data/manual/usage.md +27 -0
- data/mkdocs.yml +13 -0
- data/readthedocs.yml +5 -0
- data/rubocop-minitest.gemspec +39 -0
- data/tasks/cops_documentation.rake +312 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dc2eabe582388a8716653ef64d84833b48547f2c0e84fd666c36ab59b773abdc
|
4
|
+
data.tar.gz: 726cd0a1cc2f11eee03f49278408b9eda29308d74641cdc8a562f84c063e4e8c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 60bec75d6fab0181c7f1ee5e664ca0a9dda0d8ba7d9a54d184a7f4573633e10fccef93719da3dead41c5919862f67aa0b66eb92f1dc933759c240e093ee93bd0
|
7
|
+
data.tar.gz: 28d6e3f708ce291589ff8e2b74a12792777dbc39e244309951ba21e1ffdd59ac982fed3f52af148acca2b8a96bc8f0158711c3e99f893f09d26ef74beb743d2e
|
@@ -0,0 +1,43 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
jobs:
|
4
|
+
rake_default:
|
5
|
+
parameters:
|
6
|
+
image:
|
7
|
+
description: "Name of the Docker image."
|
8
|
+
type: string
|
9
|
+
default: "circleci/ruby"
|
10
|
+
docker:
|
11
|
+
- image: << parameters.image >>
|
12
|
+
environment:
|
13
|
+
# CircleCI container has two cores, but Ruby can see 32 cores. So we
|
14
|
+
# configure test-queue.
|
15
|
+
# See https://github.com/tmm1/test-queue#environment-variables
|
16
|
+
TEST_QUEUE_WORKERS: 2
|
17
|
+
JRUBY_OPTS: "--dev -J-Xmx1000M"
|
18
|
+
steps:
|
19
|
+
- checkout
|
20
|
+
- run: bundle install
|
21
|
+
- run: bundle exec rake
|
22
|
+
|
23
|
+
workflows:
|
24
|
+
build:
|
25
|
+
jobs:
|
26
|
+
- rake_default:
|
27
|
+
name: Ruby 2.3
|
28
|
+
image: circleci/ruby:2.3
|
29
|
+
- rake_default:
|
30
|
+
name: Ruby 2.4
|
31
|
+
image: circleci/ruby:2.4
|
32
|
+
- rake_default:
|
33
|
+
name: Ruby 2.5
|
34
|
+
image: circleci/ruby:2.5
|
35
|
+
- rake_default:
|
36
|
+
name: Ruby 2.6
|
37
|
+
image: circleci/ruby:2.6
|
38
|
+
- rake_default:
|
39
|
+
name: Ruby HEAD
|
40
|
+
image: rubocophq/circleci-ruby-snapshot:latest # Nightly snapshot build
|
41
|
+
- rake_default:
|
42
|
+
name: JRuby 9.2
|
43
|
+
image: circleci/jruby:9.2
|
@@ -0,0 +1,39 @@
|
|
1
|
+
---
|
2
|
+
name: Bug Report
|
3
|
+
about: Report an issue with RuboCop Minitest you've discovered.
|
4
|
+
---
|
5
|
+
|
6
|
+
*Be clear, concise and precise in your description of the problem.
|
7
|
+
Open an issue with a descriptive title and a summary in grammatically correct,
|
8
|
+
complete sentences.*
|
9
|
+
|
10
|
+
*Use the template below when reporting bugs. Please, make sure that
|
11
|
+
you're running the latest stable RuboCop and that the problem you're reporting
|
12
|
+
hasn't been reported (and potentially fixed) already.*
|
13
|
+
|
14
|
+
*Before filing the ticket you should replace all text above the horizontal
|
15
|
+
rule with your own words.*
|
16
|
+
|
17
|
+
--------
|
18
|
+
|
19
|
+
## Expected behavior
|
20
|
+
|
21
|
+
Describe here how you expected RuboCop Minitest to behave in this particular situation.
|
22
|
+
|
23
|
+
## Actual behavior
|
24
|
+
|
25
|
+
Describe here what actually happened.
|
26
|
+
|
27
|
+
## Steps to reproduce the problem
|
28
|
+
|
29
|
+
This is extremely important! Providing us with a reliable way to reproduce
|
30
|
+
a problem will expedite its solution.
|
31
|
+
|
32
|
+
## RuboCop version
|
33
|
+
|
34
|
+
Include the output of `rubocop -V` or `bundle exec rubocop -V` if using Bundler. Here's an example:
|
35
|
+
|
36
|
+
```
|
37
|
+
$ [bundle exec] rubocop -V
|
38
|
+
0.74.0 (using Parser 2.6.4.0, running on ruby 2.6.4 x86_64-darwin17)
|
39
|
+
```
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: Feature Request
|
3
|
+
about: Suggest new RuboCop Rails features or improvements to existing features.
|
4
|
+
---
|
5
|
+
|
6
|
+
## Is your feature request related to a problem? Please describe.
|
7
|
+
|
8
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
9
|
+
|
10
|
+
## Describe the solution you'd like
|
11
|
+
|
12
|
+
A clear and concise description of what you want to happen.
|
13
|
+
|
14
|
+
## Describe alternatives you've considered
|
15
|
+
|
16
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
17
|
+
|
18
|
+
## Additional context
|
19
|
+
|
20
|
+
Add any other context or screenshots about the feature request here.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
**Replace this text with a summary of the changes in your PR.
|
2
|
+
The more detailed you are, the better.**
|
3
|
+
|
4
|
+
-----------------
|
5
|
+
|
6
|
+
Before submitting the PR make sure the following are checked:
|
7
|
+
|
8
|
+
* [ ] Wrote [good commit messages][1].
|
9
|
+
* [ ] Commit message starts with `[Fix #issue-number]` (if the related issue exists).
|
10
|
+
* [ ] Feature branch is up-to-date with `master` (if not - rebase it).
|
11
|
+
* [ ] Squashed related commits together.
|
12
|
+
* [ ] Added tests.
|
13
|
+
* [ ] Added an entry to the [Changelog](https://github.com/rubocop-hq/rubocop-minitest/blob/master/CHANGELOG.md) if the new code introduces user-observable changes. See [changelog entry format](https://github.com/rubocop-hq/rubocop-minitest/blob/master/CONTRIBUTING.md#changelog-entry-format).
|
14
|
+
* [ ] The PR relates to *only* one subject with a clear title
|
15
|
+
and description in grammatically correct, complete sentences.
|
16
|
+
* [ ] Run `bundle exec rake default`. It executes all tests and RuboCop for itself, and generates the documentation.
|
17
|
+
|
18
|
+
[1]: https://chris.beams.io/posts/git-commit/
|
data/.gitignore
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
coverage.data
|
4
|
+
|
5
|
+
# rdoc generated
|
6
|
+
rdoc
|
7
|
+
|
8
|
+
# yard generated
|
9
|
+
doc
|
10
|
+
.yardoc
|
11
|
+
|
12
|
+
# bundler
|
13
|
+
.bundle
|
14
|
+
Gemfile.lock
|
15
|
+
Gemfile.local
|
16
|
+
|
17
|
+
# rbenv
|
18
|
+
.ruby-version
|
19
|
+
|
20
|
+
# rspec
|
21
|
+
/spec/examples.txt
|
22
|
+
/.test_queue_stats
|
23
|
+
|
24
|
+
# jeweler generated
|
25
|
+
pkg
|
26
|
+
|
27
|
+
# etags
|
28
|
+
TAGS
|
29
|
+
|
30
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
31
|
+
#
|
32
|
+
# * Create a file at ~/.gitignore
|
33
|
+
# * Include files you want ignored
|
34
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
35
|
+
#
|
36
|
+
# After doing this, these files will be ignored in all your git projects,
|
37
|
+
# saving you from having to 'pollute' every project you touch with them
|
38
|
+
#
|
39
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
40
|
+
#
|
41
|
+
# For MacOS:
|
42
|
+
#
|
43
|
+
#.DS_Store
|
44
|
+
|
45
|
+
# For TextMate
|
46
|
+
#*.tmproj
|
47
|
+
#tmtags
|
48
|
+
|
49
|
+
# For emacs:
|
50
|
+
#*~
|
51
|
+
#\#*
|
52
|
+
#.\#*
|
53
|
+
|
54
|
+
# For vim:
|
55
|
+
*.swp
|
56
|
+
|
57
|
+
# For redcar:
|
58
|
+
#.redcar
|
59
|
+
|
60
|
+
# For rubinius:
|
61
|
+
#*.rbc
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
# This is the configuration used to check the rubocop source code.
|
4
|
+
|
5
|
+
require:
|
6
|
+
- rubocop/cop/internal_affairs
|
7
|
+
- rubocop-performance
|
8
|
+
- rubocop-minitest
|
9
|
+
|
10
|
+
AllCops:
|
11
|
+
TargetRubyVersion: 2.3
|
12
|
+
|
13
|
+
Naming/PredicateName:
|
14
|
+
# Method define macros for dynamically generated method.
|
15
|
+
MethodDefinitionMacros:
|
16
|
+
- define_method
|
17
|
+
- define_singleton_method
|
18
|
+
- def_node_matcher
|
19
|
+
- def_node_search
|
20
|
+
|
21
|
+
Style/FormatStringToken:
|
22
|
+
# Because we parse a lot of source codes from strings. Percent arrays
|
23
|
+
# look like unannotated format string tokens to this cop.
|
24
|
+
Exclude:
|
25
|
+
- test/**/*
|
26
|
+
|
27
|
+
Metrics/ClassLength:
|
28
|
+
Exclude:
|
29
|
+
- test/**/*
|
30
|
+
|
31
|
+
Layout/EndOfLine:
|
32
|
+
EnforcedStyle: lf
|
33
|
+
|
34
|
+
Layout/ClassStructure:
|
35
|
+
Enabled: true
|
36
|
+
Categories:
|
37
|
+
module_inclusion:
|
38
|
+
- include
|
39
|
+
- prepend
|
40
|
+
- extend
|
41
|
+
ExpectedOrder:
|
42
|
+
- module_inclusion
|
43
|
+
- constants
|
44
|
+
- public_class_methods
|
45
|
+
- initializer
|
46
|
+
- instance_methods
|
47
|
+
- protected_methods
|
48
|
+
- private_methods
|
49
|
+
|
50
|
+
# Trailing white space is meaningful in code examples
|
51
|
+
Layout/TrailingWhitespace:
|
52
|
+
AllowInHeredoc: true
|
53
|
+
|
54
|
+
Lint/AmbiguousBlockAssociation:
|
55
|
+
Exclude:
|
56
|
+
- 'test/**/*.rb'
|
57
|
+
|
58
|
+
Lint/InterpolationCheck:
|
59
|
+
Exclude:
|
60
|
+
- 'test/**/*.rb'
|
61
|
+
|
62
|
+
Lint/UselessAccessModifier:
|
63
|
+
MethodCreatingMethods:
|
64
|
+
- 'def_matcher'
|
65
|
+
- 'def_node_matcher'
|
66
|
+
|
67
|
+
Lint/BooleanSymbol:
|
68
|
+
Enabled: false
|
69
|
+
|
70
|
+
Metrics/BlockLength:
|
71
|
+
Exclude:
|
72
|
+
- 'Rakefile'
|
73
|
+
- '**/*.rake'
|
74
|
+
- 'test/**/*.rb'
|
75
|
+
|
76
|
+
Naming/FileName:
|
77
|
+
Exclude:
|
78
|
+
- lib/rubocop-minitest.rb
|
79
|
+
|
80
|
+
Metrics/ModuleLength:
|
81
|
+
Exclude:
|
82
|
+
- 'test/**/*.rb'
|
83
|
+
|
84
|
+
Performance/ChainArrayAllocation:
|
85
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2019-08-07 15:41:02 +0900 using RuboCop version 0.74.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 2
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 17
|
12
|
+
|
13
|
+
# Offense count: 5
|
14
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
+
Metrics/MethodLength:
|
16
|
+
Max: 14
|
17
|
+
|
18
|
+
# Offense count: 2
|
19
|
+
# Cop supports --auto-correct.
|
20
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
21
|
+
# URISchemes: http, https
|
22
|
+
Metrics/LineLength:
|
23
|
+
Max: 87
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Change log
|
2
|
+
|
3
|
+
## master (unreleased)
|
4
|
+
|
5
|
+
## 0.2.1 (2019-09-24)
|
6
|
+
|
7
|
+
### Bug fixes
|
8
|
+
|
9
|
+
* [#13](https://github.com/rubocop-hq/rubocop-minitest/issues/13): Fix the execution target specified in `Include` parameter. ([@koic][])
|
10
|
+
|
11
|
+
## 0.2.0 (2019-09-21)
|
12
|
+
|
13
|
+
### New features
|
14
|
+
|
15
|
+
* [#11](https://github.com/rubocop-hq/rubocop-minitest/pull/11): Add new `Minitest/RefuteNil` cop. ([@tejasbubane][])
|
16
|
+
* [#8](https://github.com/rubocop-hq/rubocop-minitest/pull/8): Add new `Minitest/AssertTruthy` cop. ([@abhaynikam][])
|
17
|
+
* [#9](https://github.com/rubocop-hq/rubocop-minitest/pull/9): Add new `Minitest/AssertIncludes` cop. ([@abhaynikam][])
|
18
|
+
* [#10](https://github.com/rubocop-hq/rubocop-minitest/pull/10): Add new `Minitest/AssertEmpty` cop. ([@abhaynikam][])
|
19
|
+
|
20
|
+
## 0.1.0 (2019-09-01)
|
21
|
+
|
22
|
+
### New features
|
23
|
+
|
24
|
+
* Create RuboCop Minitest gem. ([@koic][])
|
25
|
+
* [#6](https://github.com/rubocop-hq/rubocop-minitest/pull/6): Add new `Minitest/AssertNil` cop. ([@duduribeiro][])
|
26
|
+
|
27
|
+
[@koic]: https://github.com/koic
|
28
|
+
[@duduribeiro]: https://github.com/duduribeiro
|
29
|
+
[@tejasbubane]: https://github.com/tejasbubane
|
30
|
+
[@abhaynikam]: https://github.com/abhaynikam
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
If you discover issues, have ideas for improvements or new features,
|
4
|
+
please report them to the [issue tracker][1] of the repository or
|
5
|
+
submit a pull request. Please, try to follow these guidelines when you
|
6
|
+
do so.
|
7
|
+
|
8
|
+
## Issue reporting
|
9
|
+
|
10
|
+
* Check that the issue has not already been reported.
|
11
|
+
* Check that the issue has not already been fixed in the latest code
|
12
|
+
(a.k.a. `master`).
|
13
|
+
* Be clear, concise and precise in your description of the problem.
|
14
|
+
* Open an issue with a descriptive title and a summary in grammatically correct,
|
15
|
+
complete sentences.
|
16
|
+
* Include the output of `rubocop -V`:
|
17
|
+
|
18
|
+
```
|
19
|
+
$ rubocop -V
|
20
|
+
0.74.0 (using Parser 2.6.4.0, running on ruby 2.6.4 x86_64-darwin17)
|
21
|
+
```
|
22
|
+
|
23
|
+
* Include any relevant code to the issue summary.
|
24
|
+
|
25
|
+
## Pull requests
|
26
|
+
|
27
|
+
* Read [how to properly contribute to open source projects on GitHub][2].
|
28
|
+
* Fork the project.
|
29
|
+
* Use a topic/feature branch to easily amend a pull request later, if necessary.
|
30
|
+
* Write [good commit messages][3].
|
31
|
+
* Use the same coding conventions as the rest of the project.
|
32
|
+
* Commit and push until you are happy with your contribution.
|
33
|
+
* If your change has a corresponding open GitHub issue, prefix the commit message with `[Fix #github-issue-number]`.
|
34
|
+
* Make sure to add tests for it. This is important so I don't break it
|
35
|
+
in a future version unintentionally.
|
36
|
+
* Add an entry to the [Changelog](CHANGELOG.md) accordingly. See [changelog entry format](#changelog-entry-format).
|
37
|
+
* Please try not to mess with the Rakefile, version, or history. If
|
38
|
+
you want to have your own version, or is otherwise necessary, that
|
39
|
+
is fine, but please isolate to its own commit so I can cherry-pick
|
40
|
+
around it.
|
41
|
+
* Make sure the test suite is passing and the code you wrote doesn't produce
|
42
|
+
RuboCop offenses (usually this is as simple as running `bundle exec rake`).
|
43
|
+
* [Squash related commits together][5].
|
44
|
+
* Open a [pull request][4] that relates to *only* one subject with a clear title
|
45
|
+
and description in grammatically correct, complete sentences.
|
46
|
+
|
47
|
+
### Changelog entry format
|
48
|
+
|
49
|
+
Here are a few examples:
|
50
|
+
|
51
|
+
```
|
52
|
+
* [#716](https://github.com/rubocop-hq/rubocop-minitest/issues/716): Fixed a regression in the auto-correction logic of `MethodDefParentheses`. ([@bbatsov][])
|
53
|
+
* New cop `ElseLayout` checks for odd arrangement of code in the `else` branch of a conditional expression. ([@bbatsov][])
|
54
|
+
```
|
55
|
+
|
56
|
+
* Mark it up in [Markdown syntax][6].
|
57
|
+
* The entry line should start with `* ` (an asterisk and a space).
|
58
|
+
* If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#123](https://github.com/rubocop-hq/rubocop-minitest/issues/123): `.
|
59
|
+
* Describe the brief of the change. The sentence should end with a punctuation.
|
60
|
+
* At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`.
|
61
|
+
* If this is your first contribution to RuboCop project, add a link definition for the implicit link to the bottom of the changelog as `[@username]: https://github.com/username`.
|
62
|
+
|
63
|
+
[1]: https://github.com/rubocop-hq/rubocop-minitest/issues
|
64
|
+
[2]: https://www.gun.io/blog/how-to-github-fork-branch-and-pull-request
|
65
|
+
[3]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
66
|
+
[4]: https://help.github.com/articles/about-pull-requests
|
67
|
+
[5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
|
68
|
+
[6]: https://daringfireball.net/projects/markdown/syntax
|
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
6
|
+
|
7
|
+
gemspec
|
8
|
+
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rubocop', github: 'rubocop-hq/rubocop'
|
11
|
+
gem 'rubocop-performance', '~> 1.4.0'
|
12
|
+
gem 'yard', '~> 0.9'
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Bozhidar Batsov, Jonas Arvidsson, Koichi ITO
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# RuboCop Minitest
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rubocop-minitest.svg)](https://badge.fury.io/rb/rubocop-minitest)
|
4
|
+
[![CircleCI](https://circleci.com/gh/rubocop-hq/rubocop-minitest.svg?style=svg)](https://circleci.com/gh/rubocop-hq/rubocop-minitest)
|
5
|
+
|
6
|
+
A [RuboCop](https://github.com/rubocop-hq/rubocop) extension focused on enforcing Minitest best practices and coding conventions.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Just install the `rubocop-minitest` gem
|
11
|
+
|
12
|
+
```bash
|
13
|
+
gem install rubocop-minitest
|
14
|
+
```
|
15
|
+
|
16
|
+
or if you use bundler put this in your `Gemfile`
|
17
|
+
|
18
|
+
```
|
19
|
+
gem 'rubocop-minitest'
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
You need to tell RuboCop to load the Minitest extension. There are three
|
25
|
+
ways to do this:
|
26
|
+
|
27
|
+
### RuboCop configuration file
|
28
|
+
|
29
|
+
Put this into your `.rubocop.yml`.
|
30
|
+
|
31
|
+
```yaml
|
32
|
+
require: rubocop-minitest
|
33
|
+
```
|
34
|
+
|
35
|
+
Alternatively, use the following array notation when specifying multiple extensions.
|
36
|
+
|
37
|
+
```yaml
|
38
|
+
require:
|
39
|
+
- rubocop-other-extension
|
40
|
+
- rubocop-minitest
|
41
|
+
```
|
42
|
+
|
43
|
+
Now you can run `rubocop` and it will automatically load the RuboCop Minitest
|
44
|
+
cops together with the standard cops.
|
45
|
+
|
46
|
+
### Command line
|
47
|
+
|
48
|
+
```bash
|
49
|
+
rubocop --require rubocop-minitest
|
50
|
+
```
|
51
|
+
|
52
|
+
### Rake task
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
RuboCop::RakeTask.new do |task|
|
56
|
+
task.requires << 'rubocop-minitest'
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
## The Cops
|
61
|
+
|
62
|
+
All cops are located under
|
63
|
+
[`lib/rubocop/cop/minitest`](lib/rubocop/cop/minitest), and contain
|
64
|
+
examples/documentation.
|
65
|
+
|
66
|
+
In your `.rubocop.yml`, you may treat the Minitest cops just like any other
|
67
|
+
cop. For example:
|
68
|
+
|
69
|
+
```yaml
|
70
|
+
Minitest/AssertNil:
|
71
|
+
Exclude:
|
72
|
+
- test/my_file_to_ignore_test.rb
|
73
|
+
```
|
74
|
+
|
75
|
+
## Contributing
|
76
|
+
|
77
|
+
Checkout the [contribution guidelines](CONTRIBUTING.md).
|
78
|
+
|
79
|
+
## License
|
80
|
+
|
81
|
+
`rubocop-minitest` is MIT licensed. [See the accompanying file](LICENSE.txt) for
|
82
|
+
the full text.
|