makandra-rubocop 5.0.0 → 6.0.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 +4 -4
- data/CHANGELOG.md +57 -0
- data/Gemfile.lock +36 -30
- data/README.md +25 -8
- data/config/default.yml +911 -133
- data/config/ext/rails.yml +225 -12
- data/config/ext/rspec.yml +769 -0
- data/lib/makandra_rubocop/version.rb +1 -1
- data/makandra-rubocop.gemspec +3 -2
- metadata +22 -7
data/config/ext/rails.yml
CHANGED
@@ -43,6 +43,14 @@ Rails/ActiveRecordAliases:
|
|
43
43
|
VersionAdded: '0.53'
|
44
44
|
SafeAutoCorrect: false
|
45
45
|
|
46
|
+
Rails/ActiveRecordCallbacksOrder:
|
47
|
+
Description: 'Order callback declarations in the order in which they will be executed.'
|
48
|
+
StyleGuide: 'https://rails.rubystyle.guide/#callbacks-order'
|
49
|
+
Enabled: true
|
50
|
+
VersionAdded: '2.7'
|
51
|
+
Include:
|
52
|
+
- app/models/**/*.rb
|
53
|
+
|
46
54
|
Rails/ActiveRecordOverride:
|
47
55
|
Description: >-
|
48
56
|
Check for overriding Active Record methods instead of using
|
@@ -60,6 +68,14 @@ Rails/ActiveSupportAliases:
|
|
60
68
|
Enabled: false
|
61
69
|
VersionAdded: '0.48'
|
62
70
|
|
71
|
+
Rails/AfterCommitOverride:
|
72
|
+
Description: >-
|
73
|
+
This cop enforces that there is only one call to `after_commit`
|
74
|
+
(and its aliases - `after_create_commit`, `after_update_commit`,
|
75
|
+
and `after_destroy_commit`) with the same callback name per model.
|
76
|
+
Enabled: true
|
77
|
+
VersionAdded: '2.8'
|
78
|
+
|
63
79
|
Rails/ApplicationController:
|
64
80
|
Description: 'Check that controllers subclass ApplicationController.'
|
65
81
|
Enabled: false # We have Controllers like `/jasmine` which do not inherit from ApplicationController
|
@@ -88,6 +104,12 @@ Rails/ApplicationRecord:
|
|
88
104
|
VersionAdded: '0.49'
|
89
105
|
VersionChanged: '2.5'
|
90
106
|
|
107
|
+
Rails/ArelStar:
|
108
|
+
Description: 'Enforces `Arel.star` instead of `"*"` for expanded columns.'
|
109
|
+
Enabled: true
|
110
|
+
SafeAutoCorrect: false
|
111
|
+
VersionAdded: '2.9'
|
112
|
+
|
91
113
|
Rails/AssertNot:
|
92
114
|
Description: 'Use `assert_not` instead of `assert !`.'
|
93
115
|
Enabled: true
|
@@ -95,10 +117,17 @@ Rails/AssertNot:
|
|
95
117
|
Include:
|
96
118
|
- '**/test/**/*'
|
97
119
|
|
120
|
+
Rails/AttributeDefaultBlockValue:
|
121
|
+
Description: 'Pass method call in block for attribute option `default`.'
|
122
|
+
Enabled: true
|
123
|
+
VersionAdded: '2.9'
|
124
|
+
Include:
|
125
|
+
- 'models/**/*'
|
126
|
+
|
98
127
|
Rails/BelongsTo:
|
99
128
|
Description: >-
|
100
129
|
Use `optional: true` instead of `required: false` for
|
101
|
-
`belongs_to` relations
|
130
|
+
`belongs_to` relations.
|
102
131
|
Enabled: true
|
103
132
|
VersionAdded: '0.62'
|
104
133
|
|
@@ -125,6 +154,14 @@ Rails/BulkChangeTable:
|
|
125
154
|
Include:
|
126
155
|
- db/migrate/*.rb
|
127
156
|
|
157
|
+
Rails/ContentTag:
|
158
|
+
Description: 'Use `tag` instead of `content_tag`.'
|
159
|
+
Reference:
|
160
|
+
- 'https://github.com/rails/rails/issues/25195'
|
161
|
+
- 'https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag'
|
162
|
+
Enabled: false # The Github page returned an 500 so I was not able to evaluate this cop
|
163
|
+
VersionAdded: '2.6'
|
164
|
+
|
128
165
|
Rails/CreateTableWithTimestamps:
|
129
166
|
Description: >-
|
130
167
|
Checks the migration for which timestamps are not included
|
@@ -151,6 +188,12 @@ Rails/Date:
|
|
151
188
|
- strict
|
152
189
|
- flexible
|
153
190
|
|
191
|
+
Rails/DefaultScope:
|
192
|
+
Description: 'Avoid use of `default_scope`.'
|
193
|
+
StyleGuide: 'https://rails.rubystyle.guide#avoid-default-scope'
|
194
|
+
Enabled: false
|
195
|
+
VersionAdded: '2.7'
|
196
|
+
|
154
197
|
Rails/Delegate:
|
155
198
|
Description: 'Prefer delegate method for delegations.'
|
156
199
|
Enabled: false
|
@@ -171,8 +214,14 @@ Rails/DynamicFindBy:
|
|
171
214
|
StyleGuide: 'https://rails.rubystyle.guide#find_by'
|
172
215
|
Enabled: false # We occasionally define custom find_by_* methods (e.g. `find_by_anything`) which don't work like ActiveRecord's methods.
|
173
216
|
VersionAdded: '0.44'
|
217
|
+
VersionChanged: '2.6'
|
218
|
+
# The `Whitelist` has been deprecated, Please use `AllowedMethods` instead.
|
174
219
|
Whitelist:
|
175
220
|
- find_by_sql
|
221
|
+
AllowedMethods:
|
222
|
+
- find_by_sql
|
223
|
+
AllowedReceivers:
|
224
|
+
- Gem::Specification
|
176
225
|
|
177
226
|
Rails/EnumHash:
|
178
227
|
Description: 'Prefer hash syntax over array syntax when defining enums.'
|
@@ -190,7 +239,7 @@ Rails/EnumUniqueness:
|
|
190
239
|
- app/models/**/*.rb
|
191
240
|
|
192
241
|
Rails/EnvironmentComparison:
|
193
|
-
Description: "Favor `Rails.env.production?` over `Rails.env == 'production'
|
242
|
+
Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`."
|
194
243
|
Enabled: true
|
195
244
|
VersionAdded: '0.52'
|
196
245
|
|
@@ -226,13 +275,28 @@ Rails/FindBy:
|
|
226
275
|
Include:
|
227
276
|
- app/models/**/*.rb
|
228
277
|
|
278
|
+
Rails/FindById:
|
279
|
+
Description: >-
|
280
|
+
Favor the use of `find` over `where.take!`, `find_by!`, and `find_by_id!` when you
|
281
|
+
need to retrieve a single record by primary key when you expect it to be found.
|
282
|
+
StyleGuide: 'https://rails.rubystyle.guide/#find'
|
283
|
+
Enabled: true
|
284
|
+
VersionAdded: '2.7'
|
285
|
+
|
229
286
|
Rails/FindEach:
|
230
287
|
Description: 'Prefer all.find_each over all.find.'
|
231
288
|
StyleGuide: 'https://rails.rubystyle.guide#find-each'
|
232
289
|
Enabled: true
|
233
290
|
VersionAdded: '0.30'
|
291
|
+
VersionChanged: '2.9'
|
234
292
|
Include:
|
235
293
|
- app/models/**/*.rb
|
294
|
+
IgnoredMethods:
|
295
|
+
# Methods that don't work well with `find_each`.
|
296
|
+
- order
|
297
|
+
- limit
|
298
|
+
- select
|
299
|
+
- lock
|
236
300
|
|
237
301
|
Rails/HasAndBelongsToMany:
|
238
302
|
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
@@ -251,7 +315,7 @@ Rails/HasManyOrHasOneDependent:
|
|
251
315
|
- app/models/**/*.rb
|
252
316
|
|
253
317
|
Rails/HelperInstanceVariable:
|
254
|
-
Description: 'Do not use instance variables in helpers'
|
318
|
+
Description: 'Do not use instance variables in helpers.'
|
255
319
|
Enabled: false # https://github.com/makandra/makandra-rubocop/issues/12
|
256
320
|
VersionAdded: '2.0'
|
257
321
|
Include:
|
@@ -283,14 +347,22 @@ Rails/IgnoredSkipActionFilterOption:
|
|
283
347
|
- app/controllers/**/*.rb
|
284
348
|
|
285
349
|
Rails/IndexBy:
|
286
|
-
Description: 'Prefer `index_by` over `each_with_object` or `map`.'
|
350
|
+
Description: 'Prefer `index_by` over `each_with_object`, `to_h`, or `map`.'
|
287
351
|
Enabled: true
|
288
352
|
VersionAdded: '2.5'
|
353
|
+
VersionChanged: '2.8'
|
289
354
|
|
290
355
|
Rails/IndexWith:
|
291
|
-
Description: 'Prefer `index_with` over `each_with_object` or `map`.'
|
356
|
+
Description: 'Prefer `index_with` over `each_with_object`, `to_h`, or `map`.'
|
292
357
|
Enabled: true
|
293
358
|
VersionAdded: '2.5'
|
359
|
+
VersionChanged: '2.8'
|
360
|
+
|
361
|
+
Rails/Inquiry:
|
362
|
+
Description: "Prefer Ruby's comparison operators over Active Support's `Array#inquiry` and `String#inquiry`."
|
363
|
+
StyleGuide: 'https://rails.rubystyle.guide/#inquiry'
|
364
|
+
Enabled: false # Not clear why we want this
|
365
|
+
VersionAdded: '2.7'
|
294
366
|
|
295
367
|
Rails/InverseOf:
|
296
368
|
Description: 'Checks for associations where the inverse cannot be determined automatically.'
|
@@ -317,13 +389,49 @@ Rails/LinkToBlank:
|
|
317
389
|
Enabled: true
|
318
390
|
VersionAdded: '0.62'
|
319
391
|
|
392
|
+
Rails/MailerName:
|
393
|
+
Description: 'Mailer should end with `Mailer` suffix.'
|
394
|
+
StyleGuide: 'https://rails.rubystyle.guide/#mailer-name'
|
395
|
+
Enabled: true
|
396
|
+
SafeAutoCorrect: false
|
397
|
+
VersionAdded: '2.7'
|
398
|
+
Include:
|
399
|
+
- app/mailers/**/*.rb
|
400
|
+
|
401
|
+
Rails/MatchRoute:
|
402
|
+
Description: >-
|
403
|
+
Don't use `match` to define any routes unless there is a need to map multiple request types
|
404
|
+
among [:get, :post, :patch, :put, :delete] to a single action using the `:via` option.
|
405
|
+
StyleGuide: 'https://rails.rubystyle.guide/#no-match-routes'
|
406
|
+
Enabled: false # No need why we want to have a cop for this
|
407
|
+
VersionAdded: '2.7'
|
408
|
+
Include:
|
409
|
+
- config/routes.rb
|
410
|
+
- config/routes/**/*.rb
|
411
|
+
|
412
|
+
Rails/NegateInclude:
|
413
|
+
Description: 'Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`.'
|
414
|
+
StyleGuide: 'https://rails.rubystyle.guide#exclude'
|
415
|
+
Enabled: true
|
416
|
+
Safe: false
|
417
|
+
VersionAdded: '2.7'
|
418
|
+
VersionChanged: '2.9'
|
419
|
+
|
320
420
|
Rails/NotNullColumn:
|
321
|
-
Description: 'Do not add a NOT NULL column without a default value'
|
421
|
+
Description: 'Do not add a NOT NULL column without a default value.'
|
322
422
|
Enabled: true
|
323
423
|
VersionAdded: '0.43'
|
324
424
|
Include:
|
325
425
|
- db/migrate/*.rb
|
326
426
|
|
427
|
+
Rails/OrderById:
|
428
|
+
Description: >-
|
429
|
+
Do not use the `id` column for ordering.
|
430
|
+
Use a timestamp column to order chronologically.
|
431
|
+
StyleGuide: 'https://rails.rubystyle.guide/#order-by-id'
|
432
|
+
Enabled: false
|
433
|
+
VersionAdded: '2.8'
|
434
|
+
|
327
435
|
Rails/Output:
|
328
436
|
Description: 'Checks for calls to puts, print, etc.'
|
329
437
|
Enabled: false
|
@@ -340,6 +448,37 @@ Rails/OutputSafety:
|
|
340
448
|
Enabled: true # We may need to review this. Unsure if the cop can always know which `html_safe` call is valid and which one is not.
|
341
449
|
VersionAdded: '0.41'
|
342
450
|
|
451
|
+
Rails/Pick:
|
452
|
+
Description: 'Prefer `pick` over `pluck(...).first`.'
|
453
|
+
StyleGuide: 'https://rails.rubystyle.guide#pick'
|
454
|
+
Enabled: true
|
455
|
+
Safe: false
|
456
|
+
VersionAdded: '2.6'
|
457
|
+
|
458
|
+
Rails/Pluck:
|
459
|
+
Description: 'Prefer `pluck` over `map { ... }`.'
|
460
|
+
StyleGuide: 'https://rails.rubystyle.guide#pluck'
|
461
|
+
Enabled: true
|
462
|
+
VersionAdded: '2.7'
|
463
|
+
|
464
|
+
Rails/PluckId:
|
465
|
+
Description: 'Use `ids` instead of `pluck(:id)` or `pluck(primary_key)`.'
|
466
|
+
StyleGuide: 'https://rails.rubystyle.guide/#ids'
|
467
|
+
Enabled: true
|
468
|
+
Safe: false
|
469
|
+
VersionAdded: '2.7'
|
470
|
+
|
471
|
+
Rails/PluckInWhere:
|
472
|
+
Description: 'Use `select` instead of `pluck` in `where` query methods.'
|
473
|
+
Enabled: false
|
474
|
+
Safe: false
|
475
|
+
VersionAdded: '2.7'
|
476
|
+
VersionChanged: '2.8'
|
477
|
+
EnforcedStyle: conservative
|
478
|
+
SupportedStyles:
|
479
|
+
- conservative
|
480
|
+
- aggressive
|
481
|
+
|
343
482
|
Rails/PluralizationGrammar:
|
344
483
|
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
|
345
484
|
Enabled: true
|
@@ -367,6 +506,7 @@ Rails/RakeEnvironment:
|
|
367
506
|
Enabled: false
|
368
507
|
Safe: false
|
369
508
|
VersionAdded: '2.4'
|
509
|
+
VersionChanged: '2.6'
|
370
510
|
Include:
|
371
511
|
- '**/Rakefile'
|
372
512
|
- '**/*.rake'
|
@@ -393,6 +533,11 @@ Rails/RedundantAllowNil:
|
|
393
533
|
Include:
|
394
534
|
- app/models/**/*.rb
|
395
535
|
|
536
|
+
Rails/RedundantForeignKey:
|
537
|
+
Description: 'Checks for associations where the `:foreign_key` option is redundant.'
|
538
|
+
Enabled: true
|
539
|
+
VersionAdded: '2.6'
|
540
|
+
|
396
541
|
Rails/RedundantReceiverInWithOptions:
|
397
542
|
Description: 'Checks for redundant receiver in `with_options`.'
|
398
543
|
Enabled: true
|
@@ -421,11 +566,25 @@ Rails/RelativeDateConstant:
|
|
421
566
|
VersionChanged: '0.59'
|
422
567
|
AutoCorrect: false
|
423
568
|
|
569
|
+
Rails/RenderInline:
|
570
|
+
Description: 'Prefer using a template over inline rendering.'
|
571
|
+
StyleGuide: 'https://rails.rubystyle.guide/#inline-rendering'
|
572
|
+
Enabled: false
|
573
|
+
VersionAdded: '2.7'
|
574
|
+
|
575
|
+
Rails/RenderPlainText:
|
576
|
+
Description: 'Prefer `render plain:` over `render text:`.'
|
577
|
+
StyleGuide: 'https://rails.rubystyle.guide/#plain-text-rendering'
|
578
|
+
Enabled: true
|
579
|
+
VersionAdded: '2.7'
|
580
|
+
# Convert only when `content_type` is explicitly set to `text/plain`.
|
581
|
+
ContentTypeCompatibility: true
|
582
|
+
|
424
583
|
Rails/RequestReferer:
|
425
584
|
Description: 'Use consistent syntax for request.referer.'
|
426
585
|
Enabled: true
|
427
586
|
VersionAdded: '0.41'
|
428
|
-
EnforcedStyle:
|
587
|
+
EnforcedStyle: referer
|
429
588
|
SupportedStyles:
|
430
589
|
- referer
|
431
590
|
- referrer
|
@@ -440,7 +599,7 @@ Rails/ReversibleMigration:
|
|
440
599
|
- db/migrate/*.rb
|
441
600
|
|
442
601
|
Rails/SafeNavigation:
|
443
|
-
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try
|
602
|
+
Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`."
|
444
603
|
Enabled: false
|
445
604
|
VersionAdded: '0.43'
|
446
605
|
# This will convert usages of `try` to use safe navigation as well as `try!`.
|
@@ -478,6 +637,16 @@ Rails/ScopeArgs:
|
|
478
637
|
Include:
|
479
638
|
- app/models/**/*.rb
|
480
639
|
|
640
|
+
Rails/ShortI18n:
|
641
|
+
Description: 'Use the short form of the I18n methods: `t` instead of `translate` and `l` instead of `localize`.'
|
642
|
+
StyleGuide: 'https://rails.rubystyle.guide/#short-i18n'
|
643
|
+
Enabled: true
|
644
|
+
VersionAdded: '2.7'
|
645
|
+
EnforcedStyle: conservative
|
646
|
+
SupportedStyles:
|
647
|
+
- conservative
|
648
|
+
- aggressive
|
649
|
+
|
481
650
|
Rails/SkipsModelValidations:
|
482
651
|
Description: >-
|
483
652
|
Use methods that skips model validations with caution.
|
@@ -485,20 +654,37 @@ Rails/SkipsModelValidations:
|
|
485
654
|
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
|
486
655
|
Enabled: false
|
487
656
|
VersionAdded: '0.47'
|
488
|
-
VersionChanged: '
|
489
|
-
|
657
|
+
VersionChanged: '2.7'
|
658
|
+
ForbiddenMethods:
|
490
659
|
- decrement!
|
491
660
|
- decrement_counter
|
492
661
|
- increment!
|
493
662
|
- increment_counter
|
663
|
+
- insert
|
664
|
+
- insert!
|
665
|
+
- insert_all
|
666
|
+
- insert_all!
|
494
667
|
- toggle!
|
495
668
|
- touch
|
669
|
+
- touch_all
|
496
670
|
- update_all
|
497
671
|
- update_attribute
|
498
672
|
- update_column
|
499
673
|
- update_columns
|
500
674
|
- update_counters
|
501
|
-
|
675
|
+
- upsert
|
676
|
+
- upsert_all
|
677
|
+
AllowedMethods: []
|
678
|
+
|
679
|
+
Rails/SquishedSQLHeredocs:
|
680
|
+
Description: 'Checks SQL heredocs to use `.squish`.'
|
681
|
+
StyleGuide: 'https://rails.rubystyle.guide/#squished-heredocs'
|
682
|
+
Enabled: true
|
683
|
+
VersionAdded: '2.8'
|
684
|
+
VersionChanged: '2.9'
|
685
|
+
# Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines
|
686
|
+
# to be preserved in order to work, thus auto-correction is not safe.
|
687
|
+
SafeAutoCorrect: false
|
502
688
|
|
503
689
|
Rails/TimeZone:
|
504
690
|
Description: 'Checks the correct usage of time zone aware methods.'
|
@@ -519,11 +705,12 @@ Rails/UniqBeforePluck:
|
|
519
705
|
Description: 'Prefer the use of uniq or distinct before pluck.'
|
520
706
|
Enabled: true
|
521
707
|
VersionAdded: '0.40'
|
522
|
-
VersionChanged: '
|
708
|
+
VersionChanged: '2.8'
|
523
709
|
EnforcedStyle: conservative
|
524
710
|
SupportedStyles:
|
525
711
|
- conservative
|
526
712
|
- aggressive
|
713
|
+
SafeAutoCorrect: false
|
527
714
|
AutoCorrect: false
|
528
715
|
|
529
716
|
Rails/UniqueValidationWithoutIndex:
|
@@ -549,3 +736,29 @@ Rails/Validation:
|
|
549
736
|
VersionChanged: '0.41'
|
550
737
|
Include:
|
551
738
|
- app/models/**/*.rb
|
739
|
+
|
740
|
+
Rails/WhereEquals:
|
741
|
+
Description: 'Pass conditions to `where` as a hash instead of manually constructing SQL.'
|
742
|
+
StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
|
743
|
+
Enabled: true
|
744
|
+
VersionAdded: '2.9'
|
745
|
+
|
746
|
+
Rails/WhereExists:
|
747
|
+
Description: 'Prefer `exists?(...)` over `where(...).exists?`.'
|
748
|
+
Enabled: true
|
749
|
+
EnforcedStyle: exists
|
750
|
+
SupportedStyles:
|
751
|
+
- exists
|
752
|
+
- where
|
753
|
+
VersionAdded: '2.7'
|
754
|
+
VersionChanged: '2.8'
|
755
|
+
|
756
|
+
Rails/WhereNot:
|
757
|
+
Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.'
|
758
|
+
StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
|
759
|
+
Enabled: true
|
760
|
+
VersionAdded: '2.8'
|
761
|
+
|
762
|
+
# Accept `redirect_to(...) and return` and similar cases.
|
763
|
+
Style/AndOr:
|
764
|
+
EnforcedStyle: conditionals
|
@@ -0,0 +1,769 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
|
4
|
+
inherit_mode:
|
5
|
+
merge:
|
6
|
+
- Exclude
|
7
|
+
|
8
|
+
RSpec:
|
9
|
+
Enabled: true
|
10
|
+
Include:
|
11
|
+
- "**/*_spec.rb"
|
12
|
+
- "**/spec/**/*"
|
13
|
+
Language:
|
14
|
+
ExampleGroups:
|
15
|
+
Regular:
|
16
|
+
- describe
|
17
|
+
- context
|
18
|
+
- feature
|
19
|
+
- example_group
|
20
|
+
Skipped:
|
21
|
+
- xdescribe
|
22
|
+
- xcontext
|
23
|
+
- xfeature
|
24
|
+
Focused:
|
25
|
+
- fdescribe
|
26
|
+
- fcontext
|
27
|
+
- ffeature
|
28
|
+
Examples:
|
29
|
+
Regular:
|
30
|
+
- it
|
31
|
+
- specify
|
32
|
+
- example
|
33
|
+
- scenario
|
34
|
+
- its
|
35
|
+
Focused:
|
36
|
+
- fit
|
37
|
+
- fspecify
|
38
|
+
- fexample
|
39
|
+
- fscenario
|
40
|
+
- focus
|
41
|
+
Skipped:
|
42
|
+
- xit
|
43
|
+
- xspecify
|
44
|
+
- xexample
|
45
|
+
- xscenario
|
46
|
+
- skip
|
47
|
+
Pending:
|
48
|
+
- pending
|
49
|
+
Expectations:
|
50
|
+
- expect
|
51
|
+
- is_expected
|
52
|
+
- expect_any_instance_of
|
53
|
+
Helpers:
|
54
|
+
- let
|
55
|
+
- let!
|
56
|
+
Hooks:
|
57
|
+
- prepend_before
|
58
|
+
- before
|
59
|
+
- append_before
|
60
|
+
- around
|
61
|
+
- prepend_after
|
62
|
+
- after
|
63
|
+
- append_after
|
64
|
+
HookScopes:
|
65
|
+
- each
|
66
|
+
- example
|
67
|
+
- context
|
68
|
+
- all
|
69
|
+
- suite
|
70
|
+
Includes:
|
71
|
+
Examples:
|
72
|
+
- it_behaves_like
|
73
|
+
- it_should_behave_like
|
74
|
+
- include_examples
|
75
|
+
Context:
|
76
|
+
- include_context
|
77
|
+
Runners:
|
78
|
+
- to
|
79
|
+
- to_not
|
80
|
+
- not_to
|
81
|
+
SharedGroups:
|
82
|
+
Examples:
|
83
|
+
- shared_examples
|
84
|
+
- shared_examples_for
|
85
|
+
Context:
|
86
|
+
- shared_context
|
87
|
+
Subjects:
|
88
|
+
- subject
|
89
|
+
- subject!
|
90
|
+
|
91
|
+
RSpec/AlignLeftLetBrace:
|
92
|
+
Description: Checks that left braces for adjacent single line lets are aligned.
|
93
|
+
Enabled: false
|
94
|
+
VersionAdded: '1.16'
|
95
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignLeftLetBrace
|
96
|
+
|
97
|
+
RSpec/AlignRightLetBrace:
|
98
|
+
Description: Checks that right braces for adjacent single line lets are aligned.
|
99
|
+
Enabled: false
|
100
|
+
VersionAdded: '1.16'
|
101
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AlignRightLetBrace
|
102
|
+
|
103
|
+
RSpec/AnyInstance:
|
104
|
+
Description: Check that instances are not being stubbed globally.
|
105
|
+
Enabled: false # The example is good, but it does not work if you can not access the instance that needs to be stubbed
|
106
|
+
VersionAdded: '1.4'
|
107
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AnyInstance
|
108
|
+
|
109
|
+
RSpec/AroundBlock:
|
110
|
+
Description: Checks that around blocks actually run the test.
|
111
|
+
Enabled: true
|
112
|
+
VersionAdded: '1.11'
|
113
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/AroundBlock
|
114
|
+
|
115
|
+
RSpec/Be:
|
116
|
+
Description: Check for expectations where `be` is used without argument.
|
117
|
+
Enabled: true
|
118
|
+
VersionAdded: '1.25'
|
119
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Be
|
120
|
+
|
121
|
+
RSpec/BeEql:
|
122
|
+
Description: Check for expectations where `be(...)` can replace `eql(...)`.
|
123
|
+
Enabled: true
|
124
|
+
VersionAdded: '1.7'
|
125
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeEql
|
126
|
+
|
127
|
+
RSpec/BeforeAfterAll:
|
128
|
+
Description: Check that before/after(:all) isn't being used.
|
129
|
+
Enabled: true
|
130
|
+
Exclude:
|
131
|
+
- spec/spec_helper.rb
|
132
|
+
- spec/rails_helper.rb
|
133
|
+
- spec/support/**/*.rb
|
134
|
+
VersionAdded: '1.12'
|
135
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/BeforeAfterAll
|
136
|
+
|
137
|
+
RSpec/ContextMethod:
|
138
|
+
Description: "`context` should not be used for specifying methods."
|
139
|
+
Enabled: true
|
140
|
+
VersionAdded: '1.36'
|
141
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextMethod
|
142
|
+
|
143
|
+
RSpec/ContextWording:
|
144
|
+
Description: Checks that `context` docstring starts with an allowed prefix.
|
145
|
+
Enabled: false # It is nice to follow this approach but we do not want to enforce it
|
146
|
+
Prefixes:
|
147
|
+
- when
|
148
|
+
- with
|
149
|
+
- without
|
150
|
+
VersionAdded: '1.20'
|
151
|
+
VersionChanged: 1.20.1
|
152
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
|
153
|
+
|
154
|
+
RSpec/DescribeClass:
|
155
|
+
Description: Check that the first argument to the top-level describe is a constant.
|
156
|
+
Enabled: false # It is nice to follow this approach but we do not want to enforce it
|
157
|
+
IgnoredMetadata:
|
158
|
+
type:
|
159
|
+
- channel
|
160
|
+
- controller
|
161
|
+
- helper
|
162
|
+
- job
|
163
|
+
- mailer
|
164
|
+
- model
|
165
|
+
- request
|
166
|
+
- routing
|
167
|
+
- view
|
168
|
+
- feature
|
169
|
+
- system
|
170
|
+
- mailbox
|
171
|
+
- aruba
|
172
|
+
VersionAdded: '1.0'
|
173
|
+
VersionChanged: '1.44'
|
174
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
|
175
|
+
|
176
|
+
RSpec/DescribeMethod:
|
177
|
+
Description: Checks that the second argument to `describe` specifies a method.
|
178
|
+
Enabled: true
|
179
|
+
VersionAdded: '1.0'
|
180
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeMethod
|
181
|
+
|
182
|
+
RSpec/DescribeSymbol:
|
183
|
+
Description: Avoid describing symbols.
|
184
|
+
Enabled: true
|
185
|
+
VersionAdded: '1.15'
|
186
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeSymbol
|
187
|
+
|
188
|
+
RSpec/DescribedClass:
|
189
|
+
Description: Checks that tests use `described_class`.
|
190
|
+
Enabled: true
|
191
|
+
SkipBlocks: false
|
192
|
+
EnforcedStyle: described_class
|
193
|
+
SupportedStyles:
|
194
|
+
- described_class
|
195
|
+
- explicit
|
196
|
+
SafeAutoCorrect: false
|
197
|
+
VersionAdded: '1.0'
|
198
|
+
VersionChanged: '1.11'
|
199
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClass
|
200
|
+
|
201
|
+
RSpec/DescribedClassModuleWrapping:
|
202
|
+
Description: Avoid opening modules and defining specs within them.
|
203
|
+
Enabled: false
|
204
|
+
VersionAdded: '1.37'
|
205
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribedClassModuleWrapping
|
206
|
+
|
207
|
+
RSpec/Dialect:
|
208
|
+
Description: This cop enforces custom RSpec dialects.
|
209
|
+
Enabled: false
|
210
|
+
PreferredMethods: {}
|
211
|
+
VersionAdded: '1.33'
|
212
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Dialect
|
213
|
+
|
214
|
+
RSpec/EmptyExampleGroup:
|
215
|
+
Description: Checks if an example group does not include any tests.
|
216
|
+
Enabled: true
|
217
|
+
VersionAdded: '1.7'
|
218
|
+
VersionChanged: '2.0'
|
219
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
|
220
|
+
|
221
|
+
RSpec/EmptyHook:
|
222
|
+
Description: Checks for empty before and after hooks.
|
223
|
+
Enabled: true
|
224
|
+
VersionAdded: '1.39'
|
225
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyHook
|
226
|
+
|
227
|
+
RSpec/EmptyLineAfterExample:
|
228
|
+
Description: Checks if there is an empty line after example blocks.
|
229
|
+
Enabled: true
|
230
|
+
AllowConsecutiveOneLiners: true
|
231
|
+
VersionAdded: '1.36'
|
232
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExample
|
233
|
+
|
234
|
+
RSpec/EmptyLineAfterExampleGroup:
|
235
|
+
Description: Checks if there is an empty line after example group blocks.
|
236
|
+
Enabled: true
|
237
|
+
VersionAdded: '1.27'
|
238
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterExampleGroup
|
239
|
+
|
240
|
+
RSpec/EmptyLineAfterFinalLet:
|
241
|
+
Description: Checks if there is an empty line after the last let block.
|
242
|
+
Enabled: true
|
243
|
+
VersionAdded: '1.14'
|
244
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterFinalLet
|
245
|
+
|
246
|
+
RSpec/EmptyLineAfterHook:
|
247
|
+
Description: Checks if there is an empty line after hook blocks.
|
248
|
+
Enabled: true
|
249
|
+
VersionAdded: '1.27'
|
250
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterHook
|
251
|
+
|
252
|
+
RSpec/EmptyLineAfterSubject:
|
253
|
+
Description: Checks if there is an empty line after subject block.
|
254
|
+
Enabled: true
|
255
|
+
VersionAdded: '1.14'
|
256
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyLineAfterSubject
|
257
|
+
|
258
|
+
RSpec/ExampleLength:
|
259
|
+
Description: Checks for long examples.
|
260
|
+
Enabled: false # We do not want to have such limitation
|
261
|
+
Max: 5
|
262
|
+
VersionAdded: '1.5'
|
263
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleLength
|
264
|
+
|
265
|
+
RSpec/ExampleWithoutDescription:
|
266
|
+
Description: Checks for examples without a description.
|
267
|
+
Enabled: true
|
268
|
+
EnforcedStyle: always_allow
|
269
|
+
SupportedStyles:
|
270
|
+
- always_allow
|
271
|
+
- single_line_only
|
272
|
+
- disallow
|
273
|
+
VersionAdded: '1.22'
|
274
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWithoutDescription
|
275
|
+
|
276
|
+
RSpec/ExampleWording:
|
277
|
+
Description: Checks for common mistakes in example descriptions.
|
278
|
+
Enabled: true
|
279
|
+
CustomTransform:
|
280
|
+
be: is
|
281
|
+
BE: IS
|
282
|
+
have: has
|
283
|
+
HAVE: HAS
|
284
|
+
IgnoredWords: []
|
285
|
+
VersionAdded: '1.0'
|
286
|
+
VersionChanged: '1.2'
|
287
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
|
288
|
+
|
289
|
+
RSpec/ExpectActual:
|
290
|
+
Description: Checks for `expect(...)` calls containing literal values.
|
291
|
+
Enabled: true
|
292
|
+
Exclude:
|
293
|
+
- spec/routing/**/*
|
294
|
+
VersionAdded: '1.7'
|
295
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectActual
|
296
|
+
|
297
|
+
RSpec/ExpectChange:
|
298
|
+
Description: Checks for consistent style of change matcher.
|
299
|
+
Enabled: true
|
300
|
+
EnforcedStyle: method_call
|
301
|
+
SupportedStyles:
|
302
|
+
- method_call
|
303
|
+
- block
|
304
|
+
VersionAdded: '1.22'
|
305
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectChange
|
306
|
+
|
307
|
+
RSpec/ExpectInHook:
|
308
|
+
Description: Do not use `expect` in hooks such as `before`.
|
309
|
+
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)
|
310
|
+
VersionAdded: '1.16'
|
311
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectInHook
|
312
|
+
|
313
|
+
RSpec/ExpectOutput:
|
314
|
+
Description: Checks for opportunities to use `expect { ... }.to output`.
|
315
|
+
Enabled: true
|
316
|
+
VersionAdded: '1.10'
|
317
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExpectOutput
|
318
|
+
|
319
|
+
RSpec/FilePath:
|
320
|
+
Description: Checks that spec file paths are consistent and well-formed.
|
321
|
+
Enabled: true
|
322
|
+
Include:
|
323
|
+
- "**/*_spec*rb*"
|
324
|
+
- "**/spec/**/*"
|
325
|
+
CustomTransform:
|
326
|
+
RuboCop: rubocop
|
327
|
+
RSpec: rspec
|
328
|
+
IgnoreMethods: false
|
329
|
+
SpecSuffixOnly: false
|
330
|
+
VersionAdded: '1.2'
|
331
|
+
VersionChanged: '1.40'
|
332
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FilePath
|
333
|
+
|
334
|
+
RSpec/Focus:
|
335
|
+
Description: Checks if examples are focused.
|
336
|
+
Enabled: true
|
337
|
+
VersionAdded: '1.5'
|
338
|
+
VersionChanged: '2.1'
|
339
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
|
340
|
+
|
341
|
+
RSpec/HookArgument:
|
342
|
+
Description: Checks the arguments passed to `before`, `around`, and `after`.
|
343
|
+
Enabled: true
|
344
|
+
EnforcedStyle: implicit
|
345
|
+
SupportedStyles:
|
346
|
+
- implicit
|
347
|
+
- each
|
348
|
+
- example
|
349
|
+
VersionAdded: '1.7'
|
350
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HookArgument
|
351
|
+
|
352
|
+
RSpec/HooksBeforeExamples:
|
353
|
+
Description: Checks for before/around/after hooks that come after an example.
|
354
|
+
Enabled: true
|
355
|
+
VersionAdded: '1.29'
|
356
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/HooksBeforeExamples
|
357
|
+
|
358
|
+
RSpec/ImplicitBlockExpectation:
|
359
|
+
Description: Check that implicit block expectation syntax is not used.
|
360
|
+
Enabled: true
|
361
|
+
VersionAdded: '1.35'
|
362
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitBlockExpectation
|
363
|
+
|
364
|
+
RSpec/ImplicitExpect:
|
365
|
+
Description: Check that a consistent implicit expectation style is used.
|
366
|
+
Enabled: true
|
367
|
+
EnforcedStyle: is_expected
|
368
|
+
SupportedStyles:
|
369
|
+
- is_expected
|
370
|
+
- should
|
371
|
+
VersionAdded: '1.8'
|
372
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitExpect
|
373
|
+
|
374
|
+
RSpec/ImplicitSubject:
|
375
|
+
Description: Checks for usage of implicit subject (`is_expected` / `should`).
|
376
|
+
Enabled: true # Maybe we want to change this to false in the future
|
377
|
+
EnforcedStyle: single_line_only
|
378
|
+
SupportedStyles:
|
379
|
+
- single_line_only
|
380
|
+
- single_statement_only
|
381
|
+
- disallow
|
382
|
+
VersionAdded: '1.29'
|
383
|
+
VersionChanged: '1.30'
|
384
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ImplicitSubject
|
385
|
+
|
386
|
+
RSpec/InstanceSpy:
|
387
|
+
Description: Checks for `instance_double` used with `have_received`.
|
388
|
+
Enabled: true
|
389
|
+
VersionAdded: '1.12'
|
390
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceSpy
|
391
|
+
|
392
|
+
RSpec/InstanceVariable:
|
393
|
+
Description: Checks for instance variable usage in specs.
|
394
|
+
Enabled: false # It's good to prefer let over an instance variable. But there are legit cases for instance variables.
|
395
|
+
AssignmentOnly: false
|
396
|
+
VersionAdded: '1.0'
|
397
|
+
VersionChanged: '1.7'
|
398
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
|
399
|
+
|
400
|
+
RSpec/ItBehavesLike:
|
401
|
+
Description: Checks that only one `it_behaves_like` style is used.
|
402
|
+
Enabled: true
|
403
|
+
EnforcedStyle: it_behaves_like
|
404
|
+
SupportedStyles:
|
405
|
+
- it_behaves_like
|
406
|
+
- it_should_behave_like
|
407
|
+
VersionAdded: '1.13'
|
408
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ItBehavesLike
|
409
|
+
|
410
|
+
RSpec/IteratedExpectation:
|
411
|
+
Description: Check that `all` matcher is used instead of iterating over an array.
|
412
|
+
Enabled: true
|
413
|
+
VersionAdded: '1.14'
|
414
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/IteratedExpectation
|
415
|
+
|
416
|
+
RSpec/LeadingSubject:
|
417
|
+
Description: Enforce that subject is the first definition in the test.
|
418
|
+
Enabled: false # We don't do this
|
419
|
+
VersionAdded: '1.7'
|
420
|
+
VersionChanged: '1.14'
|
421
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeadingSubject
|
422
|
+
|
423
|
+
RSpec/LeakyConstantDeclaration:
|
424
|
+
Description: Checks that no class, module, or constant is declared.
|
425
|
+
Enabled: true
|
426
|
+
VersionAdded: '1.35'
|
427
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LeakyConstantDeclaration
|
428
|
+
|
429
|
+
RSpec/LetBeforeExamples:
|
430
|
+
Description: Checks for `let` definitions that come after an example.
|
431
|
+
Enabled: true
|
432
|
+
VersionAdded: '1.16'
|
433
|
+
VersionChanged: '1.22'
|
434
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
|
435
|
+
|
436
|
+
RSpec/LetSetup:
|
437
|
+
Description: Checks unreferenced `let!` calls being used for test setup.
|
438
|
+
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
|
439
|
+
VersionAdded: '1.7'
|
440
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetSetup
|
441
|
+
|
442
|
+
RSpec/MessageChain:
|
443
|
+
Description: Check that chains of messages are not being stubbed.
|
444
|
+
Enabled: true
|
445
|
+
VersionAdded: '1.7'
|
446
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageChain
|
447
|
+
|
448
|
+
RSpec/MessageExpectation:
|
449
|
+
Description: Checks for consistent message expectation style.
|
450
|
+
Enabled: false
|
451
|
+
EnforcedStyle: allow
|
452
|
+
SupportedStyles:
|
453
|
+
- allow
|
454
|
+
- expect
|
455
|
+
VersionAdded: '1.7'
|
456
|
+
VersionChanged: '1.8'
|
457
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageExpectation
|
458
|
+
|
459
|
+
RSpec/MessageSpies:
|
460
|
+
Description: Checks that message expectations are set using spies.
|
461
|
+
Enabled: true
|
462
|
+
EnforcedStyle: receive # We usually use receive as it is defined before the expectation line and not after
|
463
|
+
SupportedStyles:
|
464
|
+
- have_received
|
465
|
+
- receive
|
466
|
+
VersionAdded: '1.9'
|
467
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MessageSpies
|
468
|
+
|
469
|
+
RSpec/MissingExampleGroupArgument:
|
470
|
+
Description: Checks that the first argument to an example group is not empty.
|
471
|
+
Enabled: true
|
472
|
+
VersionAdded: '1.28'
|
473
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
|
474
|
+
|
475
|
+
RSpec/MultipleDescribes:
|
476
|
+
Description: Checks for multiple top-level example groups.
|
477
|
+
Enabled: true
|
478
|
+
VersionAdded: '1.0'
|
479
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
|
480
|
+
|
481
|
+
RSpec/MultipleExpectations:
|
482
|
+
Description: Checks if examples contain too many `expect` calls.
|
483
|
+
Enabled: false # We do not want to have such limitation
|
484
|
+
Max: 1
|
485
|
+
VersionAdded: '1.7'
|
486
|
+
VersionChanged: '1.21'
|
487
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
|
488
|
+
|
489
|
+
RSpec/MultipleMemoizedHelpers:
|
490
|
+
Description: Checks if example groups contain too many `let` and `subject` calls.
|
491
|
+
Enabled: false # We try to reduce the number of lets if possible, but no need to enforce it
|
492
|
+
AllowSubject: true
|
493
|
+
Max: 5
|
494
|
+
VersionAdded: '1.43'
|
495
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers
|
496
|
+
|
497
|
+
RSpec/MultipleSubjects:
|
498
|
+
Description: Checks if an example group defines `subject` multiple times.
|
499
|
+
Enabled: true
|
500
|
+
VersionAdded: '1.16'
|
501
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleSubjects
|
502
|
+
|
503
|
+
RSpec/NamedSubject:
|
504
|
+
Description: Checks for explicitly referenced test subjects.
|
505
|
+
Enabled: false # https://github.com/makandra/makandra-rubocop/issues/23 - good default but not enforced
|
506
|
+
IgnoreSharedExamples: true
|
507
|
+
VersionAdded: 1.5.3
|
508
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NamedSubject
|
509
|
+
|
510
|
+
RSpec/NestedGroups:
|
511
|
+
Description: Checks for nested example groups.
|
512
|
+
Enabled: false # We do not want to have such limitation
|
513
|
+
Max: 3
|
514
|
+
VersionAdded: '1.7'
|
515
|
+
VersionChanged: '1.10'
|
516
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NestedGroups
|
517
|
+
|
518
|
+
RSpec/NotToNot:
|
519
|
+
Description: Checks for consistent method usage for negating expectations.
|
520
|
+
Enabled: true
|
521
|
+
EnforcedStyle: not_to
|
522
|
+
SupportedStyles:
|
523
|
+
- not_to
|
524
|
+
- to_not
|
525
|
+
VersionAdded: '1.4'
|
526
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/NotToNot
|
527
|
+
|
528
|
+
RSpec/OverwritingSetup:
|
529
|
+
Description: Checks if there is a let/subject that overwrites an existing one.
|
530
|
+
Enabled: true # This would break tests, but it's worth the effort
|
531
|
+
VersionAdded: '1.14'
|
532
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/OverwritingSetup
|
533
|
+
|
534
|
+
RSpec/Pending:
|
535
|
+
Description: Checks for any pending or skipped examples.
|
536
|
+
Enabled: false
|
537
|
+
VersionAdded: '1.25'
|
538
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Pending
|
539
|
+
|
540
|
+
RSpec/PredicateMatcher:
|
541
|
+
Description: Prefer using predicate matcher over using predicate method directly.
|
542
|
+
Enabled: true # Maybe we need to remove this in the future
|
543
|
+
Strict: true
|
544
|
+
EnforcedStyle: inflected
|
545
|
+
AllowedExplicitMatchers: []
|
546
|
+
SupportedStyles:
|
547
|
+
- inflected
|
548
|
+
- explicit
|
549
|
+
SafeAutoCorrect: false
|
550
|
+
VersionAdded: '1.16'
|
551
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/PredicateMatcher
|
552
|
+
|
553
|
+
RSpec/ReceiveCounts:
|
554
|
+
Description: Check for `once` and `twice` receive counts matchers usage.
|
555
|
+
Enabled: true
|
556
|
+
VersionAdded: '1.26'
|
557
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveCounts
|
558
|
+
|
559
|
+
RSpec/ReceiveNever:
|
560
|
+
Description: Prefer `not_to receive(...)` over `receive(...).never`.
|
561
|
+
Enabled: true
|
562
|
+
VersionAdded: '1.28'
|
563
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReceiveNever
|
564
|
+
|
565
|
+
RSpec/RepeatedDescription:
|
566
|
+
Description: Check for repeated description strings in example groups.
|
567
|
+
Enabled: true
|
568
|
+
VersionAdded: '1.9'
|
569
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedDescription
|
570
|
+
|
571
|
+
RSpec/RepeatedExample:
|
572
|
+
Description: Check for repeated examples within example groups.
|
573
|
+
Enabled: true
|
574
|
+
VersionAdded: '1.10'
|
575
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample
|
576
|
+
|
577
|
+
RSpec/RepeatedExampleGroupBody:
|
578
|
+
Description: Check for repeated describe and context block body.
|
579
|
+
Enabled: true
|
580
|
+
VersionAdded: '1.38'
|
581
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupBody
|
582
|
+
|
583
|
+
RSpec/RepeatedExampleGroupDescription:
|
584
|
+
Description: Check for repeated example group descriptions.
|
585
|
+
Enabled: true
|
586
|
+
VersionAdded: '1.38'
|
587
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
|
588
|
+
|
589
|
+
RSpec/RepeatedIncludeExample:
|
590
|
+
Description: Check for repeated include of shared examples.
|
591
|
+
Enabled: true
|
592
|
+
VersionAdded: '1.44'
|
593
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedIncludeExample
|
594
|
+
|
595
|
+
RSpec/ReturnFromStub:
|
596
|
+
Description: Checks for consistent style of stub's return setting.
|
597
|
+
Enabled: true
|
598
|
+
EnforcedStyle: and_return
|
599
|
+
SupportedStyles:
|
600
|
+
- and_return
|
601
|
+
- block
|
602
|
+
VersionAdded: '1.16'
|
603
|
+
VersionChanged: '1.22'
|
604
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ReturnFromStub
|
605
|
+
|
606
|
+
RSpec/ScatteredLet:
|
607
|
+
Description: Checks for let scattered across the example group.
|
608
|
+
Enabled: true
|
609
|
+
VersionAdded: '1.14'
|
610
|
+
VersionChanged: '1.39'
|
611
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredLet
|
612
|
+
|
613
|
+
RSpec/ScatteredSetup:
|
614
|
+
Description: Checks for setup scattered across multiple hooks in an example group.
|
615
|
+
Enabled: true
|
616
|
+
VersionAdded: '1.10'
|
617
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ScatteredSetup
|
618
|
+
|
619
|
+
RSpec/SharedContext:
|
620
|
+
Description: Checks for proper shared_context and shared_examples usage.
|
621
|
+
Enabled: true
|
622
|
+
VersionAdded: '1.13'
|
623
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedContext
|
624
|
+
|
625
|
+
RSpec/SharedExamples:
|
626
|
+
Description: Enforces use of string to titleize shared examples.
|
627
|
+
Enabled: true
|
628
|
+
VersionAdded: '1.25'
|
629
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SharedExamples
|
630
|
+
|
631
|
+
RSpec/SingleArgumentMessageChain:
|
632
|
+
Description: Checks that chains of messages contain more than one element.
|
633
|
+
Enabled: true
|
634
|
+
VersionAdded: '1.9'
|
635
|
+
VersionChanged: '1.10'
|
636
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
|
637
|
+
|
638
|
+
RSpec/StubbedMock:
|
639
|
+
Description: Checks that message expectations do not have a configured response.
|
640
|
+
Enabled: false # Maybe add later, currently there are too many conflicts
|
641
|
+
VersionAdded: '1.44'
|
642
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/StubbedMock
|
643
|
+
|
644
|
+
RSpec/SubjectStub:
|
645
|
+
Description: Checks for stubbed test subjects.
|
646
|
+
Enabled: false #https://github.com/makandra/makandra-rubocop/issues/24
|
647
|
+
VersionAdded: '1.7'
|
648
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SubjectStub
|
649
|
+
|
650
|
+
RSpec/UnspecifiedException:
|
651
|
+
Description: Checks for a specified error in checking raised errors.
|
652
|
+
Enabled: true
|
653
|
+
VersionAdded: '1.30'
|
654
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/UnspecifiedException
|
655
|
+
|
656
|
+
RSpec/VariableDefinition:
|
657
|
+
Description: Checks that memoized helpers names are symbols or strings.
|
658
|
+
Enabled: true
|
659
|
+
EnforcedStyle: symbols
|
660
|
+
SupportedStyles:
|
661
|
+
- symbols
|
662
|
+
- strings
|
663
|
+
VersionAdded: '1.40'
|
664
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableDefinition
|
665
|
+
|
666
|
+
RSpec/VariableName:
|
667
|
+
Description: Checks that memoized helper names use the configured style.
|
668
|
+
Enabled: true
|
669
|
+
EnforcedStyle: snake_case
|
670
|
+
SupportedStyles:
|
671
|
+
- snake_case
|
672
|
+
- camelCase
|
673
|
+
IgnoredPatterns: []
|
674
|
+
VersionAdded: '1.40'
|
675
|
+
VersionChanged: '1.43'
|
676
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
|
677
|
+
|
678
|
+
RSpec/VerifiedDoubles:
|
679
|
+
Description: Prefer using verifying doubles over normal doubles.
|
680
|
+
Enabled: true
|
681
|
+
IgnoreNameless: true
|
682
|
+
IgnoreSymbolicNames: false
|
683
|
+
VersionAdded: 1.2.1
|
684
|
+
VersionChanged: '1.5'
|
685
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VerifiedDoubles
|
686
|
+
|
687
|
+
RSpec/VoidExpect:
|
688
|
+
Description: This cop checks void `expect()`.
|
689
|
+
Enabled: true
|
690
|
+
VersionAdded: '1.16'
|
691
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VoidExpect
|
692
|
+
|
693
|
+
RSpec/Yield:
|
694
|
+
Description: This cop checks for calling a block within a stub.
|
695
|
+
Enabled: true
|
696
|
+
VersionAdded: '1.32'
|
697
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
|
698
|
+
|
699
|
+
RSpec/Capybara/CurrentPathExpectation:
|
700
|
+
Description: Checks that no expectations are set on Capybara's `current_path`.
|
701
|
+
Enabled: true
|
702
|
+
VersionAdded: '1.18'
|
703
|
+
VersionChanged: '2.0'
|
704
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
|
705
|
+
|
706
|
+
RSpec/Capybara/FeatureMethods:
|
707
|
+
Description: Checks for consistent method usage in feature specs.
|
708
|
+
Enabled: true
|
709
|
+
EnabledMethods: []
|
710
|
+
VersionAdded: '1.17'
|
711
|
+
VersionChanged: '2.0'
|
712
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
713
|
+
|
714
|
+
RSpec/Capybara/VisibilityMatcher:
|
715
|
+
Description: Checks for boolean visibility in capybara finders.
|
716
|
+
Enabled: true
|
717
|
+
VersionAdded: '1.39'
|
718
|
+
VersionChanged: '2.0'
|
719
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
|
720
|
+
|
721
|
+
RSpec/FactoryBot/AttributeDefinedStatically:
|
722
|
+
Description: Always declare attribute values as blocks.
|
723
|
+
Enabled: true
|
724
|
+
Include:
|
725
|
+
- spec/factories.rb
|
726
|
+
- spec/factories/**/*.rb
|
727
|
+
- features/support/factories/**/*.rb
|
728
|
+
VersionAdded: '1.28'
|
729
|
+
VersionChanged: '2.0'
|
730
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
|
731
|
+
|
732
|
+
RSpec/FactoryBot/CreateList:
|
733
|
+
Description: Checks for create_list usage.
|
734
|
+
Enabled: true
|
735
|
+
Include:
|
736
|
+
- "**/*_spec.rb"
|
737
|
+
- "**/spec/**/*"
|
738
|
+
- spec/factories.rb
|
739
|
+
- spec/factories/**/*.rb
|
740
|
+
- features/support/factories/**/*.rb
|
741
|
+
EnforcedStyle: create_list
|
742
|
+
SupportedStyles:
|
743
|
+
- create_list
|
744
|
+
- n_times
|
745
|
+
VersionAdded: '1.25'
|
746
|
+
VersionChanged: '2.0'
|
747
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
|
748
|
+
|
749
|
+
RSpec/FactoryBot/FactoryClassName:
|
750
|
+
Description: Use string value when setting the class attribute explicitly.
|
751
|
+
Enabled: true
|
752
|
+
Include:
|
753
|
+
- spec/factories.rb
|
754
|
+
- spec/factories/**/*.rb
|
755
|
+
- features/support/factories/**/*.rb
|
756
|
+
VersionAdded: '1.37'
|
757
|
+
VersionChanged: '2.0'
|
758
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
759
|
+
|
760
|
+
RSpec/Rails/HttpStatus:
|
761
|
+
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
762
|
+
Enabled: false # This should not be enforced
|
763
|
+
EnforcedStyle: symbolic
|
764
|
+
SupportedStyles:
|
765
|
+
- numeric
|
766
|
+
- symbolic
|
767
|
+
VersionAdded: '1.23'
|
768
|
+
VersionChanged: '2.0'
|
769
|
+
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|