makandra-rubocop 4.2.0 → 5.2.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.
@@ -1,6 +1,10 @@
1
1
  require:
2
2
  - rubocop-rails
3
3
 
4
+ inherit_mode:
5
+ merge:
6
+ - Exclude
7
+
4
8
  AllCops:
5
9
  Exclude:
6
10
  - 'node_modules/**/*'
@@ -56,15 +60,33 @@ Rails/ActiveSupportAliases:
56
60
  Enabled: false
57
61
  VersionAdded: '0.48'
58
62
 
63
+ Rails/ApplicationController:
64
+ Description: 'Check that controllers subclass ApplicationController.'
65
+ Enabled: false # We have Controllers like `/jasmine` which do not inherit from ApplicationController
66
+ SafeAutoCorrect: false
67
+ VersionAdded: '2.4'
68
+ VersionChanged: '2.5'
69
+
59
70
  Rails/ApplicationJob:
60
71
  Description: 'Check that jobs subclass ApplicationJob.'
61
72
  Enabled: true
73
+ SafeAutoCorrect: false
62
74
  VersionAdded: '0.49'
75
+ VersionChanged: '2.5'
76
+
77
+ Rails/ApplicationMailer:
78
+ Description: 'Check that mailers subclass ApplicationMailer.'
79
+ Enabled: true
80
+ SafeAutoCorrect: false
81
+ VersionAdded: '2.4'
82
+ VersionChanged: '2.5'
63
83
 
64
84
  Rails/ApplicationRecord:
65
85
  Description: 'Check that models subclass ApplicationRecord.'
66
86
  Enabled: false # Because not all models are necessarily domain models (e.g. migration models for legacy databases)
87
+ SafeAutoCorrect: false
67
88
  VersionAdded: '0.49'
89
+ VersionChanged: '2.5'
68
90
 
69
91
  Rails/AssertNot:
70
92
  Description: 'Use `assert_not` instead of `assert !`.'
@@ -190,8 +212,8 @@ Rails/FilePath:
190
212
  Description: 'Use `Rails.root.join` for file path joining.'
191
213
  Enabled: false
192
214
  VersionAdded: '0.47'
193
- VersionChanged: '0.57'
194
- EnforcedStyle: arguments
215
+ VersionChanged: '2.4'
216
+ EnforcedStyle: slashes
195
217
  SupportedStyles:
196
218
  - slashes
197
219
  - arguments
@@ -260,6 +282,16 @@ Rails/IgnoredSkipActionFilterOption:
260
282
  Include:
261
283
  - app/controllers/**/*.rb
262
284
 
285
+ Rails/IndexBy:
286
+ Description: 'Prefer `index_by` over `each_with_object` or `map`.'
287
+ Enabled: true
288
+ VersionAdded: '2.5'
289
+
290
+ Rails/IndexWith:
291
+ Description: 'Prefer `index_with` over `each_with_object` or `map`.'
292
+ Enabled: true
293
+ VersionAdded: '2.5'
294
+
263
295
  Rails/InverseOf:
264
296
  Description: 'Checks for associations where the inverse cannot be determined automatically.'
265
297
  Enabled: true
@@ -330,6 +362,17 @@ Rails/Present:
330
362
  # Convert usages of `unless blank?` to `if present?`
331
363
  UnlessBlank: true
332
364
 
365
+ Rails/RakeEnvironment:
366
+ Description: 'Include `:environment` as a dependency for all Rake tasks.'
367
+ Enabled: false
368
+ Safe: false
369
+ VersionAdded: '2.4'
370
+ Include:
371
+ - '**/Rakefile'
372
+ - '**/*.rake'
373
+ Exclude:
374
+ - 'lib/capistrano/tasks/**/*.rake'
375
+
333
376
  Rails/ReadWriteAttribute:
334
377
  Description: >-
335
378
  Checks for read_attribute(:attr) and
@@ -364,6 +407,10 @@ Rails/RefuteMethods:
364
407
  Description: 'Use `assert_not` methods instead of `refute` methods.'
