makandra-rubocop 5.4.0 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +34 -31
- data/README.md +16 -8
- data/config/default.yml +910 -132
- data/config/ext/rails.yml +225 -12
- data/config/ext/rspec.yml +155 -27
- data/lib/makandra_rubocop/version.rb +1 -1
- data/makandra-rubocop.gemspec +3 -3
- metadata +8 -8
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
|
data/config/ext/rspec.yml
CHANGED
@@ -5,16 +5,88 @@ inherit_mode:
|
|
5
5
|
merge:
|
6
6
|
- Exclude
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
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!
|
18
90
|
|
19
91
|
RSpec/AlignLeftLetBrace:
|
20
92
|
Description: Checks that left braces for adjacent single line lets are aligned.
|
@@ -80,9 +152,25 @@ RSpec/ContextWording:
|
|
80
152
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ContextWording
|
81
153
|
|
82
154
|
RSpec/DescribeClass:
|
83
|
-
Description: Check that the first argument to the top
|
155
|
+
Description: Check that the first argument to the top-level describe is a constant.
|
84
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
|
85
172
|
VersionAdded: '1.0'
|
173
|
+
VersionChanged: '1.44'
|
86
174
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/DescribeClass
|
87
175
|
|
88
176
|
RSpec/DescribeMethod:
|
@@ -126,8 +214,8 @@ RSpec/Dialect:
|
|
126
214
|
RSpec/EmptyExampleGroup:
|
127
215
|
Description: Checks if an example group does not include any tests.
|
128
216
|
Enabled: true
|
129
|
-
CustomIncludeMethods: []
|
130
217
|
VersionAdded: '1.7'
|
218
|
+
VersionChanged: '2.0'
|
131
219
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/EmptyExampleGroup
|
132
220
|
|
133
221
|
RSpec/EmptyHook:
|
@@ -231,6 +319,9 @@ RSpec/ExpectOutput:
|
|
231
319
|
RSpec/FilePath:
|
232
320
|
Description: Checks that spec file paths are consistent and well-formed.
|
233
321
|
Enabled: true
|
322
|
+
Include:
|
323
|
+
- "**/*_spec*rb*"
|
324
|
+
- "**/spec/**/*"
|
234
325
|
CustomTransform:
|
235
326
|
RuboCop: rubocop
|
236
327
|
RSpec: rspec
|
@@ -244,6 +335,7 @@ RSpec/Focus:
|
|
244
335
|
Description: Checks if examples are focused.
|
245
336
|
Enabled: true
|
246
337
|
VersionAdded: '1.5'
|
338
|
+
VersionChanged: '2.1'
|
247
339
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Focus
|
248
340
|
|
249
341
|
RSpec/HookArgument:
|
@@ -305,12 +397,6 @@ RSpec/InstanceVariable:
|
|
305
397
|
VersionChanged: '1.7'
|
306
398
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable
|
307
399
|
|
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
400
|
RSpec/ItBehavesLike:
|
315
401
|
Description: Checks that only one `it_behaves_like` style is used.
|
316
402
|
Enabled: true
|
@@ -387,7 +473,7 @@ RSpec/MissingExampleGroupArgument:
|
|
387
473
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MissingExampleGroupArgument
|
388
474
|
|
389
475
|
RSpec/MultipleDescribes:
|
390
|
-
Description: Checks for multiple top
|
476
|
+
Description: Checks for multiple top-level example groups.
|
391
477
|
Enabled: true
|
392
478
|
VersionAdded: '1.0'
|
393
479
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleDescribes
|
@@ -400,6 +486,14 @@ RSpec/MultipleExpectations:
|
|
400
486
|
VersionChanged: '1.21'
|
401
487
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleExpectations
|
402
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
|
+
|
403
497
|
RSpec/MultipleSubjects:
|
404
498
|
Description: Checks if an example group defines `subject` multiple times.
|
405
499
|
Enabled: true
|
@@ -492,6 +586,12 @@ RSpec/RepeatedExampleGroupDescription:
|
|
492
586
|
VersionAdded: '1.38'
|
493
587
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExampleGroupDescription
|
494
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
|
+
|
495
595
|
RSpec/ReturnFromStub:
|
496
596
|
Description: Checks for consistent style of stub's return setting.
|
497
597
|
Enabled: true
|
@@ -535,6 +635,12 @@ RSpec/SingleArgumentMessageChain:
|
|
535
635
|
VersionChanged: '1.10'
|
536
636
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/SingleArgumentMessageChain
|
537
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
|
+
|
538
644
|
RSpec/SubjectStub:
|
539
645
|
Description: Checks for stubbed test subjects.
|
540
646
|
Enabled: false #https://github.com/makandra/makandra-rubocop/issues/24
|
@@ -564,7 +670,9 @@ RSpec/VariableName:
|
|
564
670
|
SupportedStyles:
|
565
671
|
- snake_case
|
566
672
|
- camelCase
|
673
|
+
IgnoredPatterns: []
|
567
674
|
VersionAdded: '1.40'
|
675
|
+
VersionChanged: '1.43'
|
568
676
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/VariableName
|
569
677
|
|
570
678
|
RSpec/VerifiedDoubles:
|
@@ -588,49 +696,68 @@ RSpec/Yield:
|
|
588
696
|
VersionAdded: '1.32'
|
589
697
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Yield
|
590
698
|
|
591
|
-
Capybara/CurrentPathExpectation:
|
699
|
+
RSpec/Capybara/CurrentPathExpectation:
|
592
700
|
Description: Checks that no expectations are set on Capybara's `current_path`.
|
593
701
|
Enabled: true
|
594
702
|
VersionAdded: '1.18'
|
703
|
+
VersionChanged: '2.0'
|
595
704
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/CurrentPathExpectation
|
596
705
|
|
597
|
-
Capybara/FeatureMethods:
|
706
|
+
RSpec/Capybara/FeatureMethods:
|
598
707
|
Description: Checks for consistent method usage in feature specs.
|
599
708
|
Enabled: true
|
600
709
|
EnabledMethods: []
|
601
710
|
VersionAdded: '1.17'
|
602
|
-
VersionChanged: '
|
711
|
+
VersionChanged: '2.0'
|
603
712
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/FeatureMethods
|
604
713
|
|
605
|
-
Capybara/VisibilityMatcher:
|
714
|
+
RSpec/Capybara/VisibilityMatcher:
|
606
715
|
Description: Checks for boolean visibility in capybara finders.
|
607
716
|
Enabled: true
|
608
717
|
VersionAdded: '1.39'
|
718
|
+
VersionChanged: '2.0'
|
609
719
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Capybara/VisibilityMatcher
|
610
720
|
|
611
|
-
FactoryBot/AttributeDefinedStatically:
|
721
|
+
RSpec/FactoryBot/AttributeDefinedStatically:
|
612
722
|
Description: Always declare attribute values as blocks.
|
613
723
|
Enabled: true
|
724
|
+
Include:
|
725
|
+
- spec/factories.rb
|
726
|
+
- spec/factories/**/*.rb
|
727
|
+
- features/support/factories/**/*.rb
|
614
728
|
VersionAdded: '1.28'
|
729
|
+
VersionChanged: '2.0'
|
615
730
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/AttributeDefinedStatically
|
616
731
|
|
617
|
-
FactoryBot/CreateList:
|
732
|
+
RSpec/FactoryBot/CreateList:
|
618
733
|
Description: Checks for create_list usage.
|
619
734
|
Enabled: true
|
735
|
+
Include:
|
736
|
+
- "**/*_spec.rb"
|
737
|
+
- "**/spec/**/*"
|
738
|
+
- spec/factories.rb
|
739
|
+
- spec/factories/**/*.rb
|
740
|
+
- features/support/factories/**/*.rb
|
620
741
|
EnforcedStyle: create_list
|
621
742
|
SupportedStyles:
|
622
743
|
- create_list
|
623
744
|
- n_times
|
624
745
|
VersionAdded: '1.25'
|
746
|
+
VersionChanged: '2.0'
|
625
747
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/CreateList
|
626
748
|
|
627
|
-
FactoryBot/FactoryClassName:
|
749
|
+
RSpec/FactoryBot/FactoryClassName:
|
628
750
|
Description: Use string value when setting the class attribute explicitly.
|
629
751
|
Enabled: true
|
752
|
+
Include:
|
753
|
+
- spec/factories.rb
|
754
|
+
- spec/factories/**/*.rb
|
755
|
+
- features/support/factories/**/*.rb
|
630
756
|
VersionAdded: '1.37'
|
757
|
+
VersionChanged: '2.0'
|
631
758
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/FactoryBot/FactoryClassName
|
632
759
|
|
633
|
-
Rails/HttpStatus:
|
760
|
+
RSpec/Rails/HttpStatus:
|
634
761
|
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
635
762
|
Enabled: false # This should not be enforced
|
636
763
|
EnforcedStyle: symbolic
|
@@ -638,4 +765,5 @@ Rails/HttpStatus:
|
|
638
765
|
- numeric
|
639
766
|
- symbolic
|
640
767
|
VersionAdded: '1.23'
|
768
|
+
VersionChanged: '2.0'
|
641
769
|
StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/Rails/HttpStatus
|