rubocop-minitest 0.18.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +0 -3
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +1 -1
  4. data/.github/workflows/linting.yml +1 -1
  5. data/.github/workflows/spell_checking.yml +3 -3
  6. data/.rubocop.yml +6 -1
  7. data/CHANGELOG.md +31 -3
  8. data/CONTRIBUTING.md +1 -1
  9. data/Gemfile +1 -1
  10. data/config/default.yml +34 -23
  11. data/docs/antora.yml +1 -1
  12. data/docs/modules/ROOT/pages/cops.adoc +2 -0
  13. data/docs/modules/ROOT/pages/cops_minitest.adoc +170 -42
  14. data/lib/rubocop/cop/minitest/assert_empty.rb +1 -2
  15. data/lib/rubocop/cop/minitest/assert_empty_literal.rb +1 -1
  16. data/lib/rubocop/cop/minitest/assert_equal.rb +1 -1
  17. data/lib/rubocop/cop/minitest/assert_in_delta.rb +1 -1
  18. data/lib/rubocop/cop/minitest/assert_includes.rb +1 -1
  19. data/lib/rubocop/cop/minitest/assert_instance_of.rb +1 -1
  20. data/lib/rubocop/cop/minitest/assert_kind_of.rb +1 -1
  21. data/lib/rubocop/cop/minitest/assert_match.rb +1 -1
  22. data/lib/rubocop/cop/minitest/assert_nil.rb +1 -1
  23. data/lib/rubocop/cop/minitest/assert_output.rb +1 -1
  24. data/lib/rubocop/cop/minitest/assert_path_exists.rb +1 -2
  25. data/lib/rubocop/cop/minitest/assert_predicate.rb +1 -1
  26. data/lib/rubocop/cop/minitest/assert_respond_to.rb +1 -1
  27. data/lib/rubocop/cop/minitest/assert_silent.rb +1 -1
  28. data/lib/rubocop/cop/minitest/assert_truthy.rb +1 -2
  29. data/lib/rubocop/cop/minitest/assert_with_expected_argument.rb +1 -1
  30. data/lib/rubocop/cop/minitest/assertion_in_lifecycle_hook.rb +1 -1
  31. data/lib/rubocop/cop/minitest/duplicate_test_run.rb +84 -0
  32. data/lib/rubocop/cop/minitest/global_expectations.rb +1 -1
  33. data/lib/rubocop/cop/minitest/literal_as_actual_argument.rb +1 -1
  34. data/lib/rubocop/cop/minitest/multiple_assertions.rb +1 -1
  35. data/lib/rubocop/cop/minitest/no_assertions.rb +1 -1
  36. data/lib/rubocop/cop/minitest/refute_empty.rb +1 -2
  37. data/lib/rubocop/cop/minitest/refute_equal.rb +1 -1
  38. data/lib/rubocop/cop/minitest/refute_false.rb +1 -2
  39. data/lib/rubocop/cop/minitest/refute_in_delta.rb +1 -1
  40. data/lib/rubocop/cop/minitest/refute_includes.rb +1 -1
  41. data/lib/rubocop/cop/minitest/refute_instance_of.rb +1 -1
  42. data/lib/rubocop/cop/minitest/refute_kind_of.rb +1 -1
  43. data/lib/rubocop/cop/minitest/refute_match.rb +1 -1
  44. data/lib/rubocop/cop/minitest/refute_nil.rb +1 -1
  45. data/lib/rubocop/cop/minitest/refute_path_exists.rb +1 -2
  46. data/lib/rubocop/cop/minitest/refute_predicate.rb +1 -1
  47. data/lib/rubocop/cop/minitest/refute_respond_to.rb +1 -1
  48. data/lib/rubocop/cop/minitest/skip_ensure.rb +95 -0
  49. data/lib/rubocop/cop/minitest/test_method_name.rb +1 -1
  50. data/lib/rubocop/cop/minitest/unreachable_assertion.rb +1 -1
  51. data/lib/rubocop/cop/minitest/unspecified_exception.rb +1 -1
  52. data/lib/rubocop/cop/minitest_cops.rb +2 -0
  53. data/lib/rubocop/cop/mixin/minitest_cop_rule.rb +2 -2
  54. data/lib/rubocop/cop/mixin/predicate_assertion_handleable.rb +6 -2
  55. data/lib/rubocop/minitest/assert_offense.rb +3 -3
  56. data/lib/rubocop/minitest/version.rb +1 -1
  57. data/relnotes/v0.12.0.md +1 -1
  58. data/relnotes/v0.15.2.md +1 -1
  59. data/relnotes/v0.19.0.md +5 -0
  60. data/relnotes/v0.19.1.md +5 -0
  61. data/relnotes/v0.20.0.md +13 -0
  62. data/relnotes/v0.9.0.md +1 -1
  63. data/rubocop-minitest.gemspec +1 -1
  64. metadata +10 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: add241b07281db4494e25119722057177e5eb15056360b0907d4b58819b6f371