365
408
  Enabled: true
366
409
  VersionAdded: '0.56'
410
+ EnforcedStyle: assert_not
411
+ SupportedStyles:
412
+ - assert_not
413
+ - refute
367
414
  Include:
368
415
  - '**/test/**/*'
369
416
 
@@ -402,6 +449,18 @@ Rails/SafeNavigation:
402
449
  # implement the intended method. `try` will not raise an exception for this.
403
450
  ConvertTry: false
404
451
 
452
+ Rails/SafeNavigationWithBlank:
453
+ Description: 'Avoid `foo&.blank?` in conditionals.'
454
+ Enabled: true
455
+ VersionAdded: '2.4'
456
+ # While the safe navigation operator is generally a good idea, when
457
+ # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually
458
+ # do the opposite of what the author intends.
459
+ #
460
+ # foo&.blank? #=> nil
461
+ # foo.blank? #=> true
462
+ SafeAutoCorrect: false
463
+
405
464
  Rails/SaveBang:
406
465
  Description: 'Identifies possible cases where Active Record save! or related should be used.'
407
466
  StyleGuide: 'https://rails.rubystyle.guide#save-bang'
@@ -467,6 +526,13 @@ Rails/UniqBeforePluck:
467
526
  - aggressive
468
527
  AutoCorrect: false
469
528
 
529
+ Rails/UniqueValidationWithoutIndex:
530
+ Description: 'Uniqueness validation should be with a unique index.'
531
+ Enabled: true
532
+ VersionAdded: '2.5'
533
+ Include:
534
+ - app/models/**/*.rb
535
+
470
536
  Rails/UnknownEnv:
471
537
  Description: 'Use correct environment name.'
472
538
  Enabled: false # https://github.com/makandra/makandra-rubocop/issues/11
