oriole 0.1.0.alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +56 -0
- data/.rubocop.yml +32 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +20 -0
- data/Gemfile.lock +121 -0
- data/LICENSE +21 -0
- data/README.md +84 -0
- data/Rakefile +12 -0
- data/bench/bench.rb +35 -0
- data/bench/execute.rb +66 -0
- data/bench/schemas/bluejay.rb +149 -0
- data/bench/schemas/models.rb +216 -0
- data/bench/schemas/oriole.rb +144 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/bin/style +2 -0
- data/bin/tapioca +27 -0
- data/bin/typecheck +2 -0
- data/lib/oriole/builtin_scalar_definition.rb +53 -0
- data/lib/oriole/definition/abstract/definition.rb +21 -0
- data/lib/oriole/definition/abstract/field_definition.rb +22 -0
- data/lib/oriole/definition/abstract/object_type_definition.rb +21 -0
- data/lib/oriole/definition/abstract/schema_definition.rb +18 -0
- data/lib/oriole/definition/abstract/visibility.rb +18 -0
- data/lib/oriole/definition/base_output_type.rb +13 -0
- data/lib/oriole/definition/field_definition.rb +27 -0
- data/lib/oriole/definition/object_type.rb +40 -0
- data/lib/oriole/definition/output_type.rb +79 -0
- data/lib/oriole/definition/schema.rb +45 -0
- data/lib/oriole/definition/visibility_scoped/object_type_definition.rb +62 -0
- data/lib/oriole/definition/visibility_scoped/schema_definition.rb +26 -0
- data/lib/oriole/execution/coerce_result.rb +16 -0
- data/lib/oriole/execution/engine.rb +207 -0
- data/lib/oriole/version.rb +6 -0
- data/lib/oriole.rb +14 -0
- data/oriole.gemspec +38 -0
- data/rakelib/bench.rake +69 -0
- data/sorbet/config +5 -0
- data/sorbet/rbi/annotations/rainbow.rbi +269 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +584 -0
- data/sorbet/rbi/gems/base64@0.1.1.rbi +172 -0
- data/sorbet/rbi/gems/bluejay@0.1.0.alpha.2-a45c1b3b47aa4524f94bbe03db5ff1ae792afd09.rbi +1206 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1083 -0
- data/sorbet/rbi/gems/erubi@1.12.0.rbi +145 -0
- data/sorbet/rbi/gems/json@2.6.3.rbi +1533 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.3.rbi +14237 -0
- data/sorbet/rbi/gems/minitest@5.19.0.rbi +1491 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +158 -0
- data/sorbet/rbi/gems/parallel@1.23.0.rbi +273 -0
- data/sorbet/rbi/gems/parser@3.2.2.3.rbi +7253 -0
- data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +951 -0
- data/sorbet/rbi/gems/racc@1.7.1.rbi +161 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +402 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +3024 -0
- data/sorbet/rbi/gems/rbi@0.0.17.rbi +2972 -0
- data/sorbet/rbi/gems/regexp_parser@2.8.1.rbi +3749 -0
- data/sorbet/rbi/gems/rexml@3.2.6.rbi +4781 -0
- data/sorbet/rbi/gems/rubocop-ast@1.29.0.rbi +7006 -0
- data/sorbet/rbi/gems/rubocop-minitest@0.27.0.rbi +2371 -0
- data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +328 -0
- data/sorbet/rbi/gems/rubocop-shopify@2.14.0.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +975 -0
- data/sorbet/rbi/gems/rubocop@1.56.1.rbi +56525 -0
- data/sorbet/rbi/gems/ruby-lsp@0.4.5.rbi +11 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1317 -0
- data/sorbet/rbi/gems/spoom@1.2.3.rbi +3203 -0
- data/sorbet/rbi/gems/syntax_tree@6.1.1.rbi +22855 -0
- data/sorbet/rbi/gems/tapioca@0.11.8.rbi +3349 -0
- data/sorbet/rbi/gems/thor@1.2.2.rbi +3965 -0
- data/sorbet/rbi/gems/tinygql@0.1.4.rbi +2363 -0
- data/sorbet/rbi/gems/unicode-display_width@2.4.2.rbi +65 -0
- data/sorbet/rbi/gems/unparser@0.6.8.rbi +4525 -0
- data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +428 -0
- data/sorbet/rbi/gems/yard@0.9.34.rbi +18219 -0
- data/sorbet/rbi/gems/zeitwerk@2.6.11.rbi +999 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +5 -0
- metadata +208 -0
@@ -0,0 +1,2371 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `rubocop-minitest` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem rubocop-minitest`.
|
6
|
+
|
7
|
+
# source://rubocop-minitest//lib/rubocop/minitest.rb#3
|
8
|
+
module RuboCop; end
|
9
|
+
|
10
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/argument_range_helper.rb#4
|
11
|
+
module RuboCop::Cop; end
|
12
|
+
|
13
|
+
# Methods that calculate and return `Parser::Source::Ranges`.
|
14
|
+
#
|
15
|
+
# @api private
|
16
|
+
#
|
17
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/argument_range_helper.rb#7
|
18
|
+
module RuboCop::Cop::ArgumentRangeHelper
|
19
|
+
include ::RuboCop::Cop::RangeHelp
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
# @api private
|
24
|
+
#
|
25
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/argument_range_helper.rb#25
|
26
|
+
def all_arguments_range(node); end
|
27
|
+
|
28
|
+
# @api private
|
29
|
+
#
|
30
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/argument_range_helper.rb#18
|
31
|
+
def first_and_second_arguments_range(node); end
|
32
|
+
|
33
|
+
# @api private
|
34
|
+
#
|
35
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/argument_range_helper.rb#12
|
36
|
+
def first_argument_range(node); end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Common functionality for `AssertInDelta` and `RefuteInDelta` cops.
|
40
|
+
#
|
41
|
+
# @api private
|
42
|
+
#
|
43
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/in_delta_mixin.rb#7
|
44
|
+
module RuboCop::Cop::InDeltaMixin
|
45
|
+
# @api private
|
46
|
+
#
|
47
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/in_delta_mixin.rb#10
|
48
|
+
def on_send(node); end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
# @api private
|
53
|
+
#
|
54
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/in_delta_mixin.rb#35
|
55
|
+
def assertion_method; end
|
56
|
+
|
57
|
+
# @api private
|
58
|
+
#
|
59
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/in_delta_mixin.rb#27
|
60
|
+
def build_good_method(expected, actual, message); end
|
61
|
+
end
|
62
|
+
|
63
|
+
# @api private
|
64
|
+
#
|
65
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/in_delta_mixin.rb#8
|
66
|
+
RuboCop::Cop::InDeltaMixin::MSG = T.let(T.unsafe(nil), String)
|
67
|
+
|
68
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/nil_assertion_handleable.rb#5
|
69
|
+
module RuboCop::Cop::Minitest; end
|
70
|
+
|
71
|
+
# Enforces the test to use `assert_empty` instead of using `assert(object.empty?)`.
|
72
|
+
#
|
73
|
+
# @example
|
74
|
+
# # bad
|
75
|
+
# assert(object.empty?)
|
76
|
+
# assert(object.empty?, 'message')
|
77
|
+
#
|
78
|
+
# # good
|
79
|
+
# assert_empty(object)
|
80
|
+
# assert_empty(object, 'message')
|
81
|
+
#
|
82
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_empty.rb#17
|
83
|
+
class RuboCop::Cop::Minitest::AssertEmpty < ::RuboCop::Cop::Base
|
84
|
+
include ::RuboCop::Cop::RangeHelp
|
85
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
86
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
87
|
+
extend ::RuboCop::Cop::AutoCorrector
|
88
|
+
|
89
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
90
|
+
def autocorrect(corrector, node, arguments); end
|
91
|
+
|
92
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_empty.rb#23
|
93
|
+
def on_send(node); end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
98
|
+
def correct_receiver(receiver); end
|
99
|
+
|
100
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
101
|
+
def enclosed_in_redundant_parentheses?(node); end
|
102
|
+
|
103
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
104
|
+
def new_arguments(arguments); end
|
105
|
+
|
106
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
107
|
+
def offense_message(arguments); end
|
108
|
+
|
109
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
110
|
+
def peel_redundant_parentheses_from(arguments); end
|
111
|
+
end
|
112
|
+
|
113
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
114
|
+
RuboCop::Cop::Minitest::AssertEmpty::MSG = T.let(T.unsafe(nil), String)
|
115
|
+
|
116
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
117
|
+
RuboCop::Cop::Minitest::AssertEmpty::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
118
|
+
|
119
|
+
# Enforces the test to use `assert_empty`
|
120
|
+
# instead of using `assert_equal([], object)` or `assert_equal({}, object)`.
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
# # bad
|
124
|
+
# assert_equal([], object)
|
125
|
+
# assert_equal({}, object)
|
126
|
+
#
|
127
|
+
# # good
|
128
|
+
# assert_empty(object)
|
129
|
+
#
|
130
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_empty_literal.rb#17
|
131
|
+
class RuboCop::Cop::Minitest::AssertEmptyLiteral < ::RuboCop::Cop::Base
|
132
|
+
include ::RuboCop::Cop::RangeHelp
|
133
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
134
|
+
extend ::RuboCop::Cop::AutoCorrector
|
135
|
+
|
136
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_empty_literal.rb#24
|
137
|
+
def assert_equal_with_empty_literal(param0 = T.unsafe(nil)); end
|
138
|
+
|
139
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_empty_literal.rb#28
|
140
|
+
def on_send(node); end
|
141
|
+
end
|
142
|
+
|
143
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_empty_literal.rb#21
|
144
|
+
RuboCop::Cop::Minitest::AssertEmptyLiteral::MSG = T.let(T.unsafe(nil), String)
|
145
|
+
|
146
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_empty_literal.rb#22
|
147
|
+
RuboCop::Cop::Minitest::AssertEmptyLiteral::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
148
|
+
|
149
|
+
# Enforces the use of `assert_equal(expected, actual)`
|
150
|
+
# over `assert(expected == actual)`.
|
151
|
+
#
|
152
|
+
# @example
|
153
|
+
# # bad
|
154
|
+
# assert("rubocop-minitest" == actual)
|
155
|
+
#
|
156
|
+
# # good
|
157
|
+
# assert_equal("rubocop-minitest", actual)
|
158
|
+
#
|
159
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_equal.rb#16
|
160
|
+
class RuboCop::Cop::Minitest::AssertEqual < ::RuboCop::Cop::Base
|
161
|
+
include ::RuboCop::Cop::RangeHelp
|
162
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
163
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
164
|
+
extend ::RuboCop::Cop::AutoCorrector
|
165
|
+
|
166
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
167
|
+
def autocorrect(corrector, node, arguments); end
|
168
|
+
|
169
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
170
|
+
def on_send(node); end
|
171
|
+
|
172
|
+
private
|
173
|
+
|
174
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
175
|
+
def correct_receiver(receiver); end
|
176
|
+
|
177
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
178
|
+
def enclosed_in_redundant_parentheses?(node); end
|
179
|
+
|
180
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
181
|
+
def new_arguments(arguments); end
|
182
|
+
|
183
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
184
|
+
def offense_message(arguments); end
|
185
|
+
|
186
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
187
|
+
def peel_redundant_parentheses_from(arguments); end
|
188
|
+
end
|
189
|
+
|
190
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
191
|
+
RuboCop::Cop::Minitest::AssertEqual::MSG = T.let(T.unsafe(nil), String)
|
192
|
+
|
193
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
194
|
+
RuboCop::Cop::Minitest::AssertEqual::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
195
|
+
|
196
|
+
# Enforces the test to use `assert_in_delta`
|
197
|
+
# instead of using `assert_equal` to compare floats.
|
198
|
+
#
|
199
|
+
# @example
|
200
|
+
# # bad
|
201
|
+
# assert_equal(0.2, actual)
|
202
|
+
# assert_equal(0.2, actual, 'message')
|
203
|
+
#
|
204
|
+
# # good
|
205
|
+
# assert_in_delta(0.2, actual)
|
206
|
+
# assert_in_delta(0.2, actual, 0.001, 'message')
|
207
|
+
#
|
208
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_in_delta.rb#18
|
209
|
+
class RuboCop::Cop::Minitest::AssertInDelta < ::RuboCop::Cop::Base
|
210
|
+
include ::RuboCop::Cop::InDeltaMixin
|
211
|
+
extend ::RuboCop::Cop::AutoCorrector
|
212
|
+
|
213
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_in_delta.rb#24
|
214
|
+
def equal_floats_call(param0 = T.unsafe(nil)); end
|
215
|
+
end
|
216
|
+
|
217
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_in_delta.rb#22
|
218
|
+
RuboCop::Cop::Minitest::AssertInDelta::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
219
|
+
|
220
|
+
# Enforces the test to use `assert_includes`
|
221
|
+
# instead of using `assert(collection.include?(object))`.
|
222
|
+
#
|
223
|
+
# @example
|
224
|
+
# # bad
|
225
|
+
# assert(collection.include?(object))
|
226
|
+
# assert(collection.include?(object), 'message')
|
227
|
+
#
|
228
|
+
# # good
|
229
|
+
# assert_includes(collection, object)
|
230
|
+
# assert_includes(collection, object, 'message')
|
231
|
+
#
|
232
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_includes.rb#18
|
233
|
+
class RuboCop::Cop::Minitest::AssertIncludes < ::RuboCop::Cop::Base
|
234
|
+
include ::RuboCop::Cop::RangeHelp
|
235
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
236
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
237
|
+
extend ::RuboCop::Cop::AutoCorrector
|
238
|
+
|
239
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
240
|
+
def autocorrect(corrector, node, arguments); end
|
241
|
+
|
242
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
243
|
+
def on_send(node); end
|
244
|
+
|
245
|
+
private
|
246
|
+
|
247
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
248
|
+
def correct_receiver(receiver); end
|
249
|
+
|
250
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
251
|
+
def enclosed_in_redundant_parentheses?(node); end
|
252
|
+
|
253
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
254
|
+
def new_arguments(arguments); end
|
255
|
+
|
256
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
257
|
+
def offense_message(arguments); end
|
258
|
+
|
259
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
260
|
+
def peel_redundant_parentheses_from(arguments); end
|
261
|
+
end
|
262
|
+
|
263
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
264
|
+
RuboCop::Cop::Minitest::AssertIncludes::MSG = T.let(T.unsafe(nil), String)
|
265
|
+
|
266
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
267
|
+
RuboCop::Cop::Minitest::AssertIncludes::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
268
|
+
|
269
|
+
# Enforces the test to use `assert_instance_of(Class, object)`
|
270
|
+
# over `assert(object.instance_of?(Class))`.
|
271
|
+
#
|
272
|
+
# @example
|
273
|
+
# # bad
|
274
|
+
# assert(object.instance_of?(Class))
|
275
|
+
# assert(object.instance_of?(Class), 'message')
|
276
|
+
#
|
277
|
+
# # good
|
278
|
+
# assert_instance_of(Class, object)
|
279
|
+
# assert_instance_of(Class, object, 'message')
|
280
|
+
#
|
281
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_instance_of.rb#18
|
282
|
+
class RuboCop::Cop::Minitest::AssertInstanceOf < ::RuboCop::Cop::Base
|
283
|
+
include ::RuboCop::Cop::RangeHelp
|
284
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
285
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
286
|
+
extend ::RuboCop::Cop::AutoCorrector
|
287
|
+
|
288
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
289
|
+
def autocorrect(corrector, node, arguments); end
|
290
|
+
|
291
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
292
|
+
def on_send(node); end
|
293
|
+
|
294
|
+
private
|
295
|
+
|
296
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
297
|
+
def correct_receiver(receiver); end
|
298
|
+
|
299
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
300
|
+
def enclosed_in_redundant_parentheses?(node); end
|
301
|
+
|
302
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
303
|
+
def new_arguments(arguments); end
|
304
|
+
|
305
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
306
|
+
def offense_message(arguments); end
|
307
|
+
|
308
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
309
|
+
def peel_redundant_parentheses_from(arguments); end
|
310
|
+
end
|
311
|
+
|
312
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
313
|
+
RuboCop::Cop::Minitest::AssertInstanceOf::MSG = T.let(T.unsafe(nil), String)
|
314
|
+
|
315
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
316
|
+
RuboCop::Cop::Minitest::AssertInstanceOf::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
317
|
+
|
318
|
+
# Enforces the test to use `assert_kind_of(Class, object)`
|
319
|
+
# over `assert(object.kind_of?(Class))`.
|
320
|
+
#
|
321
|
+
# @example
|
322
|
+
# # bad
|
323
|
+
# assert(object.kind_of?(Class))
|
324
|
+
# assert(object.kind_of?(Class), 'message')
|
325
|
+
#
|
326
|
+
# # good
|
327
|
+
# assert_kind_of(Class, object)
|
328
|
+
# assert_kind_of(Class, object, 'message')
|
329
|
+
#
|
330
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_kind_of.rb#18
|
331
|
+
class RuboCop::Cop::Minitest::AssertKindOf < ::RuboCop::Cop::Base
|
332
|
+
include ::RuboCop::Cop::RangeHelp
|
333
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
334
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
335
|
+
extend ::RuboCop::Cop::AutoCorrector
|
336
|
+
|
337
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
338
|
+
def autocorrect(corrector, node, arguments); end
|
339
|
+
|
340
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
341
|
+
def on_send(node); end
|
342
|
+
|
343
|
+
private
|
344
|
+
|
345
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
346
|
+
def correct_receiver(receiver); end
|
347
|
+
|
348
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
349
|
+
def enclosed_in_redundant_parentheses?(node); end
|
350
|
+
|
351
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
352
|
+
def new_arguments(arguments); end
|
353
|
+
|
354
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
355
|
+
def offense_message(arguments); end
|
356
|
+
|
357
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
358
|
+
def peel_redundant_parentheses_from(arguments); end
|
359
|
+
end
|
360
|
+
|
361
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
362
|
+
RuboCop::Cop::Minitest::AssertKindOf::MSG = T.let(T.unsafe(nil), String)
|
363
|
+
|
364
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
365
|
+
RuboCop::Cop::Minitest::AssertKindOf::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
366
|
+
|
367
|
+
# Enforces the test to use `assert_match`
|
368
|
+
# instead of using `assert(matcher.match(string))`.
|
369
|
+
#
|
370
|
+
# @example
|
371
|
+
# # bad
|
372
|
+
# assert(matcher.match(string))
|
373
|
+
# assert(matcher.match(string), 'message')
|
374
|
+
#
|
375
|
+
# # good
|
376
|
+
# assert_match(regex, string)
|
377
|
+
# assert_match(matcher, string, 'message')
|
378
|
+
#
|
379
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_match.rb#18
|
380
|
+
class RuboCop::Cop::Minitest::AssertMatch < ::RuboCop::Cop::Base
|
381
|
+
include ::RuboCop::Cop::RangeHelp
|
382
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
383
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
384
|
+
extend ::RuboCop::Cop::AutoCorrector
|
385
|
+
|
386
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
387
|
+
def autocorrect(corrector, node, arguments); end
|
388
|
+
|
389
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
390
|
+
def on_send(node); end
|
391
|
+
|
392
|
+
private
|
393
|
+
|
394
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
395
|
+
def correct_receiver(receiver); end
|
396
|
+
|
397
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
398
|
+
def enclosed_in_redundant_parentheses?(node); end
|
399
|
+
|
400
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
401
|
+
def new_arguments(arguments); end
|
402
|
+
|
403
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
404
|
+
def offense_message(arguments); end
|
405
|
+
|
406
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
407
|
+
def peel_redundant_parentheses_from(arguments); end
|
408
|
+
end
|
409
|
+
|
410
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
411
|
+
RuboCop::Cop::Minitest::AssertMatch::MSG = T.let(T.unsafe(nil), String)
|
412
|
+
|
413
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
414
|
+
RuboCop::Cop::Minitest::AssertMatch::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
415
|
+
|
416
|
+
# Enforces the test to use `assert_nil` instead of using
|
417
|
+
# `assert_equal(nil, something)`, `assert(something.nil?)`, or `assert_predicate(something, :nil?)`.
|
418
|
+
#
|
419
|
+
# @example
|
420
|
+
# # bad
|
421
|
+
# assert_equal(nil, actual)
|
422
|
+
# assert_equal(nil, actual, 'message')
|
423
|
+
# assert(object.nil?)
|
424
|
+
# assert(object.nil?, 'message')
|
425
|
+
# assert_predicate(object, :nil?)
|
426
|
+
# assert_predicate(object, :nil?, 'message')
|
427
|
+
#
|
428
|
+
# # good
|
429
|
+
# assert_nil(actual)
|
430
|
+
# assert_nil(actual, 'message')
|
431
|
+
#
|
432
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_nil.rb#22
|
433
|
+
class RuboCop::Cop::Minitest::AssertNil < ::RuboCop::Cop::Base
|
434
|
+
include ::RuboCop::Cop::RangeHelp
|
435
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
436
|
+
include ::RuboCop::Cop::Minitest::NilAssertionHandleable
|
437
|
+
extend ::RuboCop::Cop::AutoCorrector
|
438
|
+
|
439
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_nil.rb#30
|
440
|
+
def nil_assertion(param0 = T.unsafe(nil)); end
|
441
|
+
|
442
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_nil.rb#38
|
443
|
+
def on_send(node); end
|
444
|
+
|
445
|
+
private
|
446
|
+
|
447
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_nil.rb#46
|
448
|
+
def assertion_type; end
|
449
|
+
end
|
450
|
+
|
451
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_nil.rb#27
|
452
|
+
RuboCop::Cop::Minitest::AssertNil::ASSERTION_TYPE = T.let(T.unsafe(nil), String)
|
453
|
+
|
454
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_nil.rb#28
|
455
|
+
RuboCop::Cop::Minitest::AssertNil::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
456
|
+
|
457
|
+
# Checks for opportunities to use `assert_output`.
|
458
|
+
#
|
459
|
+
# @example
|
460
|
+
# # bad
|
461
|
+
# $stdout = StringIO.new
|
462
|
+
# puts object.method
|
463
|
+
# $stdout.rewind
|
464
|
+
# assert_match expected, $stdout.read
|
465
|
+
#
|
466
|
+
# # good
|
467
|
+
# assert_output(expected) { puts object.method }
|
468
|
+
#
|
469
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_output.rb#18
|
470
|
+
class RuboCop::Cop::Minitest::AssertOutput < ::RuboCop::Cop::Base
|
471
|
+
include ::RuboCop::Cop::VisibilityHelp
|
472
|
+
include ::RuboCop::Cop::DefNode
|
473
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
474
|
+
|
475
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_output.rb#24
|
476
|
+
def on_gvasgn(node); end
|
477
|
+
|
478
|
+
private
|
479
|
+
|
480
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_output.rb#38
|
481
|
+
def find_test_case(node); end
|
482
|
+
|
483
|
+
# @return [Boolean]
|
484
|
+
#
|
485
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_output.rb#43
|
486
|
+
def references_gvar?(assertion, gvar_name); end
|
487
|
+
end
|
488
|
+
|
489
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_output.rb#21
|
490
|
+
RuboCop::Cop::Minitest::AssertOutput::MSG = T.let(T.unsafe(nil), String)
|
491
|
+
|
492
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_output.rb#22
|
493
|
+
RuboCop::Cop::Minitest::AssertOutput::OUTPUT_GLOBAL_VARIABLES = T.let(T.unsafe(nil), Array)
|
494
|
+
|
495
|
+
# Enforces the test to use `assert_path_exists` instead of using `assert(File.exist?(path))`.
|
496
|
+
#
|
497
|
+
# @example
|
498
|
+
# # bad
|
499
|
+
# assert(File.exist?(path))
|
500
|
+
# assert(File.exist?(path), 'message')
|
501
|
+
#
|
502
|
+
# # good
|
503
|
+
# assert_path_exists(path)
|
504
|
+
# assert_path_exists(path, 'message')
|
505
|
+
#
|
506
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_path_exists.rb#17
|
507
|
+
class RuboCop::Cop::Minitest::AssertPathExists < ::RuboCop::Cop::Base
|
508
|
+
extend ::RuboCop::Cop::AutoCorrector
|
509
|
+
|
510
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_path_exists.rb#23
|
511
|
+
def assert_file_exists(param0 = T.unsafe(nil)); end
|
512
|
+
|
513
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_path_exists.rb#30
|
514
|
+
def on_send(node); end
|
515
|
+
|
516
|
+
private
|
517
|
+
|
518
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_path_exists.rb#44
|
519
|
+
def build_good_method(path, message); end
|
520
|
+
end
|
521
|
+
|
522
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_path_exists.rb#20
|
523
|
+
RuboCop::Cop::Minitest::AssertPathExists::MSG = T.let(T.unsafe(nil), String)
|
524
|
+
|
525
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_path_exists.rb#21
|
526
|
+
RuboCop::Cop::Minitest::AssertPathExists::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
527
|
+
|
528
|
+
# Enforces the test to use `assert_predicate`
|
529
|
+
# instead of using `assert(obj.a_predicate_method?)`.
|
530
|
+
#
|
531
|
+
# @example
|
532
|
+
# # bad
|
533
|
+
# assert(obj.one?)
|
534
|
+
# assert(obj.one?, 'message')
|
535
|
+
#
|
536
|
+
# # good
|
537
|
+
# assert_predicate(obj, :one?)
|
538
|
+
# assert_predicate(obj, :one?, 'message')
|
539
|
+
#
|
540
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_predicate.rb#18
|
541
|
+
class RuboCop::Cop::Minitest::AssertPredicate < ::RuboCop::Cop::Base
|
542
|
+
include ::RuboCop::Cop::RangeHelp
|
543
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
544
|
+
include ::RuboCop::Cop::Minitest::PredicateAssertionHandleable
|
545
|
+
extend ::RuboCop::Cop::AutoCorrector
|
546
|
+
|
547
|
+
private
|
548
|
+
|
549
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_predicate.rb#28
|
550
|
+
def assertion_type; end
|
551
|
+
end
|
552
|
+
|
553
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_predicate.rb#23
|
554
|
+
RuboCop::Cop::Minitest::AssertPredicate::MSG = T.let(T.unsafe(nil), String)
|
555
|
+
|
556
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_predicate.rb#24
|
557
|
+
RuboCop::Cop::Minitest::AssertPredicate::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
558
|
+
|
559
|
+
# Enforces the block body of `assert_raises { ... }` to be reduced to only the raising code.
|
560
|
+
#
|
561
|
+
# @example
|
562
|
+
# # bad
|
563
|
+
# assert_raises(MyError) do
|
564
|
+
# foo
|
565
|
+
# bar
|
566
|
+
# end
|
567
|
+
#
|
568
|
+
# # good
|
569
|
+
# assert_raises(MyError) do
|
570
|
+
# foo
|
571
|
+
# end
|
572
|
+
#
|
573
|
+
# # good
|
574
|
+
# assert_raises(MyError) do
|
575
|
+
# foo do
|
576
|
+
# bar
|
577
|
+
# baz
|
578
|
+
# end
|
579
|
+
# end
|
580
|
+
#
|
581
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_raises_compound_body.rb#28
|
582
|
+
class RuboCop::Cop::Minitest::AssertRaisesCompoundBody < ::RuboCop::Cop::Base
|
583
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_raises_compound_body.rb#31
|
584
|
+
def on_block(node); end
|
585
|
+
|
586
|
+
private
|
587
|
+
|
588
|
+
# @return [Boolean]
|
589
|
+
#
|
590
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_raises_compound_body.rb#39
|
591
|
+
def multi_statement_begin?(node); end
|
592
|
+
end
|
593
|
+
|
594
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_raises_compound_body.rb#29
|
595
|
+
RuboCop::Cop::Minitest::AssertRaisesCompoundBody::MSG = T.let(T.unsafe(nil), String)
|
596
|
+
|
597
|
+
# Checks for `assert_raises` with arguments of regular expression literals.
|
598
|
+
# Arguments should be exception classes.
|
599
|
+
# Optionally the last argument can be a custom message string to help explain failures.
|
600
|
+
# Either way, it's not the argument that `exception.message` is compared to.
|
601
|
+
# The raised exception is returned and can be used
|
602
|
+
# to match against a regular expression.
|
603
|
+
#
|
604
|
+
# @example
|
605
|
+
#
|
606
|
+
# # bad
|
607
|
+
# assert_raises FooError, /some message/ do
|
608
|
+
# obj.occur_error
|
609
|
+
# end
|
610
|
+
#
|
611
|
+
# # good
|
612
|
+
# exception = assert_raises FooError do
|
613
|
+
# obj.occur_error
|
614
|
+
# end
|
615
|
+
# assert_match(/some message/, exception.message)
|
616
|
+
#
|
617
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_raises_with_regexp_argument.rb#26
|
618
|
+
class RuboCop::Cop::Minitest::AssertRaisesWithRegexpArgument < ::RuboCop::Cop::Base
|
619
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_raises_with_regexp_argument.rb#30
|
620
|
+
def on_send(node); end
|
621
|
+
end
|
622
|
+
|
623
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_raises_with_regexp_argument.rb#27
|
624
|
+
RuboCop::Cop::Minitest::AssertRaisesWithRegexpArgument::MSG = T.let(T.unsafe(nil), String)
|
625
|
+
|
626
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_raises_with_regexp_argument.rb#28
|
627
|
+
RuboCop::Cop::Minitest::AssertRaisesWithRegexpArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
628
|
+
|
629
|
+
# Enforces the use of `assert_respond_to(object, :do_something)`
|
630
|
+
# over `assert(object.respond_to?(:do_something))`.
|
631
|
+
#
|
632
|
+
# @example
|
633
|
+
# # bad
|
634
|
+
# assert(object.respond_to?(:do_something))
|
635
|
+
# assert(object.respond_to?(:do_something), 'message')
|
636
|
+
# assert(respond_to?(:do_something))
|
637
|
+
#
|
638
|
+
# # good
|
639
|
+
# assert_respond_to(object, :do_something)
|
640
|
+
# assert_respond_to(object, :do_something, 'message')
|
641
|
+
# assert_respond_to(self, :do_something)
|
642
|
+
#
|
643
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_respond_to.rb#20
|
644
|
+
class RuboCop::Cop::Minitest::AssertRespondTo < ::RuboCop::Cop::Base
|
645
|
+
include ::RuboCop::Cop::RangeHelp
|
646
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
647
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
648
|
+
extend ::RuboCop::Cop::AutoCorrector
|
649
|
+
|
650
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
651
|
+
def autocorrect(corrector, node, arguments); end
|
652
|
+
|
653
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
654
|
+
def on_send(node); end
|
655
|
+
|
656
|
+
private
|
657
|
+
|
658
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
659
|
+
def correct_receiver(receiver); end
|
660
|
+
|
661
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
662
|
+
def enclosed_in_redundant_parentheses?(node); end
|
663
|
+
|
664
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
665
|
+
def new_arguments(arguments); end
|
666
|
+
|
667
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
668
|
+
def offense_message(arguments); end
|
669
|
+
|
670
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
671
|
+
def peel_redundant_parentheses_from(arguments); end
|
672
|
+
end
|
673
|
+
|
674
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
675
|
+
RuboCop::Cop::Minitest::AssertRespondTo::MSG = T.let(T.unsafe(nil), String)
|
676
|
+
|
677
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
678
|
+
RuboCop::Cop::Minitest::AssertRespondTo::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
679
|
+
|
680
|
+
# Enforces the use of `assert_same(expected, actual)`
|
681
|
+
# over `assert(expected.equal?(actual))`.
|
682
|
+
#
|
683
|
+
# NOTE: Use `assert_same` only when there is a need to compare by identity.
|
684
|
+
# Otherwise, use `assert_equal`.
|
685
|
+
#
|
686
|
+
# @example
|
687
|
+
# # bad
|
688
|
+
# assert(expected.equal?(actual))
|
689
|
+
#
|
690
|
+
# # good
|
691
|
+
# assert_same(expected, actual)
|
692
|
+
#
|
693
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_same.rb#19
|
694
|
+
class RuboCop::Cop::Minitest::AssertSame < ::RuboCop::Cop::Base
|
695
|
+
include ::RuboCop::Cop::RangeHelp
|
696
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
697
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
698
|
+
extend ::RuboCop::Cop::AutoCorrector
|
699
|
+
|
700
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
701
|
+
def autocorrect(corrector, node, arguments); end
|
702
|
+
|
703
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
704
|
+
def on_send(node); end
|
705
|
+
|
706
|
+
private
|
707
|
+
|
708
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
709
|
+
def correct_receiver(receiver); end
|
710
|
+
|
711
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
712
|
+
def enclosed_in_redundant_parentheses?(node); end
|
713
|
+
|
714
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
715
|
+
def new_arguments(arguments); end
|
716
|
+
|
717
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
718
|
+
def offense_message(arguments); end
|
719
|
+
|
720
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
721
|
+
def peel_redundant_parentheses_from(arguments); end
|
722
|
+
end
|
723
|
+
|
724
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
725
|
+
RuboCop::Cop::Minitest::AssertSame::MSG = T.let(T.unsafe(nil), String)
|
726
|
+
|
727
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
728
|
+
RuboCop::Cop::Minitest::AssertSame::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
729
|
+
|
730
|
+
# Enforces the test to use `assert_silent { ... }`
|
731
|
+
# instead of using `assert_output('', '') { ... }`.
|
732
|
+
#
|
733
|
+
# @example
|
734
|
+
# # bad
|
735
|
+
# assert_output('', '') { puts object.do_something }
|
736
|
+
#
|
737
|
+
# # good
|
738
|
+
# assert_silent { puts object.do_something }
|
739
|
+
#
|
740
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_silent.rb#16
|
741
|
+
class RuboCop::Cop::Minitest::AssertSilent < ::RuboCop::Cop::Base
|
742
|
+
extend ::RuboCop::Cop::AutoCorrector
|
743
|
+
|
744
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_silent.rb#21
|
745
|
+
def assert_silent_candidate?(param0 = T.unsafe(nil)); end
|
746
|
+
|
747
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_silent.rb#29
|
748
|
+
def on_block(node); end
|
749
|
+
|
750
|
+
private
|
751
|
+
|
752
|
+
# @return [Boolean]
|
753
|
+
#
|
754
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_silent.rb#41
|
755
|
+
def empty_string?(node); end
|
756
|
+
end
|
757
|
+
|
758
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_silent.rb#19
|
759
|
+
RuboCop::Cop::Minitest::AssertSilent::MSG = T.let(T.unsafe(nil), String)
|
760
|
+
|
761
|
+
# Enforces the test to use `assert(actual)` instead of using `assert_equal(true, actual)`.
|
762
|
+
#
|
763
|
+
# @example
|
764
|
+
# # bad
|
765
|
+
# assert_equal(true, actual)
|
766
|
+
# assert_equal(true, actual, 'message')
|
767
|
+
#
|
768
|
+
# # good
|
769
|
+
# assert(actual)
|
770
|
+
# assert(actual, 'message')
|
771
|
+
#
|
772
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_truthy.rb#27
|
773
|
+
class RuboCop::Cop::Minitest::AssertTruthy < ::RuboCop::Cop::Base
|
774
|
+
include ::RuboCop::Cop::RangeHelp
|
775
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
776
|
+
extend ::RuboCop::Cop::AutoCorrector
|
777
|
+
|
778
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_truthy.rb#34
|
779
|
+
def assert_equal_with_truthy(param0 = T.unsafe(nil)); end
|
780
|
+
|
781
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_truthy.rb#38
|
782
|
+
def on_send(node); end
|
783
|
+
end
|
784
|
+
|
785
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_truthy.rb#31
|
786
|
+
RuboCop::Cop::Minitest::AssertTruthy::MSG = T.let(T.unsafe(nil), String)
|
787
|
+
|
788
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_truthy.rb#32
|
789
|
+
RuboCop::Cop::Minitest::AssertTruthy::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
790
|
+
|
791
|
+
# Tries to detect when a user accidentally used
|
792
|
+
# `assert` when they meant to use `assert_equal`.
|
793
|
+
#
|
794
|
+
# NOTE: The second argument to the `assert` method named `message` and `msg` is allowed.
|
795
|
+
# Because their names are inferred as message arguments.
|
796
|
+
#
|
797
|
+
# @example
|
798
|
+
# # bad
|
799
|
+
# assert(3, my_list.length)
|
800
|
+
# assert(expected, actual)
|
801
|
+
#
|
802
|
+
# # good
|
803
|
+
# assert_equal(3, my_list.length)
|
804
|
+
# assert_equal(expected, actual)
|
805
|
+
# assert(foo, 'message')
|
806
|
+
# assert(foo, message)
|
807
|
+
# assert(foo, msg)
|
808
|
+
#
|
809
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_with_expected_argument.rb#28
|
810
|
+
class RuboCop::Cop::Minitest::AssertWithExpectedArgument < ::RuboCop::Cop::Base
|
811
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_with_expected_argument.rb#33
|
812
|
+
def assert_with_two_arguments?(param0 = T.unsafe(nil)); end
|
813
|
+
|
814
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_with_expected_argument.rb#37
|
815
|
+
def on_send(node); end
|
816
|
+
end
|
817
|
+
|
818
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_with_expected_argument.rb#31
|
819
|
+
RuboCop::Cop::Minitest::AssertWithExpectedArgument::MESSAGE_VARIABLES = T.let(T.unsafe(nil), Array)
|
820
|
+
|
821
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_with_expected_argument.rb#29
|
822
|
+
RuboCop::Cop::Minitest::AssertWithExpectedArgument::MSG = T.let(T.unsafe(nil), String)
|
823
|
+
|
824
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assert_with_expected_argument.rb#30
|
825
|
+
RuboCop::Cop::Minitest::AssertWithExpectedArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
826
|
+
|
827
|
+
# Checks for usage of assertions in lifecycle hooks.
|
828
|
+
#
|
829
|
+
# @example
|
830
|
+
# # bad
|
831
|
+
# class FooTest < Minitest::Test
|
832
|
+
# def setup
|
833
|
+
# assert_equal(foo, bar)
|
834
|
+
# end
|
835
|
+
# end
|
836
|
+
#
|
837
|
+
# # good
|
838
|
+
# class FooTest < Minitest::Test
|
839
|
+
# def test_something
|
840
|
+
# assert_equal(foo, bar)
|
841
|
+
# end
|
842
|
+
# end
|
843
|
+
#
|
844
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assertion_in_lifecycle_hook.rb#23
|
845
|
+
class RuboCop::Cop::Minitest::AssertionInLifecycleHook < ::RuboCop::Cop::Base
|
846
|
+
include ::RuboCop::Cop::VisibilityHelp
|
847
|
+
include ::RuboCop::Cop::DefNode
|
848
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
849
|
+
|
850
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assertion_in_lifecycle_hook.rb#28
|
851
|
+
def on_class(class_node); end
|
852
|
+
end
|
853
|
+
|
854
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/assertion_in_lifecycle_hook.rb#26
|
855
|
+
RuboCop::Cop::Minitest::AssertionInLifecycleHook::MSG = T.let(T.unsafe(nil), String)
|
856
|
+
|
857
|
+
# If a Minitest class inherits from another class,
|
858
|
+
# it will also inherit its methods causing Minitest to run the parent's tests methods twice.
|
859
|
+
#
|
860
|
+
# This cop detects when there are two tests classes, one inherits from the other, and both have tests methods.
|
861
|
+
# This cop will add an offense to the Child class in such a case.
|
862
|
+
#
|
863
|
+
# @example
|
864
|
+
# # bad
|
865
|
+
# class ParentTest < Minitest::Test
|
866
|
+
# def test_parent # it will run this test twice.
|
867
|
+
# end
|
868
|
+
# end
|
869
|
+
#
|
870
|
+
# class ChildTest < ParentTest
|
871
|
+
# def test_child
|
872
|
+
# end
|
873
|
+
# end
|
874
|
+
#
|
875
|
+
# # good
|
876
|
+
# class ParentTest < Minitest::Test
|
877
|
+
# def test_parent
|
878
|
+
# end
|
879
|
+
# end
|
880
|
+
#
|
881
|
+
# class ChildTest < Minitest::Test
|
882
|
+
# def test_child
|
883
|
+
# end
|
884
|
+
# end
|
885
|
+
#
|
886
|
+
# # good
|
887
|
+
# class ParentTest < Minitest::Test
|
888
|
+
# end
|
889
|
+
#
|
890
|
+
# class ChildTest
|
891
|
+
# def test_child
|
892
|
+
# end
|
893
|
+
#
|
894
|
+
# def test_parent
|
895
|
+
# end
|
896
|
+
# end
|
897
|
+
#
|
898
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/duplicate_test_run.rb#48
|
899
|
+
class RuboCop::Cop::Minitest::DuplicateTestRun < ::RuboCop::Cop::Base
|
900
|
+
include ::RuboCop::Cop::VisibilityHelp
|
901
|
+
include ::RuboCop::Cop::DefNode
|
902
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
903
|
+
|
904
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/duplicate_test_run.rb#53
|
905
|
+
def on_class(class_node); end
|
906
|
+
|
907
|
+
private
|
908
|
+
|
909
|
+
# @return [Boolean]
|
910
|
+
#
|
911
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/duplicate_test_run.rb#64
|
912
|
+
def parent_class_has_test_methods?(class_node); end
|
913
|
+
|
914
|
+
# @return [Boolean]
|
915
|
+
#
|
916
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/duplicate_test_run.rb#78
|
917
|
+
def test_methods?(class_node); end
|
918
|
+
end
|
919
|
+
|
920
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/duplicate_test_run.rb#51
|
921
|
+
RuboCop::Cop::Minitest::DuplicateTestRun::MSG = T.let(T.unsafe(nil), String)
|
922
|
+
|
923
|
+
# Enforces empty line before assertion methods because it separates assertion phase.
|
924
|
+
#
|
925
|
+
# @example
|
926
|
+
#
|
927
|
+
# # bad
|
928
|
+
# do_something
|
929
|
+
# assert_equal(expected, actual)
|
930
|
+
#
|
931
|
+
# # good
|
932
|
+
# do_something
|
933
|
+
#
|
934
|
+
# assert_equal(expected, actual)
|
935
|
+
#
|
936
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#19
|
937
|
+
class RuboCop::Cop::Minitest::EmptyLineBeforeAssertionMethods < ::RuboCop::Cop::Base
|
938
|
+
include ::RuboCop::Cop::VisibilityHelp
|
939
|
+
include ::RuboCop::Cop::DefNode
|
940
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
941
|
+
include ::RuboCop::Cop::RangeHelp
|
942
|
+
extend ::RuboCop::Cop::AutoCorrector
|
943
|
+
|
944
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#27
|
945
|
+
def on_send(node); end
|
946
|
+
|
947
|
+
private
|
948
|
+
|
949
|
+
# @return [Boolean]
|
950
|
+
#
|
951
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#52
|
952
|
+
def accept_previous_line?(previous_line_node, node); end
|
953
|
+
|
954
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#43
|
955
|
+
def assertion_method(node); end
|
956
|
+
|
957
|
+
# @return [Boolean]
|
958
|
+
#
|
959
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#73
|
960
|
+
def heredoc?(last_argument); end
|
961
|
+
|
962
|
+
# @return [Boolean]
|
963
|
+
#
|
964
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#77
|
965
|
+
def no_empty_line?(previous_line_node, node); end
|
966
|
+
|
967
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#87
|
968
|
+
def register_offense(node, previous_line_node); end
|
969
|
+
|
970
|
+
# @return [Boolean]
|
971
|
+
#
|
972
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#63
|
973
|
+
def use_assertion_method_at_last_of_block?(node); end
|
974
|
+
|
975
|
+
# @return [Boolean]
|
976
|
+
#
|
977
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#59
|
978
|
+
def use_heredoc_argument?(node); end
|
979
|
+
end
|
980
|
+
|
981
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/empty_line_before_assertion_methods.rb#24
|
982
|
+
RuboCop::Cop::Minitest::EmptyLineBeforeAssertionMethods::MSG = T.let(T.unsafe(nil), String)
|
983
|
+
|
984
|
+
# Checks for deprecated global expectations
|
985
|
+
# and autocorrects them to use expect format.
|
986
|
+
#
|
987
|
+
# @example EnforcedStyle: any (default)
|
988
|
+
# # bad
|
989
|
+
# musts.must_equal expected_musts
|
990
|
+
# wonts.wont_match expected_wonts
|
991
|
+
# musts.must_raise TypeError
|
992
|
+
#
|
993
|
+
# # good
|
994
|
+
# _(musts).must_equal expected_musts
|
995
|
+
# _(wonts).wont_match expected_wonts
|
996
|
+
# _ { musts }.must_raise TypeError
|
997
|
+
#
|
998
|
+
# expect(musts).must_equal expected_musts
|
999
|
+
# expect(wonts).wont_match expected_wonts
|
1000
|
+
# expect { musts }.must_raise TypeError
|
1001
|
+
#
|
1002
|
+
# value(musts).must_equal expected_musts
|
1003
|
+
# value(wonts).wont_match expected_wonts
|
1004
|
+
# value { musts }.must_raise TypeError
|
1005
|
+
# @example EnforcedStyle: _
|
1006
|
+
# # bad
|
1007
|
+
# musts.must_equal expected_musts
|
1008
|
+
# wonts.wont_match expected_wonts
|
1009
|
+
# musts.must_raise TypeError
|
1010
|
+
#
|
1011
|
+
# expect(musts).must_equal expected_musts
|
1012
|
+
# expect(wonts).wont_match expected_wonts
|
1013
|
+
# expect { musts }.must_raise TypeError
|
1014
|
+
#
|
1015
|
+
# value(musts).must_equal expected_musts
|
1016
|
+
# value(wonts).wont_match expected_wonts
|
1017
|
+
# value { musts }.must_raise TypeError
|
1018
|
+
#
|
1019
|
+
# # good
|
1020
|
+
# _(musts).must_equal expected_musts
|
1021
|
+
# _(wonts).wont_match expected_wonts
|
1022
|
+
# _ { musts }.must_raise TypeError
|
1023
|
+
# @example EnforcedStyle: expect
|
1024
|
+
# # bad
|
1025
|
+
# musts.must_equal expected_musts
|
1026
|
+
# wonts.wont_match expected_wonts
|
1027
|
+
# musts.must_raise TypeError
|
1028
|
+
#
|
1029
|
+
# _(musts).must_equal expected_musts
|
1030
|
+
# _(wonts).wont_match expected_wonts
|
1031
|
+
# _ { musts }.must_raise TypeError
|
1032
|
+
#
|
1033
|
+
# value(musts).must_equal expected_musts
|
1034
|
+
# value(wonts).wont_match expected_wonts
|
1035
|
+
# value { musts }.must_raise TypeError
|
1036
|
+
#
|
1037
|
+
# # good
|
1038
|
+
# expect(musts).must_equal expected_musts
|
1039
|
+
# expect(wonts).wont_match expected_wonts
|
1040
|
+
# expect { musts }.must_raise TypeError
|
1041
|
+
# @example EnforcedStyle: value
|
1042
|
+
# # bad
|
1043
|
+
# musts.must_equal expected_musts
|
1044
|
+
# wonts.wont_match expected_wonts
|
1045
|
+
# musts.must_raise TypeError
|
1046
|
+
#
|
1047
|
+
# _(musts).must_equal expected_musts
|
1048
|
+
# _(wonts).wont_match expected_wonts
|
1049
|
+
# _ { musts }.must_raise TypeError
|
1050
|
+
#
|
1051
|
+
# expect(musts).must_equal expected_musts
|
1052
|
+
# expect(wonts).wont_match expected_wonts
|
1053
|
+
# expect { musts }.must_raise TypeError
|
1054
|
+
#
|
1055
|
+
# # good
|
1056
|
+
# value(musts).must_equal expected_musts
|
1057
|
+
# value(wonts).wont_match expected_wonts
|
1058
|
+
# value { musts }.must_raise TypeError
|
1059
|
+
#
|
1060
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#84
|
1061
|
+
class RuboCop::Cop::Minitest::GlobalExpectations < ::RuboCop::Cop::Base
|
1062
|
+
include ::RuboCop::Cop::ConfigurableEnforcedStyle
|
1063
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1064
|
+
|
1065
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#118
|
1066
|
+
def block_receiver?(param0 = T.unsafe(nil)); end
|
1067
|
+
|
1068
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#106
|
1069
|
+
def on_send(node); end
|
1070
|
+
|
1071
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#122
|
1072
|
+
def value_receiver?(param0 = T.unsafe(nil)); end
|
1073
|
+
|
1074
|
+
private
|
1075
|
+
|
1076
|
+
# @return [Boolean]
|
1077
|
+
#
|
1078
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#126
|
1079
|
+
def method_allowed?(method); end
|
1080
|
+
|
1081
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#130
|
1082
|
+
def preferred_method; end
|
1083
|
+
|
1084
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#134
|
1085
|
+
def preferred_receiver(node); end
|
1086
|
+
|
1087
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#145
|
1088
|
+
def register_offense(node, method); end
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#99
|
1092
|
+
RuboCop::Cop::Minitest::GlobalExpectations::BLOCK_MATCHERS = T.let(T.unsafe(nil), Array)
|
1093
|
+
|
1094
|
+
# There are aliases for the `_` method - `expect` and `value`
|
1095
|
+
#
|
1096
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#104
|
1097
|
+
RuboCop::Cop::Minitest::GlobalExpectations::DSL_METHODS = T.let(T.unsafe(nil), Array)
|
1098
|
+
|
1099
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#88
|
1100
|
+
RuboCop::Cop::Minitest::GlobalExpectations::MSG = T.let(T.unsafe(nil), String)
|
1101
|
+
|
1102
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#101
|
1103
|
+
RuboCop::Cop::Minitest::GlobalExpectations::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1104
|
+
|
1105
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/global_expectations.rb#90
|
1106
|
+
RuboCop::Cop::Minitest::GlobalExpectations::VALUE_MATCHERS = T.let(T.unsafe(nil), Array)
|
1107
|
+
|
1108
|
+
# Enforces correct order of expected and
|
1109
|
+
# actual arguments for `assert_equal`.
|
1110
|
+
#
|
1111
|
+
# @example
|
1112
|
+
# # bad
|
1113
|
+
# assert_equal foo, 2
|
1114
|
+
# assert_equal foo, [1, 2]
|
1115
|
+
# assert_equal foo, [1, 2], 'message'
|
1116
|
+
#
|
1117
|
+
# # good
|
1118
|
+
# assert_equal 2, foo
|
1119
|
+
# assert_equal [1, 2], foo
|
1120
|
+
# assert_equal [1, 2], foo, 'message'
|
1121
|
+
#
|
1122
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/literal_as_actual_argument.rb#20
|
1123
|
+
class RuboCop::Cop::Minitest::LiteralAsActualArgument < ::RuboCop::Cop::Base
|
1124
|
+
include ::RuboCop::Cop::RangeHelp
|
1125
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1126
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1127
|
+
|
1128
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/literal_as_actual_argument.rb#39
|
1129
|
+
def autocorrect(corrector, node, expected, actual, message); end
|
1130
|
+
|
1131
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/literal_as_actual_argument.rb#27
|
1132
|
+
def on_send(node); end
|
1133
|
+
end
|
1134
|
+
|
1135
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/literal_as_actual_argument.rb#24
|
1136
|
+
RuboCop::Cop::Minitest::LiteralAsActualArgument::MSG = T.let(T.unsafe(nil), String)
|
1137
|
+
|
1138
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/literal_as_actual_argument.rb#25
|
1139
|
+
RuboCop::Cop::Minitest::LiteralAsActualArgument::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1140
|
+
|
1141
|
+
# Checks if test cases contain too many assertion calls.
|
1142
|
+
# The maximum allowed assertion calls is configurable.
|
1143
|
+
#
|
1144
|
+
# @example Max: 1
|
1145
|
+
# # bad
|
1146
|
+
# class FooTest < Minitest::Test
|
1147
|
+
# def test_asserts_twice
|
1148
|
+
# assert_equal(42, do_something)
|
1149
|
+
# assert_empty(array)
|
1150
|
+
# end
|
1151
|
+
# end
|
1152
|
+
#
|
1153
|
+
# # good
|
1154
|
+
# class FooTest < Minitest::Test
|
1155
|
+
# def test_asserts_once
|
1156
|
+
# assert_equal(42, do_something)
|
1157
|
+
# end
|
1158
|
+
#
|
1159
|
+
# def test_another_asserts_once
|
1160
|
+
# assert_empty(array)
|
1161
|
+
# end
|
1162
|
+
# end
|
1163
|
+
#
|
1164
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/multiple_assertions.rb#29
|
1165
|
+
class RuboCop::Cop::Minitest::MultipleAssertions < ::RuboCop::Cop::Base
|
1166
|
+
include ::RuboCop::Cop::ConfigurableMax
|
1167
|
+
include ::RuboCop::Cop::VisibilityHelp
|
1168
|
+
include ::RuboCop::Cop::DefNode
|
1169
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
1170
|
+
|
1171
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/multiple_assertions.rb#35
|
1172
|
+
def on_class(class_node); end
|
1173
|
+
|
1174
|
+
private
|
1175
|
+
|
1176
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/multiple_assertions.rb#52
|
1177
|
+
def max_assertions; end
|
1178
|
+
end
|
1179
|
+
|
1180
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/multiple_assertions.rb#33
|
1181
|
+
RuboCop::Cop::Minitest::MultipleAssertions::MSG = T.let(T.unsafe(nil), String)
|
1182
|
+
|
1183
|
+
# Common functionality for `AssertNil` and `RefuteNil` cops.
|
1184
|
+
#
|
1185
|
+
# @api private
|
1186
|
+
#
|
1187
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/nil_assertion_handleable.rb#8
|
1188
|
+
module RuboCop::Cop::Minitest::NilAssertionHandleable
|
1189
|
+
private
|
1190
|
+
|
1191
|
+
# @api private
|
1192
|
+
#
|
1193
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/nil_assertion_handleable.rb#35
|
1194
|
+
def autocorrect(corrector, node, actual); end
|
1195
|
+
|
1196
|
+
# @api private
|
1197
|
+
#
|
1198
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/nil_assertion_handleable.rb#21
|
1199
|
+
def build_message(node, actual, message); end
|
1200
|
+
|
1201
|
+
# @api private
|
1202
|
+
# @return [Boolean]
|
1203
|
+
#
|
1204
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/nil_assertion_handleable.rb#45
|
1205
|
+
def comparison_or_predicate_assertion_method?(node); end
|
1206
|
+
|
1207
|
+
# @api private
|
1208
|
+
#
|
1209
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/nil_assertion_handleable.rb#13
|
1210
|
+
def register_offense(node, actual, message); end
|
1211
|
+
end
|
1212
|
+
|
1213
|
+
# @api private
|
1214
|
+
#
|
1215
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/nil_assertion_handleable.rb#9
|
1216
|
+
RuboCop::Cop::Minitest::NilAssertionHandleable::MSG = T.let(T.unsafe(nil), String)
|
1217
|
+
|
1218
|
+
# Checks if test cases contain any assertion calls.
|
1219
|
+
#
|
1220
|
+
# @example
|
1221
|
+
# # bad
|
1222
|
+
# class FooTest < Minitest::Test
|
1223
|
+
# def test_the_truth
|
1224
|
+
# end
|
1225
|
+
# end
|
1226
|
+
#
|
1227
|
+
# # good
|
1228
|
+
# class FooTest < Minitest::Test
|
1229
|
+
# def test_the_truth
|
1230
|
+
# assert true
|
1231
|
+
# end
|
1232
|
+
# end
|
1233
|
+
#
|
1234
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/no_assertions.rb#22
|
1235
|
+
class RuboCop::Cop::Minitest::NoAssertions < ::RuboCop::Cop::Base
|
1236
|
+
include ::RuboCop::Cop::VisibilityHelp
|
1237
|
+
include ::RuboCop::Cop::DefNode
|
1238
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
1239
|
+
|
1240
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/no_assertions.rb#27
|
1241
|
+
def on_class(class_node); end
|
1242
|
+
end
|
1243
|
+
|
1244
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/no_assertions.rb#25
|
1245
|
+
RuboCop::Cop::Minitest::NoAssertions::MSG = T.let(T.unsafe(nil), String)
|
1246
|
+
|
1247
|
+
# Detects non `public` (marked as `private` or `protected`) test methods.
|
1248
|
+
# Minitest runs only test methods which are `public`.
|
1249
|
+
#
|
1250
|
+
# @example
|
1251
|
+
# # bad
|
1252
|
+
# class FooTest
|
1253
|
+
# private # or protected
|
1254
|
+
# def test_does_something
|
1255
|
+
# assert_equal 42, do_something
|
1256
|
+
# end
|
1257
|
+
# end
|
1258
|
+
#
|
1259
|
+
# # good
|
1260
|
+
# class FooTest
|
1261
|
+
# def test_does_something
|
1262
|
+
# assert_equal 42, do_something
|
1263
|
+
# end
|
1264
|
+
# end
|
1265
|
+
#
|
1266
|
+
# # good (not a test case name)
|
1267
|
+
# class FooTest
|
1268
|
+
# private # or protected
|
1269
|
+
# def does_something
|
1270
|
+
# assert_equal 42, do_something
|
1271
|
+
# end
|
1272
|
+
# end
|
1273
|
+
#
|
1274
|
+
# # good (no assertions)
|
1275
|
+
# class FooTest
|
1276
|
+
# private # or protected
|
1277
|
+
# def test_does_something
|
1278
|
+
# do_something
|
1279
|
+
# end
|
1280
|
+
# end
|
1281
|
+
#
|
1282
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/non_public_test_method.rb#41
|
1283
|
+
class RuboCop::Cop::Minitest::NonPublicTestMethod < ::RuboCop::Cop::Base
|
1284
|
+
include ::RuboCop::Cop::VisibilityHelp
|
1285
|
+
include ::RuboCop::Cop::DefNode
|
1286
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
1287
|
+
|
1288
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/non_public_test_method.rb#47
|
1289
|
+
def on_class(node); end
|
1290
|
+
end
|
1291
|
+
|
1292
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/non_public_test_method.rb#45
|
1293
|
+
RuboCop::Cop::Minitest::NonPublicTestMethod::MSG = T.let(T.unsafe(nil), String)
|
1294
|
+
|
1295
|
+
# Common functionality for `Minitest/AssertPredicate` and `Minitest/RefutePredicate` cops.
|
1296
|
+
#
|
1297
|
+
# @api private
|
1298
|
+
#
|
1299
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/predicate_assertion_handleable.rb#8
|
1300
|
+
module RuboCop::Cop::Minitest::PredicateAssertionHandleable
|
1301
|
+
# @api private
|
1302
|
+
#
|
1303
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/predicate_assertion_handleable.rb#26
|
1304
|
+
def autocorrect(corrector, node, arguments); end
|
1305
|
+
|
1306
|
+
# @api private
|
1307
|
+
#
|
1308
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/predicate_assertion_handleable.rb#11
|
1309
|
+
def on_send(node); end
|
1310
|
+
|
1311
|
+
private
|
1312
|
+
|
1313
|
+
# @api private
|
1314
|
+
#
|
1315
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/predicate_assertion_handleable.rb#61
|
1316
|
+
def correct_receiver(receiver); end
|
1317
|
+
|
1318
|
+
# @api private
|
1319
|
+
#
|
1320
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/predicate_assertion_handleable.rb#54
|
1321
|
+
def new_arguments(arguments); end
|
1322
|
+
|
1323
|
+
# @api private
|
1324
|
+
#
|
1325
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/predicate_assertion_handleable.rb#46
|
1326
|
+
def offense_message(arguments); end
|
1327
|
+
|
1328
|
+
# @api private
|
1329
|
+
#
|
1330
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/predicate_assertion_handleable.rb#36
|
1331
|
+
def peel_redundant_parentheses_from(arguments); end
|
1332
|
+
|
1333
|
+
# @api private
|
1334
|
+
# @return [Boolean]
|
1335
|
+
#
|
1336
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/predicate_assertion_handleable.rb#42
|
1337
|
+
def predicate_method?(first_argument); end
|
1338
|
+
end
|
1339
|
+
|
1340
|
+
# @api private
|
1341
|
+
#
|
1342
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/predicate_assertion_handleable.rb#9
|
1343
|
+
RuboCop::Cop::Minitest::PredicateAssertionHandleable::MSG = T.let(T.unsafe(nil), String)
|
1344
|
+
|
1345
|
+
# Enforces to use `refute_empty` instead of using `refute(object.empty?)`.
|
1346
|
+
#
|
1347
|
+
# @example
|
1348
|
+
# # bad
|
1349
|
+
# refute(object.empty?)
|
1350
|
+
# refute(object.empty?, 'message')
|
1351
|
+
#
|
1352
|
+
# # good
|
1353
|
+
# refute_empty(object)
|
1354
|
+
# refute_empty(object, 'message')
|
1355
|
+
#
|
1356
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_empty.rb#17
|
1357
|
+
class RuboCop::Cop::Minitest::RefuteEmpty < ::RuboCop::Cop::Base
|
1358
|
+
include ::RuboCop::Cop::RangeHelp
|
1359
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1360
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
1361
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1362
|
+
|
1363
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
1364
|
+
def autocorrect(corrector, node, arguments); end
|
1365
|
+
|
1366
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_empty.rb#23
|
1367
|
+
def on_send(node); end
|
1368
|
+
|
1369
|
+
private
|
1370
|
+
|
1371
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
1372
|
+
def correct_receiver(receiver); end
|
1373
|
+
|
1374
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
1375
|
+
def enclosed_in_redundant_parentheses?(node); end
|
1376
|
+
|
1377
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
1378
|
+
def new_arguments(arguments); end
|
1379
|
+
|
1380
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
1381
|
+
def offense_message(arguments); end
|
1382
|
+
|
1383
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
1384
|
+
def peel_redundant_parentheses_from(arguments); end
|
1385
|
+
end
|
1386
|
+
|
1387
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
1388
|
+
RuboCop::Cop::Minitest::RefuteEmpty::MSG = T.let(T.unsafe(nil), String)
|
1389
|
+
|
1390
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
1391
|
+
RuboCop::Cop::Minitest::RefuteEmpty::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1392
|
+
|
1393
|
+
# Enforces the use of `refute_equal(expected, object)`
|
1394
|
+
# over `assert(expected != actual)` or `assert(! expected == actual)`.
|
1395
|
+
#
|
1396
|
+
# @example
|
1397
|
+
# # bad
|
1398
|
+
# assert("rubocop-minitest" != actual)
|
1399
|
+
# assert(! "rubocop-minitest" == actual)
|
1400
|
+
#
|
1401
|
+
# # good
|
1402
|
+
# refute_equal("rubocop-minitest", actual)
|
1403
|
+
#
|
1404
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_equal.rb#17
|
1405
|
+
class RuboCop::Cop::Minitest::RefuteEqual < ::RuboCop::Cop::Base
|
1406
|
+
include ::RuboCop::Cop::RangeHelp
|
1407
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1408
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1409
|
+
|
1410
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_equal.rb#24
|
1411
|
+
def assert_not_equal(param0 = T.unsafe(nil)); end
|
1412
|
+
|
1413
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_equal.rb#28
|
1414
|
+
def on_send(node); end
|
1415
|
+
|
1416
|
+
private
|
1417
|
+
|
1418
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_equal.rb#50
|
1419
|
+
def original_usage(first_part, custom_message); end
|
1420
|
+
|
1421
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_equal.rb#46
|
1422
|
+
def preferred_usage(first_arg, second_arg, custom_message = T.unsafe(nil)); end
|
1423
|
+
|
1424
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_equal.rb#54
|
1425
|
+
def process_not_equal(node); end
|
1426
|
+
end
|
1427
|
+
|
1428
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_equal.rb#21
|
1429
|
+
RuboCop::Cop::Minitest::RefuteEqual::MSG = T.let(T.unsafe(nil), String)
|
1430
|
+
|
1431
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_equal.rb#22
|
1432
|
+
RuboCop::Cop::Minitest::RefuteEqual::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1433
|
+
|
1434
|
+
# Enforces the use of `refute(object)` over `assert_equal(false, object)`.
|
1435
|
+
#
|
1436
|
+
# @example
|
1437
|
+
# # bad
|
1438
|
+
# assert_equal(false, actual)
|
1439
|
+
# assert_equal(false, actual, 'message')
|
1440
|
+
#
|
1441
|
+
# assert(!test)
|
1442
|
+
# assert(!test, 'message')
|
1443
|
+
#
|
1444
|
+
# # good
|
1445
|
+
# refute(actual)
|
1446
|
+
# refute(actual, 'message')
|
1447
|
+
#
|
1448
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_false.rb#30
|
1449
|
+
class RuboCop::Cop::Minitest::RefuteFalse < ::RuboCop::Cop::Base
|
1450
|
+
include ::RuboCop::Cop::RangeHelp
|
1451
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1452
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1453
|
+
|
1454
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_false.rb#38
|
1455
|
+
def assert_equal_with_false(param0 = T.unsafe(nil)); end
|
1456
|
+
|
1457
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_false.rb#42
|
1458
|
+
def assert_with_bang_argument(param0 = T.unsafe(nil)); end
|
1459
|
+
|
1460
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_false.rb#46
|
1461
|
+
def on_send(node); end
|
1462
|
+
|
1463
|
+
private
|
1464
|
+
|
1465
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_false.rb#63
|
1466
|
+
def autocorrect(corrector, node, actual); end
|
1467
|
+
end
|
1468
|
+
|
1469
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_false.rb#35
|
1470
|
+
RuboCop::Cop::Minitest::RefuteFalse::MSG_FOR_ASSERT = T.let(T.unsafe(nil), String)
|
1471
|
+
|
1472
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_false.rb#34
|
1473
|
+
RuboCop::Cop::Minitest::RefuteFalse::MSG_FOR_ASSERT_EQUAL = T.let(T.unsafe(nil), String)
|
1474
|
+
|
1475
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_false.rb#36
|
1476
|
+
RuboCop::Cop::Minitest::RefuteFalse::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1477
|
+
|
1478
|
+
# Enforces the test to use `refute_in_delta`
|
1479
|
+
# instead of using `refute_equal` to compare floats.
|
1480
|
+
#
|
1481
|
+
# @example
|
1482
|
+
# # bad
|
1483
|
+
# refute_equal(0.2, actual)
|
1484
|
+
# refute_equal(0.2, actual, 'message')
|
1485
|
+
#
|
1486
|
+
# # good
|
1487
|
+
# refute_in_delta(0.2, actual)
|
1488
|
+
# refute_in_delta(0.2, actual, 0.001, 'message')
|
1489
|
+
#
|
1490
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_in_delta.rb#18
|
1491
|
+
class RuboCop::Cop::Minitest::RefuteInDelta < ::RuboCop::Cop::Base
|
1492
|
+
include ::RuboCop::Cop::InDeltaMixin
|
1493
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1494
|
+
|
1495
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_in_delta.rb#24
|
1496
|
+
def equal_floats_call(param0 = T.unsafe(nil)); end
|
1497
|
+
end
|
1498
|
+
|
1499
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_in_delta.rb#22
|
1500
|
+
RuboCop::Cop::Minitest::RefuteInDelta::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1501
|
+
|
1502
|
+
# Enforces the test to use `refute_includes`
|
1503
|
+
# instead of using `refute(collection.include?(object))`.
|
1504
|
+
#
|
1505
|
+
# @example
|
1506
|
+
# # bad
|
1507
|
+
# refute(collection.include?(object))
|
1508
|
+
# refute(collection.include?(object), 'message')
|
1509
|
+
#
|
1510
|
+
# # good
|
1511
|
+
# refute_includes(collection, object)
|
1512
|
+
# refute_includes(collection, object, 'message')
|
1513
|
+
#
|
1514
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_includes.rb#18
|
1515
|
+
class RuboCop::Cop::Minitest::RefuteIncludes < ::RuboCop::Cop::Base
|
1516
|
+
include ::RuboCop::Cop::RangeHelp
|
1517
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1518
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
1519
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1520
|
+
|
1521
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
1522
|
+
def autocorrect(corrector, node, arguments); end
|
1523
|
+
|
1524
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
1525
|
+
def on_send(node); end
|
1526
|
+
|
1527
|
+
private
|
1528
|
+
|
1529
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
1530
|
+
def correct_receiver(receiver); end
|
1531
|
+
|
1532
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
1533
|
+
def enclosed_in_redundant_parentheses?(node); end
|
1534
|
+
|
1535
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
1536
|
+
def new_arguments(arguments); end
|
1537
|
+
|
1538
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
1539
|
+
def offense_message(arguments); end
|
1540
|
+
|
1541
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
1542
|
+
def peel_redundant_parentheses_from(arguments); end
|
1543
|
+
end
|
1544
|
+
|
1545
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
1546
|
+
RuboCop::Cop::Minitest::RefuteIncludes::MSG = T.let(T.unsafe(nil), String)
|
1547
|
+
|
1548
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
1549
|
+
RuboCop::Cop::Minitest::RefuteIncludes::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1550
|
+
|
1551
|
+
# Enforces the use of `refute_instance_of(Class, object)`
|
1552
|
+
# over `refute(object.instance_of?(Class))`.
|
1553
|
+
#
|
1554
|
+
# @example
|
1555
|
+
# # bad
|
1556
|
+
# refute(object.instance_of?(Class))
|
1557
|
+
# refute(object.instance_of?(Class), 'message')
|
1558
|
+
#
|
1559
|
+
# # good
|
1560
|
+
# refute_instance_of(Class, object)
|
1561
|
+
# refute_instance_of(Class, object, 'message')
|
1562
|
+
#
|
1563
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_instance_of.rb#18
|
1564
|
+
class RuboCop::Cop::Minitest::RefuteInstanceOf < ::RuboCop::Cop::Base
|
1565
|
+
include ::RuboCop::Cop::RangeHelp
|
1566
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1567
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
1568
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1569
|
+
|
1570
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
1571
|
+
def autocorrect(corrector, node, arguments); end
|
1572
|
+
|
1573
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
1574
|
+
def on_send(node); end
|
1575
|
+
|
1576
|
+
private
|
1577
|
+
|
1578
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
1579
|
+
def correct_receiver(receiver); end
|
1580
|
+
|
1581
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
1582
|
+
def enclosed_in_redundant_parentheses?(node); end
|
1583
|
+
|
1584
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
1585
|
+
def new_arguments(arguments); end
|
1586
|
+
|
1587
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
1588
|
+
def offense_message(arguments); end
|
1589
|
+
|
1590
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
1591
|
+
def peel_redundant_parentheses_from(arguments); end
|
1592
|
+
end
|
1593
|
+
|
1594
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
1595
|
+
RuboCop::Cop::Minitest::RefuteInstanceOf::MSG = T.let(T.unsafe(nil), String)
|
1596
|
+
|
1597
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
1598
|
+
RuboCop::Cop::Minitest::RefuteInstanceOf::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1599
|
+
|
1600
|
+
# Enforces the use of `refute_kind_of(Class, object)`
|
1601
|
+
# over `refute(object.kind_of?(Class))`.
|
1602
|
+
#
|
1603
|
+
# @example
|
1604
|
+
# # bad
|
1605
|
+
# refute(object.kind_of?(Class))
|
1606
|
+
# refute(object.kind_of?(Class), 'message')
|
1607
|
+
#
|
1608
|
+
# # good
|
1609
|
+
# refute_kind_of(Class, object)
|
1610
|
+
# refute_kind_of(Class, object, 'message')
|
1611
|
+
#
|
1612
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_kind_of.rb#18
|
1613
|
+
class RuboCop::Cop::Minitest::RefuteKindOf < ::RuboCop::Cop::Base
|
1614
|
+
include ::RuboCop::Cop::RangeHelp
|
1615
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1616
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
1617
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1618
|
+
|
1619
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
1620
|
+
def autocorrect(corrector, node, arguments); end
|
1621
|
+
|
1622
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
1623
|
+
def on_send(node); end
|
1624
|
+
|
1625
|
+
private
|
1626
|
+
|
1627
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
1628
|
+
def correct_receiver(receiver); end
|
1629
|
+
|
1630
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
1631
|
+
def enclosed_in_redundant_parentheses?(node); end
|
1632
|
+
|
1633
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
1634
|
+
def new_arguments(arguments); end
|
1635
|
+
|
1636
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
1637
|
+
def offense_message(arguments); end
|
1638
|
+
|
1639
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
1640
|
+
def peel_redundant_parentheses_from(arguments); end
|
1641
|
+
end
|
1642
|
+
|
1643
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
1644
|
+
RuboCop::Cop::Minitest::RefuteKindOf::MSG = T.let(T.unsafe(nil), String)
|
1645
|
+
|
1646
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
1647
|
+
RuboCop::Cop::Minitest::RefuteKindOf::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1648
|
+
|
1649
|
+
# Enforces the test to use `refute_match`
|
1650
|
+
# instead of using `refute(matcher.match(string))`.
|
1651
|
+
#
|
1652
|
+
# @example
|
1653
|
+
# # bad
|
1654
|
+
# refute(matcher.match(string))
|
1655
|
+
# refute(matcher.match(string), 'message')
|
1656
|
+
#
|
1657
|
+
# # good
|
1658
|
+
# refute_match(matcher, string)
|
1659
|
+
# refute_match(matcher, string, 'message')
|
1660
|
+
#
|
1661
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_match.rb#18
|
1662
|
+
class RuboCop::Cop::Minitest::RefuteMatch < ::RuboCop::Cop::Base
|
1663
|
+
include ::RuboCop::Cop::RangeHelp
|
1664
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1665
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
1666
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1667
|
+
|
1668
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
1669
|
+
def autocorrect(corrector, node, arguments); end
|
1670
|
+
|
1671
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
1672
|
+
def on_send(node); end
|
1673
|
+
|
1674
|
+
private
|
1675
|
+
|
1676
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
1677
|
+
def correct_receiver(receiver); end
|
1678
|
+
|
1679
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
1680
|
+
def enclosed_in_redundant_parentheses?(node); end
|
1681
|
+
|
1682
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
1683
|
+
def new_arguments(arguments); end
|
1684
|
+
|
1685
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
1686
|
+
def offense_message(arguments); end
|
1687
|
+
|
1688
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
1689
|
+
def peel_redundant_parentheses_from(arguments); end
|
1690
|
+
end
|
1691
|
+
|
1692
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
1693
|
+
RuboCop::Cop::Minitest::RefuteMatch::MSG = T.let(T.unsafe(nil), String)
|
1694
|
+
|
1695
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
1696
|
+
RuboCop::Cop::Minitest::RefuteMatch::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1697
|
+
|
1698
|
+
# Enforces the test to use `refute_nil` instead of using
|
1699
|
+
# `refute_equal(nil, something)`, `refute(something.nil?)`, or `refute_predicate(something, :nil?)`.
|
1700
|
+
#
|
1701
|
+
# @example
|
1702
|
+
# # bad
|
1703
|
+
# refute_equal(nil, actual)
|
1704
|
+
# refute_equal(nil, actual, 'message')
|
1705
|
+
# refute(actual.nil?)
|
1706
|
+
# refute(actual.nil?, 'message')
|
1707
|
+
# refute_predicate(object, :nil?)
|
1708
|
+
# refute_predicate(object, :nil?, 'message')
|
1709
|
+
#
|
1710
|
+
# # good
|
1711
|
+
# refute_nil(actual)
|
1712
|
+
# refute_nil(actual, 'message')
|
1713
|
+
#
|
1714
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_nil.rb#22
|
1715
|
+
class RuboCop::Cop::Minitest::RefuteNil < ::RuboCop::Cop::Base
|
1716
|
+
include ::RuboCop::Cop::RangeHelp
|
1717
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1718
|
+
include ::RuboCop::Cop::Minitest::NilAssertionHandleable
|
1719
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1720
|
+
|
1721
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_nil.rb#30
|
1722
|
+
def nil_refutation(param0 = T.unsafe(nil)); end
|
1723
|
+
|
1724
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_nil.rb#38
|
1725
|
+
def on_send(node); end
|
1726
|
+
|
1727
|
+
private
|
1728
|
+
|
1729
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_nil.rb#46
|
1730
|
+
def assertion_type; end
|
1731
|
+
end
|
1732
|
+
|
1733
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_nil.rb#27
|
1734
|
+
RuboCop::Cop::Minitest::RefuteNil::ASSERTION_TYPE = T.let(T.unsafe(nil), String)
|
1735
|
+
|
1736
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_nil.rb#28
|
1737
|
+
RuboCop::Cop::Minitest::RefuteNil::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1738
|
+
|
1739
|
+
# Enforces the test to use `refute_path_exists` instead of using `refute(File.exist?(path))`.
|
1740
|
+
#
|
1741
|
+
# @example
|
1742
|
+
# # bad
|
1743
|
+
# refute(File.exist?(path))
|
1744
|
+
# refute(File.exist?(path), 'message')
|
1745
|
+
#
|
1746
|
+
# # good
|
1747
|
+
# refute_path_exists(path)
|
1748
|
+
# refute_path_exists(path, 'message')
|
1749
|
+
#
|
1750
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_path_exists.rb#17
|
1751
|
+
class RuboCop::Cop::Minitest::RefutePathExists < ::RuboCop::Cop::Base
|
1752
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1753
|
+
|
1754
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_path_exists.rb#30
|
1755
|
+
def on_send(node); end
|
1756
|
+
|
1757
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_path_exists.rb#23
|
1758
|
+
def refute_file_exists(param0 = T.unsafe(nil)); end
|
1759
|
+
|
1760
|
+
private
|
1761
|
+
|
1762
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_path_exists.rb#44
|
1763
|
+
def build_good_method(path, message); end
|
1764
|
+
end
|
1765
|
+
|
1766
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_path_exists.rb#20
|
1767
|
+
RuboCop::Cop::Minitest::RefutePathExists::MSG = T.let(T.unsafe(nil), String)
|
1768
|
+
|
1769
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_path_exists.rb#21
|
1770
|
+
RuboCop::Cop::Minitest::RefutePathExists::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1771
|
+
|
1772
|
+
# Enforces the test to use `refute_predicate`
|
1773
|
+
# instead of using `refute(obj.a_predicate_method?)`.
|
1774
|
+
#
|
1775
|
+
# @example
|
1776
|
+
# # bad
|
1777
|
+
# refute(obj.one?)
|
1778
|
+
# refute(obj.one?, 'message')
|
1779
|
+
#
|
1780
|
+
# # good
|
1781
|
+
# refute_predicate(obj, :one?)
|
1782
|
+
# refute_predicate(obj, :one?, 'message')
|
1783
|
+
#
|
1784
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_predicate.rb#18
|
1785
|
+
class RuboCop::Cop::Minitest::RefutePredicate < ::RuboCop::Cop::Base
|
1786
|
+
include ::RuboCop::Cop::RangeHelp
|
1787
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1788
|
+
include ::RuboCop::Cop::Minitest::PredicateAssertionHandleable
|
1789
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1790
|
+
|
1791
|
+
private
|
1792
|
+
|
1793
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_predicate.rb#28
|
1794
|
+
def assertion_type; end
|
1795
|
+
end
|
1796
|
+
|
1797
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_predicate.rb#23
|
1798
|
+
RuboCop::Cop::Minitest::RefutePredicate::MSG = T.let(T.unsafe(nil), String)
|
1799
|
+
|
1800
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_predicate.rb#24
|
1801
|
+
RuboCop::Cop::Minitest::RefutePredicate::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1802
|
+
|
1803
|
+
# Enforces the test to use `refute_respond_to(object, :do_something)`
|
1804
|
+
# over `refute(object.respond_to?(:do_something))`.
|
1805
|
+
#
|
1806
|
+
# @example
|
1807
|
+
# # bad
|
1808
|
+
# refute(object.respond_to?(:do_something))
|
1809
|
+
# refute(object.respond_to?(:do_something), 'message')
|
1810
|
+
# refute(respond_to?(:do_something))
|
1811
|
+
#
|
1812
|
+
# # good
|
1813
|
+
# refute_respond_to(object, :do_something)
|
1814
|
+
# refute_respond_to(object, :do_something, 'message')
|
1815
|
+
# refute_respond_to(self, :do_something)
|
1816
|
+
#
|
1817
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_respond_to.rb#20
|
1818
|
+
class RuboCop::Cop::Minitest::RefuteRespondTo < ::RuboCop::Cop::Base
|
1819
|
+
include ::RuboCop::Cop::RangeHelp
|
1820
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1821
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
1822
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1823
|
+
|
1824
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
1825
|
+
def autocorrect(corrector, node, arguments); end
|
1826
|
+
|
1827
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
1828
|
+
def on_send(node); end
|
1829
|
+
|
1830
|
+
private
|
1831
|
+
|
1832
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
1833
|
+
def correct_receiver(receiver); end
|
1834
|
+
|
1835
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
1836
|
+
def enclosed_in_redundant_parentheses?(node); end
|
1837
|
+
|
1838
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
1839
|
+
def new_arguments(arguments); end
|
1840
|
+
|
1841
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
1842
|
+
def offense_message(arguments); end
|
1843
|
+
|
1844
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
1845
|
+
def peel_redundant_parentheses_from(arguments); end
|
1846
|
+
end
|
1847
|
+
|
1848
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
1849
|
+
RuboCop::Cop::Minitest::RefuteRespondTo::MSG = T.let(T.unsafe(nil), String)
|
1850
|
+
|
1851
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
1852
|
+
RuboCop::Cop::Minitest::RefuteRespondTo::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1853
|
+
|
1854
|
+
# Enforces the use of `refute_same(expected, object)`
|
1855
|
+
# over `refute(expected.equal?(actual))`.
|
1856
|
+
#
|
1857
|
+
# NOTE: Use `refute_same` only when there is a need to compare by identity.
|
1858
|
+
# Otherwise, use `refute_equal`.
|
1859
|
+
#
|
1860
|
+
# @example
|
1861
|
+
# # bad
|
1862
|
+
# refute(expected.equal?(actual))
|
1863
|
+
#
|
1864
|
+
# # good
|
1865
|
+
# refute_same(expected, actual)
|
1866
|
+
#
|
1867
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/refute_same.rb#19
|
1868
|
+
class RuboCop::Cop::Minitest::RefuteSame < ::RuboCop::Cop::Base
|
1869
|
+
include ::RuboCop::Cop::RangeHelp
|
1870
|
+
include ::RuboCop::Cop::ArgumentRangeHelper
|
1871
|
+
extend ::RuboCop::Cop::MinitestCopRule
|
1872
|
+
extend ::RuboCop::Cop::AutoCorrector
|
1873
|
+
|
1874
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#47
|
1875
|
+
def autocorrect(corrector, node, arguments); end
|
1876
|
+
|
1877
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#36
|
1878
|
+
def on_send(node); end
|
1879
|
+
|
1880
|
+
private
|
1881
|
+
|
1882
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#99
|
1883
|
+
def correct_receiver(receiver); end
|
1884
|
+
|
1885
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#95
|
1886
|
+
def enclosed_in_redundant_parentheses?(node); end
|
1887
|
+
|
1888
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#81
|
1889
|
+
def new_arguments(arguments); end
|
1890
|
+
|
1891
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#67
|
1892
|
+
def offense_message(arguments); end
|
1893
|
+
|
1894
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#61
|
1895
|
+
def peel_redundant_parentheses_from(arguments); end
|
1896
|
+
end
|
1897
|
+
|
1898
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#33
|
1899
|
+
RuboCop::Cop::Minitest::RefuteSame::MSG = T.let(T.unsafe(nil), String)
|
1900
|
+
|
1901
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#34
|
1902
|
+
RuboCop::Cop::Minitest::RefuteSame::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
1903
|
+
|
1904
|
+
# Checks that `ensure` call even if `skip`. It is unexpected that `ensure` will be called when skipping test.
|
1905
|
+
# If conditional `skip` is used, it checks that `ensure` is also called conditionally.
|
1906
|
+
#
|
1907
|
+
# On the other hand, it accepts `skip` used in `rescue` because `ensure` may be teardown process to `begin`
|
1908
|
+
# setup process.
|
1909
|
+
#
|
1910
|
+
# @example
|
1911
|
+
#
|
1912
|
+
# # bad
|
1913
|
+
# def test_skip
|
1914
|
+
# skip 'This test is skipped.'
|
1915
|
+
#
|
1916
|
+
# assert 'foo'.present?
|
1917
|
+
# ensure
|
1918
|
+
# do_something
|
1919
|
+
# end
|
1920
|
+
#
|
1921
|
+
# # bad
|
1922
|
+
# def test_conditional_skip
|
1923
|
+
# skip 'This test is skipped.' if condition
|
1924
|
+
#
|
1925
|
+
# assert do_something
|
1926
|
+
# ensure
|
1927
|
+
# do_teardown
|
1928
|
+
# end
|
1929
|
+
#
|
1930
|
+
# # good
|
1931
|
+
# def test_skip
|
1932
|
+
# skip 'This test is skipped.'
|
1933
|
+
#
|
1934
|
+
# begin
|
1935
|
+
# assert 'foo'.present?
|
1936
|
+
# ensure
|
1937
|
+
# do_something
|
1938
|
+
# end
|
1939
|
+
# end
|
1940
|
+
#
|
1941
|
+
# # good
|
1942
|
+
# def test_conditional_skip
|
1943
|
+
# skip 'This test is skipped.' if condition
|
1944
|
+
#
|
1945
|
+
# assert do_something
|
1946
|
+
# ensure
|
1947
|
+
# if condition
|
1948
|
+
# do_teardown
|
1949
|
+
# end
|
1950
|
+
# end
|
1951
|
+
#
|
1952
|
+
# # good
|
1953
|
+
# def test_skip_is_used_in_rescue
|
1954
|
+
# do_setup
|
1955
|
+
# assert do_something
|
1956
|
+
# rescue
|
1957
|
+
# skip 'This test is skipped.'
|
1958
|
+
# ensure
|
1959
|
+
# do_teardown
|
1960
|
+
# end
|
1961
|
+
#
|
1962
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_ensure.rb#64
|
1963
|
+
class RuboCop::Cop::Minitest::SkipEnsure < ::RuboCop::Cop::Base
|
1964
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_ensure.rb#67
|
1965
|
+
def on_ensure(node); end
|
1966
|
+
|
1967
|
+
private
|
1968
|
+
|
1969
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_ensure.rb#77
|
1970
|
+
def find_skip(node); end
|
1971
|
+
|
1972
|
+
# @return [Boolean]
|
1973
|
+
#
|
1974
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_ensure.rb#81
|
1975
|
+
def use_skip_in_rescue?(skip_method); end
|
1976
|
+
|
1977
|
+
# @return [Boolean]
|
1978
|
+
#
|
1979
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_ensure.rb#85
|
1980
|
+
def valid_conditional_skip?(skip_method, ensure_node); end
|
1981
|
+
end
|
1982
|
+
|
1983
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_ensure.rb#65
|
1984
|
+
RuboCop::Cop::Minitest::SkipEnsure::MSG = T.let(T.unsafe(nil), String)
|
1985
|
+
|
1986
|
+
# Checks for skipped tests missing the skipping reason.
|
1987
|
+
#
|
1988
|
+
# @example
|
1989
|
+
# # bad
|
1990
|
+
# skip
|
1991
|
+
# skip('')
|
1992
|
+
#
|
1993
|
+
# # bad
|
1994
|
+
# if condition?
|
1995
|
+
# skip
|
1996
|
+
# else
|
1997
|
+
# skip
|
1998
|
+
# end
|
1999
|
+
#
|
2000
|
+
# # good
|
2001
|
+
# skip("Reason why the test was skipped")
|
2002
|
+
#
|
2003
|
+
# # good
|
2004
|
+
# skip if condition?
|
2005
|
+
#
|
2006
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_without_reason.rb#26
|
2007
|
+
class RuboCop::Cop::Minitest::SkipWithoutReason < ::RuboCop::Cop::Base
|
2008
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_without_reason.rb#31
|
2009
|
+
def on_send(node); end
|
2010
|
+
|
2011
|
+
private
|
2012
|
+
|
2013
|
+
# @return [Boolean]
|
2014
|
+
#
|
2015
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_without_reason.rb#44
|
2016
|
+
def blank_argument?(node); end
|
2017
|
+
|
2018
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_without_reason.rb#49
|
2019
|
+
def conditional_parent(node); end
|
2020
|
+
|
2021
|
+
# @return [Boolean]
|
2022
|
+
#
|
2023
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_without_reason.rb#59
|
2024
|
+
def only_skip_branches?(node); end
|
2025
|
+
end
|
2026
|
+
|
2027
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_without_reason.rb#27
|
2028
|
+
RuboCop::Cop::Minitest::SkipWithoutReason::MSG = T.let(T.unsafe(nil), String)
|
2029
|
+
|
2030
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/skip_without_reason.rb#29
|
2031
|
+
RuboCop::Cop::Minitest::SkipWithoutReason::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
2032
|
+
|
2033
|
+
# Checks if test file names start with `test_` or end with `_test.rb`.
|
2034
|
+
# Files which define classes having names ending with `Test` are checked.
|
2035
|
+
# Not following this convention may result in tests not being run.
|
2036
|
+
#
|
2037
|
+
# @example
|
2038
|
+
# # bad
|
2039
|
+
# my_class.rb
|
2040
|
+
#
|
2041
|
+
# # good
|
2042
|
+
# my_class_test.rb
|
2043
|
+
# test_my_class.rb
|
2044
|
+
#
|
2045
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_file_name.rb#18
|
2046
|
+
class RuboCop::Cop::Minitest::TestFileName < ::RuboCop::Cop::Base
|
2047
|
+
include ::RuboCop::Cop::VisibilityHelp
|
2048
|
+
include ::RuboCop::Cop::DefNode
|
2049
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
2050
|
+
|
2051
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_file_name.rb#23
|
2052
|
+
def on_new_investigation; end
|
2053
|
+
|
2054
|
+
private
|
2055
|
+
|
2056
|
+
# @return [Boolean]
|
2057
|
+
#
|
2058
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_file_name.rb#32
|
2059
|
+
def test_file?(node); end
|
2060
|
+
|
2061
|
+
# @return [Boolean]
|
2062
|
+
#
|
2063
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_file_name.rb#38
|
2064
|
+
def valid_file_name?; end
|
2065
|
+
end
|
2066
|
+
|
2067
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_file_name.rb#21
|
2068
|
+
RuboCop::Cop::Minitest::TestFileName::MSG = T.let(T.unsafe(nil), String)
|
2069
|
+
|
2070
|
+
# Enforces that test method names start with `test_` prefix.
|
2071
|
+
# It aims to prevent tests that aren't executed by forgetting to start test method name with `test_`.
|
2072
|
+
#
|
2073
|
+
# @example
|
2074
|
+
# # bad
|
2075
|
+
# class FooTest < Minitest::Test
|
2076
|
+
# def does_something
|
2077
|
+
# assert_equal 42, do_something
|
2078
|
+
# end
|
2079
|
+
# end
|
2080
|
+
#
|
2081
|
+
# # good
|
2082
|
+
# class FooTest < Minitest::Test
|
2083
|
+
# def test_does_something
|
2084
|
+
# assert_equal 42, do_something
|
2085
|
+
# end
|
2086
|
+
# end
|
2087
|
+
#
|
2088
|
+
# # good
|
2089
|
+
# class FooTest < Minitest::Test
|
2090
|
+
# def helper_method(argument)
|
2091
|
+
# end
|
2092
|
+
# end
|
2093
|
+
#
|
2094
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_method_name.rb#30
|
2095
|
+
class RuboCop::Cop::Minitest::TestMethodName < ::RuboCop::Cop::Base
|
2096
|
+
include ::RuboCop::Cop::VisibilityHelp
|
2097
|
+
include ::RuboCop::Cop::DefNode
|
2098
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
2099
|
+
extend ::RuboCop::Cop::AutoCorrector
|
2100
|
+
|
2101
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_method_name.rb#37
|
2102
|
+
def on_class(class_node); end
|
2103
|
+
|
2104
|
+
private
|
2105
|
+
|
2106
|
+
# @return [Boolean]
|
2107
|
+
#
|
2108
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_method_name.rb#53
|
2109
|
+
def offense?(node); end
|
2110
|
+
|
2111
|
+
# @return [Boolean]
|
2112
|
+
#
|
2113
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_method_name.rb#59
|
2114
|
+
def public?(node); end
|
2115
|
+
|
2116
|
+
# @return [Boolean]
|
2117
|
+
#
|
2118
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_method_name.rb#63
|
2119
|
+
def test_method_name?(node); end
|
2120
|
+
end
|
2121
|
+
|
2122
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/test_method_name.rb#35
|
2123
|
+
RuboCop::Cop::Minitest::TestMethodName::MSG = T.let(T.unsafe(nil), String)
|
2124
|
+
|
2125
|
+
# Checks for `assert_raises` has an assertion method at
|
2126
|
+
# the bottom of block because the assertion will be never reached.
|
2127
|
+
#
|
2128
|
+
# @example
|
2129
|
+
#
|
2130
|
+
# # bad
|
2131
|
+
# assert_raises FooError do
|
2132
|
+
# obj.occur_error
|
2133
|
+
# assert_equal('foo', obj.bar) # Never asserted.
|
2134
|
+
# end
|
2135
|
+
#
|
2136
|
+
# # good
|
2137
|
+
# assert_raises FooError do
|
2138
|
+
# obj.occur_error
|
2139
|
+
# end
|
2140
|
+
# assert_equal('foo', obj.bar)
|
2141
|
+
#
|
2142
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/unreachable_assertion.rb#23
|
2143
|
+
class RuboCop::Cop::Minitest::UnreachableAssertion < ::RuboCop::Cop::Base
|
2144
|
+
include ::RuboCop::Cop::VisibilityHelp
|
2145
|
+
include ::RuboCop::Cop::DefNode
|
2146
|
+
include ::RuboCop::Cop::MinitestExplorationHelpers
|
2147
|
+
|
2148
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/unreachable_assertion.rb#28
|
2149
|
+
def on_block(node); end
|
2150
|
+
end
|
2151
|
+
|
2152
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/unreachable_assertion.rb#26
|
2153
|
+
RuboCop::Cop::Minitest::UnreachableAssertion::MSG = T.let(T.unsafe(nil), String)
|
2154
|
+
|
2155
|
+
# Checks for a specified error in `assert_raises`.
|
2156
|
+
#
|
2157
|
+
# @example
|
2158
|
+
# # bad
|
2159
|
+
# assert_raises { raise FooException }
|
2160
|
+
# assert_raises('This should have raised') { raise FooException }
|
2161
|
+
#
|
2162
|
+
# # good
|
2163
|
+
# assert_raises(FooException) { raise FooException }
|
2164
|
+
# assert_raises(FooException, 'This should have raised') { raise FooException }
|
2165
|
+
#
|
2166
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/unspecified_exception.rb#17
|
2167
|
+
class RuboCop::Cop::Minitest::UnspecifiedException < ::RuboCop::Cop::Base
|
2168
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/unspecified_exception.rb#20
|
2169
|
+
def on_block(block_node); end
|
2170
|
+
|
2171
|
+
private
|
2172
|
+
|
2173
|
+
# @return [Boolean]
|
2174
|
+
#
|
2175
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/unspecified_exception.rb#29
|
2176
|
+
def unspecified_exception?(node); end
|
2177
|
+
end
|
2178
|
+
|
2179
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/unspecified_exception.rb#18
|
2180
|
+
RuboCop::Cop::Minitest::UnspecifiedException::MSG = T.let(T.unsafe(nil), String)
|
2181
|
+
|
2182
|
+
# Detects useless assertions (assertions that either always pass or always fail).
|
2183
|
+
#
|
2184
|
+
# @example
|
2185
|
+
# # bad
|
2186
|
+
# assert true
|
2187
|
+
# assert_equal @foo, @foo
|
2188
|
+
# assert_nil [foo, bar]
|
2189
|
+
#
|
2190
|
+
# # good
|
2191
|
+
# assert something
|
2192
|
+
# assert_equal foo, bar
|
2193
|
+
# assert_nil foo
|
2194
|
+
# assert false, "My message"
|
2195
|
+
#
|
2196
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/useless_assertion.rb#20
|
2197
|
+
class RuboCop::Cop::Minitest::UselessAssertion < ::RuboCop::Cop::Base
|
2198
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/useless_assertion.rb#35
|
2199
|
+
def on_send(node); end
|
2200
|
+
|
2201
|
+
private
|
2202
|
+
|
2203
|
+
# @return [Boolean]
|
2204
|
+
#
|
2205
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/useless_assertion.rb#67
|
2206
|
+
def empty_composite?(node); end
|
2207
|
+
|
2208
|
+
# @return [Boolean]
|
2209
|
+
#
|
2210
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/useless_assertion.rb#44
|
2211
|
+
def offense?(node); end
|
2212
|
+
end
|
2213
|
+
|
2214
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/useless_assertion.rb#21
|
2215
|
+
RuboCop::Cop::Minitest::UselessAssertion::MSG = T.let(T.unsafe(nil), String)
|
2216
|
+
|
2217
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/useless_assertion.rb#31
|
2218
|
+
RuboCop::Cop::Minitest::UselessAssertion::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array)
|
2219
|
+
|
2220
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/useless_assertion.rb#23
|
2221
|
+
RuboCop::Cop::Minitest::UselessAssertion::SINGLE_ASSERTION_ARGUMENT_METHODS = T.let(T.unsafe(nil), Array)
|
2222
|
+
|
2223
|
+
# source://rubocop-minitest//lib/rubocop/cop/minitest/useless_assertion.rb#26
|
2224
|
+
RuboCop::Cop::Minitest::UselessAssertion::TWO_ASSERTION_ARGUMENTS_METHODS = T.let(T.unsafe(nil), Array)
|
2225
|
+
|
2226
|
+
# Provide a method to define offense rule for Minitest cops.
|
2227
|
+
#
|
2228
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#6
|
2229
|
+
module RuboCop::Cop::MinitestCopRule
|
2230
|
+
# Define offense rule for Minitest cops.
|
2231
|
+
#
|
2232
|
+
# @api private
|
2233
|
+
# @example
|
2234
|
+
# define_rule :assert, target_method: :match
|
2235
|
+
# define_rule :refute, target_method: :match
|
2236
|
+
# define_rule :assert, target_method: :include?, preferred_method: :assert_includes
|
2237
|
+
# define_rule :assert, target_method: :instance_of?, inverse: true
|
2238
|
+
# @param assertion_method [Symbol] Assertion method like `assert` or `refute`.
|
2239
|
+
# @param target_method [Symbol] Method name offensed by assertion method arguments.
|
2240
|
+
# @param preferred_method [Symbol] An optional param. Custom method name replaced by
|
2241
|
+
# autocorrection. The preferred method name that connects
|
2242
|
+
# `assertion_method` and `target_method` with `_` is
|
2243
|
+
# the default name.
|
2244
|
+
# @param inverse [Boolean, String] An optional param. Order of arguments replaced by autocorrection.
|
2245
|
+
# If string is passed, it becomes a predicate method for the first argument node.
|
2246
|
+
#
|
2247
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_cop_rule.rb#26
|
2248
|
+
def define_rule(assertion_method, target_method:, preferred_method: T.unsafe(nil), inverse: T.unsafe(nil)); end
|
2249
|
+
end
|
2250
|
+
|
2251
|
+
# Helper methods for different explorations against test files and test cases.
|
2252
|
+
#
|
2253
|
+
# @api private
|
2254
|
+
#
|
2255
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#9
|
2256
|
+
module RuboCop::Cop::MinitestExplorationHelpers
|
2257
|
+
include ::RuboCop::Cop::VisibilityHelp
|
2258
|
+
include ::RuboCop::Cop::DefNode
|
2259
|
+
extend ::RuboCop::AST::NodePattern::Macros
|
2260
|
+
|
2261
|
+
private
|
2262
|
+
|
2263
|
+
# @api private
|
2264
|
+
# @return [Boolean]
|
2265
|
+
#
|
2266
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#95
|
2267
|
+
def assertion_method?(node); end
|
2268
|
+
|
2269
|
+
# @api private
|
2270
|
+
#
|
2271
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#75
|
2272
|
+
def assertions(def_node); end
|
2273
|
+
|
2274
|
+
# @api private
|
2275
|
+
#
|
2276
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#89
|
2277
|
+
def assertions_count(node); end
|
2278
|
+
|
2279
|
+
# @api private
|
2280
|
+
#
|
2281
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#60
|
2282
|
+
def class_def_nodes(class_node); end
|
2283
|
+
|
2284
|
+
# @api private
|
2285
|
+
# @return [Boolean]
|
2286
|
+
#
|
2287
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#106
|
2288
|
+
def lifecycle_hook_method?(node); end
|
2289
|
+
|
2290
|
+
# @api private
|
2291
|
+
#
|
2292
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#55
|
2293
|
+
def lifecycle_hooks(class_node); end
|
2294
|
+
|
2295
|
+
# @api private
|
2296
|
+
# @return [Boolean]
|
2297
|
+
#
|
2298
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#30
|
2299
|
+
def test_case?(node); end
|
2300
|
+
|
2301
|
+
# @api private
|
2302
|
+
# @return [Boolean]
|
2303
|
+
#
|
2304
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#71
|
2305
|
+
def test_case_name?(name); end
|
2306
|
+
|
2307
|
+
# @api private
|
2308
|
+
#
|
2309
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#37
|
2310
|
+
def test_cases(class_node, visibility_check: T.unsafe(nil)); end
|
2311
|
+
|
2312
|
+
# @api private
|
2313
|
+
# @return [Boolean]
|
2314
|
+
#
|
2315
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#26
|
2316
|
+
def test_class?(class_node); end
|
2317
|
+
|
2318
|
+
# @api private
|
2319
|
+
# @return [Boolean]
|
2320
|
+
#
|
2321
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#49
|
2322
|
+
def test_method?(def_node, visibility_check: T.unsafe(nil)); end
|
2323
|
+
end
|
2324
|
+
|
2325
|
+
# @api private
|
2326
|
+
#
|
2327
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#13
|
2328
|
+
RuboCop::Cop::MinitestExplorationHelpers::ASSERTION_PREFIXES = T.let(T.unsafe(nil), Array)
|
2329
|
+
|
2330
|
+
# @api private
|
2331
|
+
#
|
2332
|
+
# source://rubocop-minitest//lib/rubocop/cop/mixin/minitest_exploration_helpers.rb#15
|
2333
|
+
RuboCop::Cop::MinitestExplorationHelpers::LIFECYCLE_HOOK_METHODS = T.let(T.unsafe(nil), Set)
|
2334
|
+
|
2335
|
+
# RuboCop minitest project namespace
|
2336
|
+
#
|
2337
|
+
# source://rubocop-minitest//lib/rubocop/minitest.rb#5
|
2338
|
+
module RuboCop::Minitest; end
|
2339
|
+
|
2340
|
+
# source://rubocop-minitest//lib/rubocop/minitest.rb#8
|
2341
|
+
RuboCop::Minitest::CONFIG = T.let(T.unsafe(nil), Hash)
|
2342
|
+
|
2343
|
+
# source://rubocop-minitest//lib/rubocop/minitest.rb#7
|
2344
|
+
RuboCop::Minitest::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname)
|
2345
|
+
|
2346
|
+
# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
|
2347
|
+
# bit of our configuration.
|
2348
|
+
#
|
2349
|
+
# source://rubocop-minitest//lib/rubocop/minitest/inject.rb#7
|
2350
|
+
module RuboCop::Minitest::Inject
|
2351
|
+
class << self
|
2352
|
+
# source://rubocop-minitest//lib/rubocop/minitest/inject.rb#8
|
2353
|
+
def defaults!; end
|
2354
|
+
end
|
2355
|
+
end
|
2356
|
+
|
2357
|
+
# source://rubocop-minitest//lib/rubocop/minitest.rb#6
|
2358
|
+
RuboCop::Minitest::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname)
|
2359
|
+
|
2360
|
+
# This module holds the RuboCop Minitest version information.
|
2361
|
+
#
|
2362
|
+
# source://rubocop-minitest//lib/rubocop/minitest/version.rb#6
|
2363
|
+
module RuboCop::Minitest::Version
|
2364
|
+
class << self
|
2365
|
+
# source://rubocop-minitest//lib/rubocop/minitest/version.rb#9
|
2366
|
+
def document_version; end
|
2367
|
+
end
|
2368
|
+
end
|
2369
|
+
|
2370
|
+
# source://rubocop-minitest//lib/rubocop/minitest/version.rb#7
|
2371
|
+
RuboCop::Minitest::Version::STRING = T.let(T.unsafe(nil), String)
|