4
- data.tar.gz: 0dbe3916ea796caa3c59e04df1b13ade8a11c25b7613187308b3ea90348380fa
3
+ metadata.gz: 6c35365ef5838d4a75f01181865e860ecb774a73288a310ffe2bfec21b6c6001
4
+ data.tar.gz: ccbdb0bb831bcebec0cde35263bf90063e400a25d97bccb9facf3edbc0bbd23a
5
5
  SHA512:
6
- metadata.gz: 4ab3dd3b82e55154731f600b942f2ef3dd48e85bf55d8d5d09c94bcb5227e409ea201c45be221cfde00cdb434d4877508bfad26cc7d3d3427c531c0babf146c1
7
- data.tar.gz: 261d27488e8ee453f9307bb4367a7072dddb544c0dd73c5ac4e70e033875be7916519cf346ede3c5956023d81e5cf0f22b6ab284c85650a8987b0fa95c77f18d
6
+ metadata.gz: 0a85bb1c4f0226eb025cdf18ae72757403ea71b422b19291e80bf696c95735cb2ddd3f61f921ad01c04c88ef731aa3e39d68141ac8971315e5933575cab6ec8c
7
+ data.tar.gz: b449004eb3a26c8996490d5e5008e784f10660edba75e99a7b3d5ef317d6c4585757aee59e7c95fb7100d892a2769c88bf26f42ac96684488945a5e9ee775155
data/.circleci/config.yml CHANGED
@@ -35,9 +35,6 @@ workflows:
35
35
  build:
36
36
  jobs:
37
37
  - documentation-checks
38
- - rake_default:
39
- name: Ruby 2.5
40
- image: cimg/ruby:2.5
41
38
  - rake_default:
42
39
  name: Ruby 2.6
43
40
  image: cimg/ruby:2.6
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: Feature Request
3
- about: Suggest new RuboCop Rails features or improvements to existing features.
3
+ about: Suggest new RuboCop Minitest features or improvements to existing features.
4
4
  ---
5
5
 
6
6
  ## Is your feature request related to a problem? Please describe.
@@ -6,7 +6,7 @@ jobs:
6
6
  name: Yamllint
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@v2
9
+ - uses: actions/checkout@v3
10
10
  - name: Yamllint
11
11
  uses: karancode/yamllint-github-action@master
12
12
  with:
@@ -10,7 +10,7 @@ jobs:
10
10
  matrix:
11
11
  python-version: [3.8]
12
12
  steps:
13
- - uses: actions/checkout@v2
13
+ - uses: actions/checkout@v3
14
14
  - name: Set up Python ${{ matrix.python-version }}
15
15
  uses: actions/setup-python@v2
16
16
  with:
@@ -26,8 +26,8 @@ jobs:
26
26
  name: Check spelling of all files in commit with misspell
27
27
  runs-on: ubuntu-latest
28
28
  steps:
29
- - uses: actions/checkout@v2
29
+ - uses: actions/checkout@v3
30
30
  - name: Install
31
- run: wget -O - -q https://git.io/misspell | sh -s -- -b .
31
+ run: wget -O - -q https://raw.githubusercontent.com/client9/misspell/master/install-misspell.sh | sh -s -- -b .
32
32
  - name: Misspell
33
33
  run: git ls-files --empty-directory | xargs ./misspell -error
data/.rubocop.yml CHANGED
@@ -9,7 +9,7 @@ require:
9
9
 
10
10
  AllCops:
11
11
  NewCops: enable
12
- TargetRubyVersion: 2.5
12
+ TargetRubyVersion: 2.6
13
13
  SuggestExtensions: false
14
14
 
15
15
  InternalAffairs/NodeMatcherDirective:
@@ -28,7 +28,12 @@ Naming/PredicateName:
28
28
  - def_node_search
29
29
 
30
30
  Naming/InclusiveLanguage:
31
+ Enabled: true
32
+ CheckStrings: true
31
33
  FlaggedTerms:
34
+ behaviour:
35
+ Suggestions:
36
+ - behavior
32
37
  offence:
33
38
  Suggestions:
34
39
  - offense
data/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.20.0 (2022-05-29)
6
+
7
+ ### New features
8
+
9
+ * [#169](https://github.com/rubocop/rubocop-minitest/issues/169): Add new `Minitest/SkipEnsure` cop. ([@koic][])
10
+
11
+ ### Bug fixes
12
+
13
+ * [#172](https://github.com/rubocop/rubocop-minitest/issues/172): Fix a false positive for `Minitest/AssertPredicate` and `Minitest/RefutePredicate` when using numbered parameters. ([@koic][])
14
+
15
+ ### Changes
16
+
17
+ * [#168](https://github.com/rubocop/rubocop-minitest/pull/168): **(Compatibility)** Drop Ruby 2.5 support. ([@koic][])
18
+
19
+ ## 0.19.1 (2022-04-10)
20
+
21
+ ### Bug fixes
22
+
23
+ * [#167](https://github.com/rubocop/rubocop-minitest/pull/167): Fix potential for valid Ruby code to be unparsable in `Minitest/DuplicateTestRun` cop. ([@gjtorikian][])
24
+
25
+ ## 0.19.0 (2022-04-05)
26
+
27
+ ### New features
28
+
29
+ * [#164](https://github.com/rubocop/rubocop-minitest/pull/164): Add new `Minitest/DuplicateTestRun` cop. ([@ignacio-chiazzo][])
30
+
5
31
  ## 0.18.0 (2022-03-13)
6
32
 
7
33
  ### New features
@@ -45,7 +71,7 @@
45
71
 
46
72
  ### Bug fixes
47
73
 
48
- * [#145](https://github.com/rubocop/rubocop-minitest/pull/145): Mark `Minitest/AssertEmptyLiteral` as safe auto-correction. ([@koic][])
74
+ * [#145](https://github.com/rubocop/rubocop-minitest/pull/145): Mark `Minitest/AssertEmptyLiteral` as safe autocorrection. ([@koic][])
49
75
 
50
76
  ## 0.15.1 (2021-09-26)
51
77
 
@@ -85,7 +111,7 @@
85
111
 
86
112
  ### Changes
87
113
 
88
- * [#129](https://github.com/rubocop/rubocop-minitest/pull/129): Drop Ruby 2.4 support. ([@koic][])
114
+ * [#129](https://github.com/rubocop/rubocop-minitest/pull/129): **(Compatibility)** Drop Ruby 2.4 support. ([@koic][])
89
115
 
90
116
  ## 0.11.1 (2021-03-31)
91
117
 
@@ -155,7 +181,7 @@
155
181
  ### Changes
156
182
 
157
183
  * [#73](https://github.com/rubocop/rubocop-minitest/issues/73): The Minitest department works on file names end with `_test.rb` by default. ([@koic][])
158
- * [#77](https://github.com/rubocop/rubocop-minitest/pull/77): **(BREAKING)** Drop support for Ruby 2.3. ([@koic][])
184
+ * [#77](https://github.com/rubocop/rubocop-minitest/pull/77): **(Compatibility)** Drop support for Ruby 2.3. ([@koic][])
159
185
 
160
186
  ## 0.8.1 (2020-04-06)
161
187
 
@@ -286,3 +312,5 @@
286
312
  [@cstyles]: https://github.com/cstyles
287
313
  [@ghiculescu]: https://github.com/ghiculescu
288
314
  [@gi]: https://github.com/gi
315
+ [@ignacio-chiazzo]: https://github.com/ignacio-chiazzo
316
+ [@gjtorikian]: https://github.com/gjtorikian
data/CONTRIBUTING.md CHANGED
@@ -49,7 +49,7 @@ $ rubocop -V
49
49
  Here are a few examples:
50
50
 
51
51
  ```
52
- * [#716](https://github.com/rubocop/rubocop-minitest/issues/716): Fixed a regression in the auto-correction logic of `MethodDefParentheses`. ([@bbatsov][])
52
+ * [#716](https://github.com/rubocop/rubocop-minitest/issues/716): Fixed a regression in the autocorrection logic of `MethodDefParentheses`. ([@bbatsov][])
53
53
  * New cop `ElseLayout` checks for odd arrangement of code in the `else` branch of a conditional expression. ([@bbatsov][])
54
54
  ```
55
55
 
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ gemspec
9
9
  gem 'bump', require: false
10
10
  gem 'rake'
11
11
  gem 'rubocop', github: 'rubocop/rubocop'
12
- gem 'rubocop-performance', '~> 1.12.0'
12
+ gem 'rubocop-performance', '~> 1.13.0'
13
13
  gem 'yard', '~> 0.9'
14
14
 
15
15
  local_gemfile = File.expand_path('Gemfile.local', __dir__)
data/config/default.yml CHANGED
@@ -28,17 +28,6 @@ Minitest/AssertInDelta:
28
28
  Enabled: 'pending'
29
29
  VersionAdded: '0.10'
30
30
 
31
- Minitest/AssertionInLifecycleHook:
32
- Description: 'This cop checks for usage of assertions in lifecycle hooks.'
33
- Enabled: 'pending'
34
- VersionAdded: '0.10'
35
-
36
- Minitest/AssertMatch:
37
- Description: 'This cop enforces the test to use `assert_match` instead of using `assert(matcher.match(object))`.'
38
- StyleGuide: 'https://minitest.rubystyle.guide#assert-match'
39
- Enabled: true
40
- VersionAdded: '0.6'
41
-
42
31
  Minitest/AssertIncludes:
43
32
  Description: 'This cop enforces the test to use `assert_includes` instead of using `assert(collection.include?(object))`.'
44
33
  StyleGuide: 'https://minitest.rubystyle.guide#assert-includes'
@@ -57,6 +46,12 @@ Minitest/AssertKindOf:
57
46
  Enabled: 'pending'
58
47
  VersionAdded: '0.10'
59
48
 
49
+ Minitest/AssertMatch:
50
+ Description: 'This cop enforces the test to use `assert_match` instead of using `assert(matcher.match(object))`.'
51
+ StyleGuide: 'https://minitest.rubystyle.guide#assert-match'
52
+ Enabled: true
53
+ VersionAdded: '0.6'
54
+
60
55
  Minitest/AssertNil:
61
56
  Description: 'This cop enforces the test to use `assert_nil` instead of using `assert_equal(nil, something)` or `assert(something.nil?)`.'
62
57
  StyleGuide: 'https://minitest.rubystyle.guide#assert-nil'
@@ -75,18 +70,18 @@ Minitest/AssertPathExists:
75
70
  Enabled: 'pending'
76
71
  VersionAdded: '0.10'
77
72
 
78
- Minitest/AssertRespondTo:
79
- Description: 'This cop enforces the test to use `assert_respond_to(object, :do_something)` over `assert(object.respond_to?(:do_something))`.'
80
- StyleGuide: 'https://minitest.rubystyle.guide#assert-responds-to-method'
81
- Enabled: true
82
- VersionAdded: '0.3'
83
-
84
73
  Minitest/AssertPredicate:
85
74
  Description: 'This cop enforces the test to use `assert_predicate` instead of using `assert(obj.a_predicate_method?)`.'
86
75
  StyleGuide: 'https://minitest.rubystyle.guide/#assert-predicate'
87
76
  Enabled: pending
88
77
  VersionAdded: '0.18'
89
78
 
79
+ Minitest/AssertRespondTo:
80
+ Description: 'This cop enforces the test to use `assert_respond_to(object, :do_something)` over `assert(object.respond_to?(:do_something))`.'
81
+ StyleGuide: 'https://minitest.rubystyle.guide#assert-responds-to-method'
82
+ Enabled: true
83
+ VersionAdded: '0.3'
84
+
90
85
  Minitest/AssertSilent:
91
86
  Description: "This cop enforces the test to use `assert_silent { ... }` instead of using `assert_output('', '') { ... }`."
92
87
  StyleGuide: 'https://github.com/rubocop/minitest-style-guide#assert-silent'
@@ -105,6 +100,17 @@ Minitest/AssertWithExpectedArgument:
105
100
  Safe: false
106
101
  VersionAdded: '0.11'
107
102
 
103
+ Minitest/AssertionInLifecycleHook:
104
+ Description: 'This cop checks for usage of assertions in lifecycle hooks.'
105
+ Enabled: 'pending'
106
+ VersionAdded: '0.10'
107
+
108
+ Minitest/DuplicateTestRun:
109
+ Description: 'This cop detects duplicate test runs caused by one test class inheriting from another.'
110
+ StyleGuide: 'https://minitest.rubystyle.guide/#subclassing-test-cases'
111
+ Enabled: pending
112
+ VersionAdded: '0.19'
113
+
108
114
  Minitest/GlobalExpectations:
109
115
  Description: 'This cop checks for deprecated global expectations.'
110
116
  StyleGuide: 'https://minitest.rubystyle.guide#global-expectations'
@@ -170,12 +176,6 @@ Minitest/RefuteIncludes:
170
176
  Enabled: true
171
177
  VersionAdded: '0.3'
172
178
 
173
- Minitest/RefuteMatch:
174
- Description: 'This cop enforces the test to use `refute_match` instead of using `refute(matcher.match(object))`.'
175
- StyleGuide: 'https://minitest.rubystyle.guide#refute-match'
176
- Enabled: true
177
- VersionAdded: '0.6'
178
-
179
179
  Minitest/RefuteInstanceOf:
180
180
  Description: 'This cop enforces the test to use `refute_instance_of(Class, object)` over `refute(object.instance_of?(Class))`.'
181
181
  StyleGuide: 'https://minitest.rubystyle.guide#refute-instance-of'
@@ -188,6 +188,12 @@ Minitest/RefuteKindOf:
188
188
  Enabled: 'pending'
189
189
  VersionAdded: '0.10'
190
190
 
191
+ Minitest/RefuteMatch:
192
+ Description: 'This cop enforces the test to use `refute_match` instead of using `refute(matcher.match(object))`.'
193
+ StyleGuide: 'https://minitest.rubystyle.guide#refute-match'
194
+ Enabled: true
195
+ VersionAdded: '0.6'
196
+
191
197
  Minitest/RefuteNil:
192
198
  Description: 'This cop enforces the test to use `refute_nil` instead of using `refute_equal(nil, something)` or `refute(something.nil?)`.'
193
199
  StyleGuide: 'https://minitest.rubystyle.guide#refute-nil'
@@ -212,6 +218,11 @@ Minitest/RefuteRespondTo:
212
218
  Enabled: true
213
219
  VersionAdded: '0.4'
214
220
 
221
+ Minitest/SkipEnsure:
222
+ Description: 'Checks that `ensure` call even if `skip`.'
223
+ Enabled: pending
224
+ VersionAdded: '0.20'
225
+
215
226
  Minitest/TestMethodName:
216
227
  Description: 'This cop enforces that test method names start with `test_` prefix.'
217
228
  Enabled: 'pending'
data/docs/antora.yml CHANGED
@@ -2,6 +2,6 @@ name: rubocop-minitest
2
2
  title: RuboCop Minitest
3
3
  # We always provide version without patch here (e.g. 1.1),
4
4
  # as patch versions should not appear in the docs.
5
- version: '0.18'
5
+ version: '0.20'
6
6
  nav:
7
7
  - modules/ROOT/nav.adoc
@@ -30,6 +30,7 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide].
30
30
  * xref:cops_minitest.adoc#minitestasserttruthy[Minitest/AssertTruthy]
31
31
  * xref:cops_minitest.adoc#minitestassertwithexpectedargument[Minitest/AssertWithExpectedArgument]
32
32
  * xref:cops_minitest.adoc#minitestassertioninlifecyclehook[Minitest/AssertionInLifecycleHook]
33
+ * xref:cops_minitest.adoc#minitestduplicatetestrun[Minitest/DuplicateTestRun]
33
34
  * xref:cops_minitest.adoc#minitestglobalexpectations[Minitest/GlobalExpectations]
34
35
  * xref:cops_minitest.adoc#minitestliteralasactualargument[Minitest/LiteralAsActualArgument]
35
36
  * xref:cops_minitest.adoc#minitestmultipleassertions[Minitest/MultipleAssertions]
@@ -46,6 +47,7 @@ based on the https://minitest.rubystyle.guide/[Minitest Style Guide].
46
47
  * xref:cops_minitest.adoc#minitestrefutepathexists[Minitest/RefutePathExists]
47
48
  * xref:cops_minitest.adoc#minitestrefutepredicate[Minitest/RefutePredicate]
48
49
  * xref:cops_minitest.adoc#minitestrefuterespondto[Minitest/RefuteRespondTo]
50
+ * xref:cops_minitest.adoc#minitestskipensure[Minitest/SkipEnsure]
49
51
  * xref:cops_minitest.adoc#minitesttestmethodname[Minitest/TestMethodName]
50
52
  * xref:cops_minitest.adoc#minitestunreachableassertion[Minitest/UnreachableAssertion]
51
53
  * xref:cops_minitest.adoc#minitestunspecifiedexception[Minitest/UnspecifiedException]