@@ -0,0 +1,641 @@
1
+ require:
2
+ - rubocop-rspec
3
+
4
+ inherit_mode:
5
+ merge:
6
+ - Exclude
7
+
8
+ AllCops:
9
+ RSpec:
10
+ Patterns:
11
+ - _spec.rb
12
+ - "(?:^|/)spec/"
13
+ RSpec/FactoryBot:
14
+ Patterns:
15
+ - spec/factories.rb
16
+ - spec/factories/**/*.rb
17
+ - features/support/factories/**/*.rb
18
+
19
+ RSpec/AlignLeftLetBrace:
20
+ Description: Checks that left braces for adjacent single line lets are aligned.
21
+ Enabled: false
22
+ VersionAdded: '1.16'
23
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
24
+
25
+ RSpec/AlignRightLetBrace:
26
+ Description: Checks that right braces for adjacent single line lets are aligned.
27
+ Enabled: false
28
+ VersionAdded: '1.16'
29
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
30
+
31
+ RSpec/AnyInstance:
32
+ Description: Check that instances are not being stubbed globally.
33
+ Enabled: false # The example is good, but it does not work if you can not access the instance that needs to be stubbed
34
+ VersionAdded: '1.4'
35
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
36
+
37
+ RSpec/AroundBlock:
38
+ Description: Checks that around blocks actually run the test.
39
+ Enabled: true
40
+ VersionAdded: '1.11'
41
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
42
+
43
+ RSpec/Be:
44
+ Description: Check for expectations where `be` is used without argument.
45
+ Enabled: true
46
+ VersionAdded: '1.25'
47
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
48
+
49
+ RSpec/BeEql:
50
+ Description: Check for expectations where `be(...)` can replace `eql(...)`.
51
+ Enabled: true
52
+ VersionAdded: '1.7'
53
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
54
+
55
+ RSpec/BeforeAfterAll:
56
+ Description: Check that before/after(:all) isn't being used.
57
+ Enabled: true
58
+ Exclude:
59
+ - spec/spec_helper.rb
60
+ - spec/rails_helper.rb
61
+ - spec/support/**/*.rb
62
+ VersionAdded: '1.12'
63
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
64
+
65
+ RSpec/ContextMethod:
66
+ Description: "`context` should not be used for specifying methods."
67
+ Enabled: true
68
+ VersionAdded: '1.36'
69
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
70
+
71
+ RSpec/ContextWording:
72
+ Description: Checks that `context` docstring starts with an allowed prefix.
73
+ Enabled: false # It is nice to follow this approach but we do not want to enforce it
74
+ Prefixes:
75
+ - when
76
+ - with
77
+ - without
78
+ VersionAdded: '1.20'
79
+ VersionChanged: 1.20.1
80
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
81
+
82
+ RSpec/DescribeClass:
83
+ Description: Check that the first argument to the top level describe is a constant.
84
+ Enabled: false # It is nice to follow this approach but we do not want to enforce it
85
+ VersionAdded: '1.0'
86
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
87
+
88
+ RSpec/DescribeMethod:
89
+ Description: Checks that the second argument to `describe` specifies a method.
90
+ Enabled: true
91
+ VersionAdded: '1.0'
92
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
93
+
94
+ RSpec/DescribeSymbol:
95
+ Description: Avoid describing symbols.
96
+ Enabled: true
97
+ VersionAdded: '1.15'
98
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
99
+
100
+ RSpec/DescribedClass:
101
+ Description: Checks that tests use `described_class`.
102
+ Enabled: true
103
+ SkipBlocks: false
104
+ EnforcedStyle: described_class
105
+ SupportedStyles:
106
+ - described_class
107
+ - explicit
108
+ SafeAutoCorrect: false
109
+ VersionAdded: '1.0'
110
+ VersionChanged: '1.11'
111
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
112
+
113
+ RSpec/DescribedClassModuleWrapping:
114
+ Description: Avoid opening modules and defining specs within them.
115
+ Enabled: false
116
+ VersionAdded: '1.37'
117
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
118
+
119
+ RSpec/Dialect:
120
+ Description: This cop enforces custom RSpec dialects.
121
+ Enabled: false
122
+ PreferredMethods: {}
123
+ VersionAdded: '1.33'
124
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
125
+
126
+ RSpec/EmptyExampleGroup:
127
+ Description: Checks if an example group does not include any tests.
128
+ Enabled: true
129
+ CustomIncludeMethods: []
130
+ VersionAdded: '1.7'
131
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
132
+
133
+ RSpec/EmptyHook:
134
+ Description: Checks for empty before and after hooks.
135
+ Enabled: true
136
+ VersionAdded: '1.39'
137
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
138
+
139
+ RSpec/EmptyLineAfterExample:
140
+ Description: Checks if there is an empty line after example blocks.
141
+ Enabled: true
142
+ AllowConsecutiveOneLiners: true
143
+ VersionAdded: '1.36'
144
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
145
+
146
+ RSpec/EmptyLineAfterExampleGroup:
147
+ Description: Checks if there is an empty line after example group blocks.
148
+ Enabled: true
149
+ VersionAdded: '1.27'
150
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
151
+
152
+ RSpec/EmptyLineAfterFinalLet:
153
+ Description: Checks if there is an empty line after the last let block.
154
+ Enabled: true
155
+ VersionAdded: '1.14'
156
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
157
+
158
+ RSpec/EmptyLineAfterHook:
159
+ Description: Checks if there is an empty line after hook blocks.
160
+ Enabled: true
161
+ VersionAdded: '1.27'
162
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
163
+
164
+ RSpec/EmptyLineAfterSubject:
165
+ Description: Checks if there is an empty line after subject block.
166
+ Enabled: true
167
+ VersionAdded: '1.14'
168
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
169
+
170
+ RSpec/ExampleLength:
171
+ Description: Checks for long examples.
172
+ Enabled: false # We do not want to have such limitation
173
+ Max: 5
174
+ VersionAdded: '1.5'
175
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
176
+
177
+ RSpec/ExampleWithoutDescription:
178
+ Description: Checks for examples without a description.
179
+ Enabled: true
180
+ EnforcedStyle: always_allow
181
+ SupportedStyles:
182
+ - always_allow
183
+ - single_line_only
184
+ - disallow
185
+ VersionAdded: '1.22'
186
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
187
+
188
+ RSpec/ExampleWording:
189
+ Description: Checks for common mistakes in example descriptions.
190
+ Enabled: true
191
+ CustomTransform:
192
+ be: is
193
+ BE: IS
194
+ have: has
195
+ HAVE: HAS
196
+ IgnoredWords: []
197
+ VersionAdded: '1.0'
198
+ VersionChanged: '1.2'
199
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
200
+
201
+ RSpec/ExpectActual:
202
+ Description: Checks for `expect(...)` calls containing literal values.
203
+ Enabled: true
204
+ Exclude:
205
+ - spec/routing/**/*
206
+ VersionAdded: '1.7'
207
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
208
+
209
+ RSpec/ExpectChange:
210
+ Description: Checks for consistent style of change matcher.
211
+ Enabled: true
212
+ EnforcedStyle: method_call
213
+ SupportedStyles:
214
+ - method_call
215
+ - block
216
+ VersionAdded: '1.22'
217
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
218
+
219
+ RSpec/ExpectInHook:
220
+ Description: Do not use `expect` in hooks such as `before`.
221
+ Enabled: false # Maybe we want to change this in the future, currently we use this if a expectation is the same for multiple examples (e.g the response of a http response)
222
+ VersionAdded: '1.16'
223
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
224
+
225
+ RSpec/ExpectOutput:
226
+ Description: Checks for opportunities to use `expect { ... }.to output`.
227
+ Enabled: true
228
+ VersionAdded: '1.10'
229
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
230
+
231
+ RSpec/FilePath:
232
+ Description: Checks that spec file paths are consistent and well-formed.
233
+ Enabled: true
234
+ CustomTransform:
235
+ RuboCop: rubocop
236
+ RSpec: rspec
237
+ IgnoreMethods: false
238
+ SpecSuffixOnly: false
239
+ VersionAdded: '1.2'
240
+ VersionChanged: '1.40'
241
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
242
+
243
+ RSpec/Focus:
244
+ Description: Checks if examples are focused.
245
+ Enabled: true
246
+ VersionAdded: '1.5'
247
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
248
+
249
+ RSpec/HookArgument:
250
+ Description: Checks the arguments passed to `before`, `around`, and `after`.
251
+ Enabled: true
252
+ EnforcedStyle: implicit
253
+ SupportedStyles:
254
+ - implicit
255
+ - each
256
+ - example
257
+ VersionAdded: '1.7'
258
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
259
+
260
+ RSpec/HooksBeforeExamples:
261
+ Description: Checks for before/around/after hooks that come after an example.
262
+ Enabled: true
263
+ VersionAdded: '1.29'
264
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
265
+
266
+ RSpec/ImplicitBlockExpectation:
267
+ Description: Check that implicit block expectation syntax is not used.
268
+ Enabled: true
269
+ VersionAdded: '1.35'
270
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
271
+
272
+ RSpec/ImplicitExpect:
273
+ Description: Check that a consistent implicit expectation style is used.
274
+ Enabled: true
275
+ EnforcedStyle: is_expected
276
+ SupportedStyles:
277
+ - is_expected
278
+ - should
279
+ VersionAdded: '1.8'
280
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
281
+
282
+ RSpec/ImplicitSubject:
283
+ Description: Checks for usage of implicit subject (`is_expected` / `should`).
284
+ Enabled: true # Maybe we want to change this to false in the future
285
+ EnforcedStyle: single_line_only
286
+ SupportedStyles:
287
+ - single_line_only
288
+ - single_statement_only
289
+ - disallow
290
+ VersionAdded: '1.29'
291
+ VersionChanged: '1.30'
292
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
293
+
294
+ RSpec/InstanceSpy:
295
+ Description: Checks for `instance_double` used with `have_received`.
296
+ Enabled: true
297
+ VersionAdded: '1.12'
298
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
299
+
300
+ RSpec/InstanceVariable:
301
+ Description: Checks for instance variable usage in specs.
302
+ Enabled: false # It's good to prefer let over an instance variable. But there are legit cases for instance variables.
303
+ AssignmentOnly: false
304
+ VersionAdded: '1.0'
305
+ VersionChanged: '1.7'
306
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
307
+
308
+ RSpec/InvalidPredicateMatcher:
309
+ Description: Checks invalid usage for predicate matcher.
310
+ Enabled: true
311
+ VersionAdded: '1.16'
312
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InvalidPredicateMatcher
313
+
314
+ RSpec/ItBehavesLike:
315
+ Description: Checks that only one `it_behaves_like` style is used.
316
+ Enabled: true
317
+ EnforcedStyle: it_behaves_like
318
+ SupportedStyles:
319
+ - it_behaves_like
320
+ - it_should_behave_like
321
+ VersionAdded: '1.13'
322
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
323
+
324
+ RSpec/IteratedExpectation:
325
+ Description: Check that `all` matcher is used instead of iterating over an array.
326
+ Enabled: true
327
+ VersionAdded: '1.14'
328
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
329
+
330
+ RSpec/LeadingSubject:
331
+ Description: Enforce that subject is the first definition in the test.
332
+ Enabled: false # We don't do this
333
+ VersionAdded: '1.7'
334
+ VersionChanged: '1.14'
335
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
336
+
337
+ RSpec/LeakyConstantDeclaration:
338
+ Description: Checks that no class, module, or constant is declared.
339
+ Enabled: true
340
+ VersionAdded: '1.35'
341
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
342
+
343
+ RSpec/LetBeforeExamples:
344
+ Description: Checks for `let` definitions that come after an example.
345
+ Enabled: true
346
+ VersionAdded: '1.16'
347
+ VersionChanged: '1.22'
348
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
349
+
350
+ RSpec/LetSetup:
351
+ Description: Checks unreferenced `let!` calls being used for test setup.
352
+ Enabled: false # It seems better to remove this cop from the default set, the reasons are weird https://github.com/rubocop-hq/rubocop-rspec/issues/94
353
+ VersionAdded: '1.7'
354
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
355
+
356
+ RSpec/MessageChain:
357
+ Description: Check that chains of messages are not being stubbed.
358
+ Enabled: true
359
+ VersionAdded: '1.7'
360
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
361
+
362
+ RSpec/MessageExpectation:
363
+ Description: Checks for consistent message expectation style.
364
+ Enabled: false
365
+ EnforcedStyle: allow
366
+ SupportedStyles:
367
+ - allow
368
+ - expect
369
+ VersionAdded: '1.7'
370
+ VersionChanged: '1.8'
371
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
372
+
373
+ RSpec/MessageSpies:
374
+ Description: Checks that message expectations are set using spies.
375
+ Enabled: true
376
+ EnforcedStyle: receive # We usually use receive as it is defined before the expectation line and not after
377
+ SupportedStyles:
378
+ - have_received
379
+ - receive
380
+ VersionAdded: '1.9'
381
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
382
+
383
+ RSpec/MissingExampleGroupArgument:
384
+ Description: Checks that the first argument to an example group is not empty.
385
+ Enabled: true
386
+ VersionAdded: '1.28'
387
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
388
+
389
+ RSpec/MultipleDescribes:
390
+ Description: Checks for multiple top level describes.
391
+ Enabled: true
392
+ VersionAdded: '1.0'
393
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
394
+
395
+ RSpec/MultipleExpectations:
396
+ Description: Checks if examples contain too many `expect` calls.
397
+ Enabled: false # We do not want to have such limitation
398
+ Max: 1
399
+ VersionAdded: '1.7'
400
+ VersionChanged: '1.21'
401
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
402
+
403
+ RSpec/MultipleSubjects:
404
+ Description: Checks if an example group defines `subject` multiple times.
405
+ Enabled: true
406
+ VersionAdded: '1.16'
407
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
408
+
409
+ RSpec/NamedSubject:
410
+ Description: Checks for explicitly referenced test subjects.
411
+ Enabled: true # Usually this is a good pattern, but maybe we have to disable this in the future
412
+ IgnoreSharedExamples: true
413
+ VersionAdded: 1.5.3
414
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
415
+
416
+ RSpec/NestedGroups:
417
+ Description: Checks for nested example groups.
418
+ Enabled: false # We do not want to have such limitation
419
+ Max: 3
420
+ VersionAdded: '1.7'
421
+ VersionChanged: '1.10'
422
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
423
+
424
+ RSpec/NotToNot:
425
+ Description: Checks for consistent method usage for negating expectations.
426
+ Enabled: true
427
+ EnforcedStyle: not_to
428
+ SupportedStyles:
429
+ - not_to
430
+ - to_not
431
+ VersionAdded: '1.4'
432
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
433
+
434
+ RSpec/OverwritingSetup:
435
+ Description: Checks if there is a let/subject that overwrites an existing one.
436
+ Enabled: true # This would break tests, but it's worth the effort
437
+ VersionAdded: '1.14'
438
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
439
+
440
+ RSpec/Pending:
441
+ Description: Checks for any pending or skipped examples.
442
+ Enabled: false
443
+ VersionAdded: '1.25'
444
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
445
+
446
+ RSpec/PredicateMatcher:
447
+ Description: Prefer using predicate matcher over using predicate method directly.
448
+ Enabled: true # Maybe we need to remove this in the future
449
+ Strict: true
450
+ EnforcedStyle: inflected
451
+ AllowedExplicitMatchers: []
452
+ SupportedStyles:
453
+ - inflected
454
+ - explicit
455
+ SafeAutoCorrect: false
456
+ VersionAdded: '1.16'
457
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
458
+
459
+ RSpec/ReceiveCounts:
460
+ Description: Check for `once` and `twice` receive counts matchers usage.
461
+ Enabled: true
462
+ VersionAdded: '1.26'
463
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
464
+
465
+ RSpec/ReceiveNever:
466
+ Description: Prefer `not_to receive(...)` over `receive(...).never`.
467
+ Enabled: true
468
+ VersionAdded: '1.28'
469
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
470
+
471
+ RSpec/RepeatedDescription:
472
+ Description: Check for repeated description strings in example groups.
473
+ Enabled: true
474
+ VersionAdded: '1.9'
475
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
476
+
477
+ RSpec/RepeatedExample:
478
+ Description: Check for repeated examples within example groups.
479
+ Enabled: true
480
+ VersionAdded: '1.10'
481
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
482
+
483
+ RSpec/RepeatedExampleGroupBody:
484
+ Description: Check for repeated describe and context block body.
485
+ Enabled: true
486
+ VersionAdded: '1.38'
487
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
488
+
489
+ RSpec/RepeatedExampleGroupDescription:
490
+ Description: Check for repeated example group descriptions.
491
+ Enabled: true
492
+ VersionAdded: '1.38'
493
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
494
+
495
+ RSpec/ReturnFromStub:
496
+ Description: Checks for consistent style of stub's return setting.
497
+ Enabled: true
498
+ EnforcedStyle: and_return
499
+ SupportedStyles:
500
+ - and_return
501
+ - block
502
+ VersionAdded: '1.16'
503
+ VersionChanged: '1.22'
504
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
505
+
506
+ RSpec/ScatteredLet:
507
+ Description: Checks for let scattered across the example group.
508
+ Enabled: true
509
+ VersionAdded: '1.14'
510
+ VersionChanged: '1.39'
511
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
512
+
513
+ RSpec/ScatteredSetup:
514
+ Description: Checks for setup scattered across multiple hooks in an example group.
515
+ Enabled: true
516
+ VersionAdded: '1.10'
517
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
518
+
519
+ RSpec/SharedContext:
520
+ Description: Checks for proper shared_context and shared_examples usage.
521
+ Enabled: true
522
+ VersionAdded: '1.13'
523
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
524
+
525
+ RSpec/SharedExamples:
526
+ Description: Enforces use of string to titleize shared examples.
527
+ Enabled: true
528
+ VersionAdded: '1.25'
529
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
530
+
531
+ RSpec/SingleArgumentMessageChain:
532
+ Description: Checks that chains of messages contain more than one element.
533
+ Enabled: true
534
+ VersionAdded: '1.9'
535
+ VersionChanged: '1.10'
536
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
537
+
538
+ RSpec/SubjectStub:
539
+ Description: Checks for stubbed test subjects.
540
+ Enabled: true
541
+ VersionAdded: '1.7'
542
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
543
+
544
+ RSpec/UnspecifiedException:
545
+ Description: Checks for a specified error in checking raised errors.
546
+ Enabled: true
547
+ VersionAdded: '1.30'
548
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
549
+
550
+ RSpec/VariableDefinition:
551
+ Description: Checks that memoized helpers names are symbols or strings.
552
+ Enabled: true
553
+ EnforcedStyle: symbols
554
+ SupportedStyles:
555
+ - symbols
556
+ - strings
557
+ VersionAdded: '1.40'
558
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
559
+
560
+ RSpec/VariableName:
561
+ Description: Checks that memoized helper names use the configured style.
562
+ Enabled: true
563
+ EnforcedStyle: snake_case
564
+ SupportedStyles:
565
+ - snake_case
566
+ - camelCase
567
+ VersionAdded: '1.40'
568
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
569
+
570
+ RSpec/VerifiedDoubles:
571
+ Description: Prefer using verifying doubles over normal doubles.
572
+ Enabled: true
573
+ IgnoreNameless: true
574
+ IgnoreSymbolicNames: false
575
+ VersionAdded: 1.2.1
576
+ VersionChanged: '1.5'
577
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
578
+
579
+ RSpec/VoidExpect:
580
+ Description: This cop checks void `expect()`.
581
+ Enabled: true
582
+ VersionAdded: '1.16'
583
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
584
+
585
+ RSpec/Yield:
586
+ Description: This cop checks for calling a block within a stub.
587
+ Enabled: true
588
+ VersionAdded: '1.32'
589
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
590
+
591
+ Capybara/CurrentPathExpectation:
592
+ Description: Checks that no expectations are set on Capybara's `current_path`.
593
+ Enabled: true
594
+ VersionAdded: '1.18'
595
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
596
+
597
+ Capybara/FeatureMethods:
598
+ Description: Checks for consistent method usage in feature specs.
599
+ Enabled: true
600
+ EnabledMethods: []
601
+ VersionAdded: '1.17'
602
+ VersionChanged: '1.25'
603
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
604
+
605
+ Capybara/VisibilityMatcher:
606
+ Description: Checks for boolean visibility in capybara finders.
607
+ Enabled: true
608
+ VersionAdded: '1.39'
609
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
610
+
611
+ FactoryBot/AttributeDefinedStatically:
612
+ Description: Always declare attribute values as blocks.
613
+ Enabled: true
614
+ VersionAdded: '1.28'
615
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
616
+
617
+ FactoryBot/CreateList:
618
+ Description: Checks for create_list usage.
619
+ Enabled: true
620
+ EnforcedStyle: create_list
621
+ SupportedStyles:
622
+ - create_list
623
+ - n_times
624
+ VersionAdded: '1.25'
625
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
626
+
627
+ FactoryBot/FactoryClassName:
628
+ Description: Use string value when setting the class attribute explicitly.
629
+ Enabled: true
630
+ VersionAdded: '1.37'
631
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
632
+
633
+ Rails/HttpStatus:
634
+ Description: Enforces use of symbolic or numeric value to describe HTTP status.
635
+ Enabled: false # This should not be enforced
636
+ EnforcedStyle: symbolic
637
+ SupportedStyles:
638
+ - numeric
639
+ - symbolic
640
+ VersionAdded: '1.23'
641
+ StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus