standard-rails 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/config/base.yml CHANGED
@@ -1,15 +1,17 @@
1
- # Common configuration.
2
-
3
- inherit_mode:
4
- merge:
5
- - Exclude
6
-
7
1
  AllCops:
8
2
  Exclude:
9
3
  - bin/*
10
- - db/schema.rb
4
+ # Exclude db/schema.rb and db/[CONFIGURATION_NAMESPACE]_schema.rb by default.
5
+ # See: https://guides.rubyonrails.org/active_record_multiple_databases.html#setting-up-your-application
6
+ - db/*schema.rb
7
+ - log/**/*
8
+ - public/**/*
9
+ - storage/**/*
10
+ # Enable checking Active Support extensions.
11
+ # See: https://docs.rubocop.org/rubocop/configuration.html#enable-checking-active-support-extensions
12
+ ActiveSupportExtensionsEnabled: true
11
13
  # What version of Rails is the inspected code using? If a value is specified
12
- # for TargetRailsVersion then it is used. Acceptable values are specificed
14
+ # for TargetRailsVersion then it is used. Acceptable values are specified
13
15
  # as a float (i.e. 5.1); the patch version of Rails should not be included.
14
16
  # If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
15
17
  # gems.locked file to find the version of Rails that has been bound to the
@@ -17,9 +19,37 @@ AllCops:
17
19
  # as the default.
18
20
  TargetRailsVersion: ~
19
21
 
22
+ # This cop from rubocop was added to the Rubocop-Rails
23
+ # config as part of this PR:
24
+ # https://github.com/rubocop/rubocop-rails/pull/1014
25
+ # in order to support some Rails-specific methods. At the
26
+ # time of writing, it's disabled in Standard, so it's
27
+ # disabled here.
28
+ Lint/RedundantSafeNavigation:
29
+ Enabled: false
30
+
31
+ Rails:
32
+ DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails
33
+
34
+ Rails/ActionControllerFlashBeforeRender:
35
+ Enabled: false
36
+ Description: 'Use `flash.now` instead of `flash` before `render`.'
37
+ SafeAutoCorrect: false
38
+ VersionAdded: '2.16'
39
+
40
+ Rails/ActionControllerTestCase:
41
+ Enabled: false
42
+ Description: 'Use `ActionDispatch::IntegrationTest` instead of `ActionController::TestCase`.'
43
+ StyleGuide: 'https://rails.rubystyle.guide/#integration-testing'
44
+ Reference: 'https://api.rubyonrails.org/classes/ActionController/TestCase.html'
45
+ SafeAutoCorrect: false
46
+ VersionAdded: '2.14'
47
+ Include:
48
+ - '**/test/**/*.rb'
49
+
20
50
  Rails/ActionFilter:
51
+ Enabled: false
21
52
  Description: 'Enforces consistent use of action filter methods.'
22
- Enabled: true
23
53
  VersionAdded: '0.19'
24
54
  EnforcedStyle: action
25
55
  SupportedStyles:
@@ -27,109 +57,150 @@ Rails/ActionFilter:
27
57
  - filter
28
58
  Include:
29
59
  - app/controllers/**/*.rb
60
+ - app/mailers/**/*.rb
61
+
62
+ Rails/ActionOrder:
63
+ Enabled: false
64
+ Description: 'Enforce consistent ordering of controller actions.'
65
+ VersionAdded: '2.17'
66
+ ExpectedOrder:
67
+ - index
68
+ - show
69
+ - new
70
+ - edit
71
+ - create
72
+ - update
73
+ - destroy
74
+ Include:
75
+ - app/controllers/**/*.rb
30
76
 
31
77
  Rails/ActiveRecordAliases:
78
+ Enabled: false
32
79
  Description: >-
33
80
  Avoid Active Record aliases:
34
81
  Use `update` instead of `update_attributes`.
35
82
  Use `update!` instead of `update_attributes!`.
36
- Enabled: true
37
83
  VersionAdded: '0.53'
38
84
  SafeAutoCorrect: false
39
85
 
40
86
  Rails/ActiveRecordCallbacksOrder:
87
+ Enabled: false
41
88
  Description: 'Order callback declarations in the order in which they will be executed.'
42
89
  StyleGuide: 'https://rails.rubystyle.guide/#callbacks-order'
43
- Enabled: 'pending'
44
90
  VersionAdded: '2.7'
45
91
  Include:
46
92
  - app/models/**/*.rb
47
93
 
48
94
  Rails/ActiveRecordOverride:
95
+ Enabled: true
49
96
  Description: >-
50
97
  Check for overriding Active Record methods instead of using
51
98
  callbacks.
52
- Enabled: true
99
+ Severity: warning
53
100
  VersionAdded: '0.67'
101
+ VersionChanged: '2.18'
54
102
  Include:
55
103
  - app/models/**/*.rb
56
104
 
57
105
  Rails/ActiveSupportAliases:
106
+ Enabled: false
58
107
  Description: >-
59
108
  Avoid ActiveSupport aliases of standard ruby methods:
60
109
  `String#starts_with?`, `String#ends_with?`,
61
110
  `Array#append`, `Array#prepend`.
62
- Enabled: true
63
111
  VersionAdded: '0.48'
64
112
 
113
+ Rails/ActiveSupportOnLoad:
114
+ Enabled: false
115
+ Description: 'Use `ActiveSupport.on_load(...)` to patch Rails framework classes.'
116
+ Reference:
117
+ - 'https://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html'
118
+ - 'https://guides.rubyonrails.org/engines.html#available-load-hooks'
119
+ SafeAutoCorrect: false
120
+ VersionAdded: '2.16'
121
+
122
+ Rails/AddColumnIndex:
123
+ Enabled: false
124
+ Description: >-
125
+ Rails migrations don't make use of a given `index` key, but also
126
+ doesn't given an error when it's used, so it makes it seem like an
127
+ index might be used.
128
+ VersionAdded: '2.11'
129
+ Include:
130
+ - db/migrate/*.rb
131
+
65
132
  Rails/AfterCommitOverride:
133
+ Enabled: false
66
134
  Description: >-
67
- This cop enforces that there is only one call to `after_commit`
135
+ Enforces that there is only one call to `after_commit`
68
136
  (and its aliases - `after_create_commit`, `after_update_commit`,
69
137
  and `after_destroy_commit`) with the same callback name per model.
70
- Enabled: 'pending'
71
138
  VersionAdded: '2.8'
72
139
 
73
140
  Rails/ApplicationController:
74
- Description: 'Check that controllers subclass ApplicationController.'
75
141
  Enabled: true
142
+ Description: 'Check that controllers subclass ApplicationController.'
76
143
  SafeAutoCorrect: false
77
144
  VersionAdded: '2.4'
78
145
  VersionChanged: '2.5'
79
146
 
80
147
  Rails/ApplicationJob:
81
- Description: 'Check that jobs subclass ApplicationJob.'
82
148
  Enabled: true
149
+ Description: 'Check that jobs subclass ApplicationJob.'
83
150
  SafeAutoCorrect: false
84
151
  VersionAdded: '0.49'
85
152
  VersionChanged: '2.5'
86
153
 
87
154
  Rails/ApplicationMailer:
88
- Description: 'Check that mailers subclass ApplicationMailer.'
89
155
  Enabled: true
156
+ Description: 'Check that mailers subclass ApplicationMailer.'
90
157
  SafeAutoCorrect: false
91
158
  VersionAdded: '2.4'
92
159
  VersionChanged: '2.5'
93
160
 
94
161
  Rails/ApplicationRecord:
95
- Description: 'Check that models subclass ApplicationRecord.'
96
162
  Enabled: true
163
+ Description: 'Check that models subclass ApplicationRecord.'
97
164
  SafeAutoCorrect: false
98
165
  VersionAdded: '0.49'
99
166
  VersionChanged: '2.5'
100
167
 
101
168
  Rails/ArelStar:
169
+ Enabled: false
102
170
  Description: 'Enforces `Arel.star` instead of `"*"` for expanded columns.'
103
- Enabled: true
104
171
  SafeAutoCorrect: false
105
172
  VersionAdded: '2.9'
106
173
 
107
174
  Rails/AssertNot:
175
+ Enabled: false
108
176
  Description: 'Use `assert_not` instead of `assert !`.'
109
- Enabled: true
110
177
  VersionAdded: '0.56'
111
178
  Include:
112
179
  - '**/test/**/*'
113
180
 
114
181
  Rails/AttributeDefaultBlockValue:
182
+ Enabled: false
115
183
  Description: 'Pass method call in block for attribute option `default`.'
116
- Enabled: pending
117
184
  VersionAdded: '2.9'
118
185
  Include:
119
- - 'models/**/*'
186
+ - 'app/models/**/*'
120
187
 
121
188
  Rails/BelongsTo:
189
+ Enabled: true
122
190
  Description: >-
123
191
  Use `optional: true` instead of `required: false` for
124
192
  `belongs_to` relations.
125
- Enabled: true
193
+ Reference:
194
+ - https://guides.rubyonrails.org/5_0_release_notes.html
195
+ - https://github.com/rails/rails/pull/18937
126
196
  VersionAdded: '0.62'
127
197
 
128
198
  Rails/Blank:
129
- Description: 'Enforces use of `blank?`.'
130
199
  Enabled: true
200
+ Description: 'Enforces use of `blank?`.'
201
+ SafeAutoCorrect: false
131
202
  VersionAdded: '0.48'
132
- VersionChanged: '0.67'
203
+ VersionChanged: '2.10'
133
204
  # Convert usages of `nil? || empty?` to `blank?`
134
205
  NilOrEmpty: true
135
206
  # Convert usages of `!present?` to `blank?`
@@ -138,8 +209,11 @@ Rails/Blank:
138
209
  UnlessPresent: true
139
210
 
140
211
  Rails/BulkChangeTable:
212
+ Enabled: false
141
213
  Description: 'Check whether alter queries are combinable.'
142
- Enabled: true
214
+ Reference:
215
+ - https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-change_table
216
+ - https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/Table.html
143
217
  VersionAdded: '0.57'
144
218
  Database: null
145
219
  SupportedDatabases:
@@ -148,30 +222,48 @@ Rails/BulkChangeTable:
148
222
  Include:
149
223
  - db/migrate/*.rb
150
224
 
225
+ Rails/CompactBlank:
226
+ Enabled: false
227
+ Description: 'Checks if collection can be blank-compacted with `compact_blank`.'
228
+ Safe: false
229
+ VersionAdded: '2.13'
230
+
151
231
  Rails/ContentTag:
152
- Description: 'Use `tag` instead of `content_tag`.'
232
+ Enabled: false
233
+ Description: 'Use `tag.something` instead of `tag(:something)`.'
153
234
  Reference:
235
+ - 'https://github.com/rubocop/rubocop-rails/issues/260'
154
236
  - 'https://github.com/rails/rails/issues/25195'
155
237
  - 'https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag'
156
- Enabled: true
157
238
  VersionAdded: '2.6'
239
+ VersionChanged: '2.12'
240
+ # This `Exclude` config prevents false positives for `tag` calls to `has_one: tag` and Puma configuration:
241
+ # https://puma.io/puma/Puma/DSL.html#tag-instance_method
242
+ # No helpers are used in normal models and configs.
243
+ Exclude:
244
+ - app/models/**/*.rb
245
+ - config/**/*.rb
158
246
 
159
247
  Rails/CreateTableWithTimestamps:
248
+ Enabled: true
160
249
  Description: >-
161
250
  Checks the migration for which timestamps are not included
162
251
  when creating a new table.
163
- Enabled: true
164
252
  VersionAdded: '0.52'
165
253
  Include:
166
254
  - db/migrate/*.rb
255
+ Exclude:
256
+ # Respect the `active_storage_variant_records` table of `*_create_active_storage_tables.active_storage.rb`
257
+ # auto-generated by `bin/rails active_storage:install` even if `created_at` is not specified.
258
+ - db/migrate/*_create_active_storage_tables.active_storage.rb
167
259
 
168
260
  Rails/Date:
261
+ Enabled: true
169
262
  Description: >-
170
263
  Checks the correct usage of date aware methods,
171
264
  such as Date.today, Date.current etc.
172
- Enabled: true
173
265
  VersionAdded: '0.30'
174
- VersionChanged: '0.33'
266
+ VersionChanged: '2.11'
175
267
  # The value `strict` disallows usage of `Date.today`, `Date.current`,
176
268
  # `Date#to_time` etc.
177
269
  # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
@@ -181,16 +273,17 @@ Rails/Date:
181
273
  SupportedStyles:
182
274
  - strict
183
275
  - flexible
276
+ AllowToTime: true
184
277
 
185
278
  Rails/DefaultScope:
279
+ Enabled: false
186
280
  Description: 'Avoid use of `default_scope`.'
187
281
  StyleGuide: 'https://rails.rubystyle.guide#avoid-default-scope'
188
- Enabled: false
189
282
  VersionAdded: '2.7'
190
283
 
191
284
  Rails/Delegate:
285
+ Enabled: false
192
286
  Description: 'Prefer delegate method for delegations.'
193
- Enabled: true
194
287
  VersionAdded: '0.21'
195
288
  VersionChanged: '0.50'
196
289
  # When set to true, using the target object as a prefix of the
@@ -199,50 +292,108 @@ Rails/Delegate:
199
292
  EnforceForPrefixed: true
200
293
 
201
294
  Rails/DelegateAllowBlank:
295
+ Enabled: false
202
296
  Description: 'Do not use allow_blank as an option to delegate.'
203
- Enabled: true
204
297
  VersionAdded: '0.44'
205
298
 
299
+ Rails/DeprecatedActiveModelErrorsMethods:
300
+ Enabled: false
301
+ Description: 'Avoid manipulating ActiveModel errors hash directly.'
302
+ Severity: warning
303
+ Safe: false
304
+ VersionAdded: '2.14'
305
+ VersionChanged: '2.18'
306
+
307
+ Rails/DotSeparatedKeys:
308
+ Enabled: false
309
+ Description: 'Enforces the use of dot-separated keys instead of `:scope` options in `I18n` translation methods.'
310
+ StyleGuide: 'https://rails.rubystyle.guide/#dot-separated-keys'
311
+ VersionAdded: '2.15'
312
+
313
+ Rails/DuplicateAssociation:
314
+ Enabled: false
315
+ Description: "Don't repeat associations in a model."
316
+ Severity: warning
317
+ VersionAdded: '2.14'
318
+ VersionChanged: '2.18'
319
+
320
+ Rails/DuplicateScope:
321
+ Enabled: false
322
+ Description: 'Multiple scopes share this same where clause.'
323
+ Severity: warning
324
+ VersionAdded: '2.14'
325
+ VersionChanged: '2.18'
326
+
327
+ Rails/DurationArithmetic:
328
+ Enabled: false
329
+ Description: 'Do not use duration as arithmetic operand with `Time.current`.'
330
+ StyleGuide: 'https://rails.rubystyle.guide#duration-arithmetic'
331
+ VersionAdded: '2.13'
332
+
206
333
  Rails/DynamicFindBy:
334
+ Enabled: false
207
335
  Description: 'Use `find_by` instead of dynamic `find_by_*`.'
208
336
  StyleGuide: 'https://rails.rubystyle.guide#find_by'
209
- Enabled: true
337
+ Safe: false
210
338
  VersionAdded: '0.44'
211
- VersionChanged: '2.6'
339
+ VersionChanged: '2.10'
212
340
  # The `Whitelist` has been deprecated, Please use `AllowedMethods` instead.
213
341
  Whitelist:
214
342
  - find_by_sql
343
+ - find_by_token_for
215
344
  AllowedMethods:
216
345
  - find_by_sql
346
+ - find_by_token_for
217
347
  AllowedReceivers:
218
348
  - Gem::Specification
349
+ - page # Prevents a warning for `page.find_by_id`. See: https://github.com/rubocop/rubocop-rails/issues/778
350
+
351
+ Rails/EagerEvaluationLogMessage:
352
+ Enabled: false
353
+ Description: 'Checks that blocks are used for interpolated strings passed to `Rails.logger.debug`.'
354
+ Reference: 'https://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance'
355
+ VersionAdded: '2.11'
219
356
 
220
357
  Rails/EnumHash:
358
+ Enabled: false
221
359
  Description: 'Prefer hash syntax over array syntax when defining enums.'
222
360
  StyleGuide: 'https://rails.rubystyle.guide#enums'
223
- Enabled: true
224
361
  VersionAdded: '2.3'
225
362
  Include:
226
363
  - app/models/**/*.rb
227
364
 
228
365
  Rails/EnumUniqueness:
366
+ Enabled: false
229
367
  Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
230
- Enabled: true
231
368
  VersionAdded: '0.46'
232
369
  Include:
233
370
  - app/models/**/*.rb
234
371
 
235
372
  Rails/EnvironmentComparison:
373
+ Enabled: false
236
374
  Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`."
237
- Enabled: true
238
375
  VersionAdded: '0.52'
239
376
 
377
+ Rails/EnvironmentVariableAccess:
378
+ Enabled: true
379
+ Description: 'Do not access `ENV` directly after initialization.'
380
+ # TODO: Set to `pending` status in RuboCop Rails 2 series when migration doc will be written.
381
+ VersionAdded: '2.10'
382
+ VersionChanged: '2.11'
383
+ Include:
384
+ - app/**/*.rb
385
+ - lib/**/*.rb
386
+ Exclude:
387
+ - lib/**/*.rake
388
+ AllowReads: false
389
+ AllowWrites: false
390
+
240
391
  Rails/Exit:
392
+ Enabled: false
241
393
  Description: >-
242
394
  Favor `fail`, `break`, `return`, etc. over `exit` in
243
395
  application or library code outside of Rake files to avoid
244
396
  exits during unit testing or running in production.
245
- Enabled: true
246
397
  VersionAdded: '0.41'
247
398
  Include:
248
399
  - app/**/*.rb
@@ -251,9 +402,15 @@ Rails/Exit:
251
402
  Exclude:
252
403
  - lib/**/*.rake
253
404
 
405
+ Rails/ExpandedDateRange:
406
+ Enabled: false
407
+ Description: 'Checks for expanded date range.'
408
+ StyleGuide: 'https://rails.rubystyle.guide/#date-time-range'
409
+ VersionAdded: '2.11'
410
+
254
411
  Rails/FilePath:
412
+ Enabled: false
255
413
  Description: 'Use `Rails.root.join` for file path joining.'
256
- Enabled: true
257
414
  VersionAdded: '0.47'
258
415
  VersionChanged: '2.4'
259
416
  EnforcedStyle: slashes
@@ -262,173 +419,229 @@ Rails/FilePath:
262
419
  - arguments
263
420
 
264
421
  Rails/FindBy:
422
+ Enabled: false
265
423
  Description: 'Prefer find_by over where.first.'
266
424
  StyleGuide: 'https://rails.rubystyle.guide#find_by'
267
- Enabled: true
268
425
  VersionAdded: '0.30'
426
+ VersionChanged: '2.11'
427
+ IgnoreWhereFirst: true
269
428
  Include:
270
429
  - app/models/**/*.rb
271
430
 
272
431
  Rails/FindById:
432
+ Enabled: false
273
433
  Description: >-
274
434
  Favor the use of `find` over `where.take!`, `find_by!`, and `find_by_id!` when you
275
435
  need to retrieve a single record by primary key when you expect it to be found.
276
436
  StyleGuide: 'https://rails.rubystyle.guide/#find'
277
- Enabled: 'pending'
278
437
  VersionAdded: '2.7'
279
438
 
280
439
  Rails/FindEach:
281
- Description: 'Prefer all.find_each over all.find.'
440
+ Enabled: false
441
+ Description: 'Prefer all.find_each over all.each.'
282
442
  StyleGuide: 'https://rails.rubystyle.guide#find-each'
283
- Enabled: true
443
+ Safe: false
284
444
  VersionAdded: '0.30'
285
- VersionChanged: '2.9'
445
+ VersionChanged: '2.19'
286
446
  Include:
287
447
  - app/models/**/*.rb
288
- IgnoredMethods:
448
+ AllowedMethods:
289
449
  # Methods that don't work well with `find_each`.
290
450
  - order
291
451
  - limit
292
452
  - select
293
453
  - lock
454
+ AllowedPatterns: []
455
+
456
+ Rails/FreezeTime:
457
+ Enabled: false
458
+ Description: 'Prefer `freeze_time` over `travel_to` with an argument of the current time.'
459
+ StyleGuide: 'https://rails.rubystyle.guide/#freeze-time'
460
+ VersionAdded: '2.16'
461
+ SafeAutoCorrect: false
294
462
 
295
463
  Rails/HasAndBelongsToMany:
464
+ Enabled: false
296
465
  Description: 'Prefer has_many :through to has_and_belongs_to_many.'
297
466
  StyleGuide: 'https://rails.rubystyle.guide#has-many-through'
298
- Enabled: true
299
467
  VersionAdded: '0.12'
300
468
  Include:
301
469
  - app/models/**/*.rb
302
470
 
303
471
  Rails/HasManyOrHasOneDependent:
472
+ Enabled: false
304
473
  Description: 'Define the dependent option to the has_many and has_one associations.'
305
474
  StyleGuide: 'https://rails.rubystyle.guide#has_many-has_one-dependent-option'
306
- Enabled: true
307
475
  VersionAdded: '0.50'
308
476
  Include:
309
477
  - app/models/**/*.rb
310
478
 
311
479
  Rails/HelperInstanceVariable:
480
+ Enabled: false
312
481
  Description: 'Do not use instance variables in helpers.'
313
- Enabled: true
314
482
  VersionAdded: '2.0'
315
483
  Include:
316
484
  - app/helpers/**/*.rb
317
485
 
318
486
  Rails/HttpPositionalArguments:
487
+ Enabled: false
319
488
  Description: 'Use keyword arguments instead of positional arguments in http method calls.'
320
- Enabled: true
321
489
  VersionAdded: '0.44'
322
490
  Include:
323
491
  - 'spec/**/*'
324
492
  - 'test/**/*'
325
493
 
326
494
  Rails/HttpStatus:
495
+ Enabled: false
327
496
  Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
328
- Enabled: true
329
497
  VersionAdded: '0.54'
498
+ VersionChanged: '2.11'
330
499
  EnforcedStyle: symbolic
331
500
  SupportedStyles:
332
501
  - numeric
333
502
  - symbolic
334
503
 
504
+ Rails/I18nLazyLookup:
505
+ Enabled: false
506
+ Description: 'Checks for places where I18n "lazy" lookup can be used.'
507
+ StyleGuide: 'https://rails.rubystyle.guide/#lazy-lookup'
508
+ Reference: 'https://guides.rubyonrails.org/i18n.html#lazy-lookup'
509
+ VersionAdded: '2.14'
510
+ Include:
511
+ - 'app/controllers/**/*.rb'
512
+
513
+ Rails/I18nLocaleAssignment:
514
+ Enabled: false
515
+ Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.'
516
+ VersionAdded: '2.11'
517
+ Include:
518
+ - spec/**/*.rb
519
+ - test/**/*.rb
520
+
521
+ Rails/I18nLocaleTexts:
522
+ Enabled: false
523
+ Description: 'Enforces use of I18n and locale files instead of locale specific strings.'
524
+ StyleGuide: 'https://rails.rubystyle.guide/#locale-texts'
525
+ VersionAdded: '2.14'
526
+
527
+ Rails/IgnoredColumnsAssignment:
528
+ Enabled: false
529
+ Description: 'Looks for assignments of `ignored_columns` that override previous assignments.'
530
+ StyleGuide: 'https://rails.rubystyle.guide/#append-ignored-columns'
531
+ SafeAutoCorrect: false
532
+ VersionAdded: '2.17'
533
+
335
534
  Rails/IgnoredSkipActionFilterOption:
535
+ Enabled: false
336
536
  Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
337
537
  Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
338
- Enabled: true
339
538
  VersionAdded: '0.63'
340
539
  Include:
341
540
  - app/controllers/**/*.rb
541
+ - app/mailers/**/*.rb
342
542
 
343
543
  Rails/IndexBy:
544
+ Enabled: false
344
545
  Description: 'Prefer `index_by` over `each_with_object`, `to_h`, or `map`.'
345
- Enabled: true
346
546
  VersionAdded: '2.5'
347
547
  VersionChanged: '2.8'
348
548
 
349
549
  Rails/IndexWith:
550
+ Enabled: false
350
551
  Description: 'Prefer `index_with` over `each_with_object`, `to_h`, or `map`.'
351
- Enabled: true
352
552
  VersionAdded: '2.5'
353
553
  VersionChanged: '2.8'
354
554
 
355
555
  Rails/Inquiry:
556
+ Enabled: false
356
557
  Description: "Prefer Ruby's comparison operators over Active Support's `Array#inquiry` and `String#inquiry`."
357
558
  StyleGuide: 'https://rails.rubystyle.guide/#inquiry'
358
- Enabled: 'pending'
359
559
  VersionAdded: '2.7'
360
560
 
361
561
  Rails/InverseOf:
562
+ Enabled: false
362
563
  Description: 'Checks for associations where the inverse cannot be determined automatically.'
363
- Enabled: true
564
+ Reference:
565
+ - https://guides.rubyonrails.org/association_basics.html#bi-directional-associations
566
+ - https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#module-ActiveRecord::Associations::ClassMethods-label-Setting+Inverses
364
567
  VersionAdded: '0.52'
568
+ IgnoreScopes: false
365
569
  Include:
366
570
  - app/models/**/*.rb
367
571
 
368
572
  Rails/LexicallyScopedActionFilter:
369
- Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
573
+ Enabled: false
574
+ Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the class."
370
575
  StyleGuide: 'https://rails.rubystyle.guide#lexically-scoped-action-filter'
371
- Enabled: true
372
576
  Safe: false
373
577
  VersionAdded: '0.52'
374
578
  Include:
375
579
  - app/controllers/**/*.rb
580
+ - app/mailers/**/*.rb
376
581
 
377
582
  Rails/LinkToBlank:
583
+ Enabled: false
378
584
  Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
379
585
  Reference:
380
586
  - https://mathiasbynens.github.io/rel-noopener/
381
587
  - https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
382
588
  - https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
383
- Enabled: true
384
589
  VersionAdded: '0.62'
385
590
 
386
591
  Rails/MailerName:
592
+ Enabled: false
387
593
  Description: 'Mailer should end with `Mailer` suffix.'
388
594
  StyleGuide: 'https://rails.rubystyle.guide/#mailer-name'
389
- Enabled: 'pending'
390
595
  SafeAutoCorrect: false
391
596
  VersionAdded: '2.7'
392
597
  Include:
393
598
  - app/mailers/**/*.rb
394
599
 
395
600
  Rails/MatchRoute:
601
+ Enabled: false
396
602
  Description: >-
397
603
  Don't use `match` to define any routes unless there is a need to map multiple request types
398
604
  among [:get, :post, :patch, :put, :delete] to a single action using the `:via` option.
399
605
  StyleGuide: 'https://rails.rubystyle.guide/#no-match-routes'
400
- Enabled: 'pending'
401
606
  VersionAdded: '2.7'
402
607
  Include:
403
608
  - config/routes.rb
404
609
  - config/routes/**/*.rb
405
610
 
611
+ Rails/MigrationClassName:
612
+ Enabled: false
613
+ Description: 'The class name of the migration should match its file name.'
614
+ VersionAdded: '2.14'
615
+ Include:
616
+ - db/migrate/*.rb
617
+
406
618
  Rails/NegateInclude:
619
+ Enabled: false
407
620
  Description: 'Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`.'
408
621
  StyleGuide: 'https://rails.rubystyle.guide#exclude'
409
- Enabled: 'pending'
410
622
  Safe: false
411
623
  VersionAdded: '2.7'
412
624
  VersionChanged: '2.9'
413
625
 
414
626
  Rails/NotNullColumn:
627
+ Enabled: false
415
628
  Description: 'Do not add a NOT NULL column without a default value.'
416
- Enabled: true
417
629
  VersionAdded: '0.43'
418
630
  Include:
419
631
  - db/migrate/*.rb
420
632
 
421
633
  Rails/OrderById:
634
+ Enabled: false
422
635
  Description: >-
423
636
  Do not use the `id` column for ordering.
424
637
  Use a timestamp column to order chronologically.
425
638
  StyleGuide: 'https://rails.rubystyle.guide/#order-by-id'
426
- Enabled: false
427
639
  VersionAdded: '2.8'
428
640
 
429
641
  Rails/Output:
642
+ Enabled: false
430
643
  Description: 'Checks for calls to puts, print, etc.'
431
- Enabled: true
644
+ SafeAutoCorrect: false
432
645
  VersionAdded: '0.15'
433
646
  VersionChanged: '0.19'
434
647
  Include:
@@ -438,33 +651,35 @@ Rails/Output:
438
651
  - lib/**/*.rb
439
652
 
440
653
  Rails/OutputSafety:
654
+ Enabled: false
441
655
  Description: 'The use of `html_safe` or `raw` may be a security risk.'
442
- Enabled: true
443
656
  VersionAdded: '0.41'
444
657
 
445
658
  Rails/Pick:
659
+ Enabled: false
446
660
  Description: 'Prefer `pick` over `pluck(...).first`.'
447
661
  StyleGuide: 'https://rails.rubystyle.guide#pick'
448
- Enabled: true
449
662
  Safe: false
450
663
  VersionAdded: '2.6'
451
664
 
452
665
  Rails/Pluck:
666
+ Enabled: false
453
667
  Description: 'Prefer `pluck` over `map { ... }`.'
454
668
  StyleGuide: 'https://rails.rubystyle.guide#pluck'
455
- Enabled: 'pending'
669
+ Safe: false
456
670
  VersionAdded: '2.7'
671
+ VersionChanged: '2.18'
457
672
 
458
673
  Rails/PluckId:
674
+ Enabled: false
459
675
  Description: 'Use `ids` instead of `pluck(:id)` or `pluck(primary_key)`.'
460
676
  StyleGuide: 'https://rails.rubystyle.guide/#ids'
461
- Enabled: false
462
677
  Safe: false
463
678
  VersionAdded: '2.7'
464
679
 
465
680
  Rails/PluckInWhere:
681
+ Enabled: false
466
682
  Description: 'Use `select` instead of `pluck` in `where` query methods.'
467
- Enabled: 'pending'
468
683
  Safe: false
469
684
  VersionAdded: '2.7'
470
685
  VersionChanged: '2.8'
@@ -474,18 +689,18 @@ Rails/PluckInWhere:
474
689
  - aggressive
475
690
 
476
691
  Rails/PluralizationGrammar:
692
+ Enabled: false
477
693
  Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
478
- Enabled: true
479
694
  VersionAdded: '0.35'
480
695
 
481
696
  Rails/Presence:
697
+ Enabled: false
482
698
  Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
483
- Enabled: true
484
699
  VersionAdded: '0.52'
485
700
 
486
701
  Rails/Present:
702
+ Enabled: false
487
703
  Description: 'Enforces use of `present?`.'
488
- Enabled: true
489
704
  VersionAdded: '0.48'
490
705
  VersionChanged: '0.67'
491
706
  # Convert usages of `!nil? && !empty?` to `present?`
@@ -496,8 +711,8 @@ Rails/Present:
496
711
  UnlessBlank: true
497
712
 
498
713
  Rails/RakeEnvironment:
714
+ Enabled: false
499
715
  Description: 'Include `:environment` as a dependency for all Rake tasks.'
500
- Enabled: true
501
716
  Safe: false
502
717
  VersionAdded: '2.4'
503
718
  VersionChanged: '2.6'
@@ -508,43 +723,59 @@ Rails/RakeEnvironment:
508
723
  - 'lib/capistrano/tasks/**/*.rake'
509
724
 
510
725
  Rails/ReadWriteAttribute:
726
+ Enabled: false
511
727
  Description: >-
512
728
  Checks for read_attribute(:attr) and
513
729
  write_attribute(:attr, val).
514
730
  StyleGuide: 'https://rails.rubystyle.guide#read-attribute'
515
- Enabled: true
516
731
  VersionAdded: '0.20'
517
732
  VersionChanged: '0.29'
518
733
  Include:
519
734
  - app/models/**/*.rb
520
735
 
521
736
  Rails/RedundantAllowNil:
737
+ Enabled: false
522
738
  Description: >-
523
739
  Finds redundant use of `allow_nil` when `allow_blank` is set to
524
740
  certain values in model validations.
525
- Enabled: true
526
741
  VersionAdded: '0.67'
527
742
  Include:
528
743
  - app/models/**/*.rb
529
744
 
530
745
  Rails/RedundantForeignKey:
746
+ Enabled: false
531
747
  Description: 'Checks for associations where the `:foreign_key` option is redundant.'
532
- Enabled: true
533
748
  VersionAdded: '2.6'
534
749
 
750
+ Rails/RedundantPresenceValidationOnBelongsTo:
751
+ Enabled: true
752
+ Description: 'Checks for redundant presence validation on belongs_to association.'
753
+ SafeAutoCorrect: false
754
+ VersionAdded: '2.13'
755
+
535
756
  Rails/RedundantReceiverInWithOptions:
757
+ Enabled: false
536
758
  Description: 'Checks for redundant receiver in `with_options`.'
537
- Enabled: true
538
759
  VersionAdded: '0.52'
539
760
 
761
+ Rails/RedundantTravelBack:
762
+ Enabled: false
763
+ Description: Checks for redundant `travel_back` calls.
764
+ VersionAdded: '2.12'
765
+ Include:
766
+ - spec/**/*.rb
767
+ - test/**/*.rb
768
+
540
769
  Rails/ReflectionClassName:
770
+ Enabled: false
541
771
  Description: 'Use a string for `class_name` option value in the definition of a reflection.'
542
- Enabled: true
772
+ Safe: false
543
773
  VersionAdded: '0.64'
774
+ VersionChanged: '2.10'
544
775
 
545
776
  Rails/RefuteMethods:
777
+ Enabled: false
546
778
  Description: 'Use `assert_not` methods instead of `refute` methods.'
547
- Enabled: true
548
779
  VersionAdded: '0.56'
549
780
  EnforcedStyle: assert_not
550
781
  SupportedStyles:
@@ -554,47 +785,90 @@ Rails/RefuteMethods:
554
785
  - '**/test/**/*'
555
786
 
556
787
  Rails/RelativeDateConstant:
788
+ Enabled: false
557
789
  Description: 'Do not assign relative date to constants.'
558
- Enabled: true
790
+ SafeAutoCorrect: false
559
791
  VersionAdded: '0.48'
560
- VersionChanged: '0.59'
561
- AutoCorrect: false
792
+ VersionChanged: '2.13'
562
793
 
563
794
  Rails/RenderInline:
795
+ Enabled: false
564
796
  Description: 'Prefer using a template over inline rendering.'
565
797
  StyleGuide: 'https://rails.rubystyle.guide/#inline-rendering'
566
- Enabled: 'pending'
567
798
  VersionAdded: '2.7'
568
799
 
569
800
  Rails/RenderPlainText:
801
+ Enabled: false
570
802
  Description: 'Prefer `render plain:` over `render text:`.'
571
803
  StyleGuide: 'https://rails.rubystyle.guide/#plain-text-rendering'
572
- Enabled: 'pending'
573
804
  VersionAdded: '2.7'
574
805
  # Convert only when `content_type` is explicitly set to `text/plain`.
575
806
  ContentTypeCompatibility: true
576
807
 
577
808
  Rails/RequestReferer:
809
+ Enabled: false
578
810
  Description: 'Use consistent syntax for request.referer.'
579
- Enabled: true
580
811
  VersionAdded: '0.41'
581
812
  EnforcedStyle: referer
582
813
  SupportedStyles:
583
814
  - referer
584
815
  - referrer
585
816
 
817
+ Rails/RequireDependency:
818
+ Enabled: false
819
+ Description: 'Do not use `require_dependency` when running in Zeitwerk mode. `require_dependency` is for autoloading in classic mode.'
820
+ Reference: 'https://guides.rubyonrails.org/autoloading_and_reloading_constants.html'
821
+ VersionAdded: '2.10'
822
+
823
+ Rails/ResponseParsedBody:
824
+ Enabled: false
825
+ Description: Prefer `response.parsed_body` to `JSON.parse(response.body)`.
826
+ Safe: false
827
+ VersionAdded: '2.18'
828
+ VersionChanged: '2.19'
829
+ Include:
830
+ - spec/controllers/**/*.rb
831
+ - spec/requests/**/*.rb
832
+ - test/controllers/**/*.rb
833
+ - test/integration/**/*.rb
834
+
586
835
  Rails/ReversibleMigration:
836
+ Enabled: false
587
837
  Description: 'Checks whether the change method of the migration file is reversible.'
588
838
  StyleGuide: 'https://rails.rubystyle.guide#reversible-migration'
589
839
  Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
590
- Enabled: true
591
840
  VersionAdded: '0.47'
841
+ VersionChanged: '2.13'
592
842
  Include:
593
- - db/migrate/*.rb
843
+ - db/**/*.rb
844
+
845
+ Rails/ReversibleMigrationMethodDefinition:
846
+ Enabled: false
847
+ Description: 'Checks whether the migration implements either a `change` method or both an `up` and a `down` method.'
848
+ VersionAdded: '2.10'
849
+ VersionChanged: '2.13'
850
+ Include:
851
+ - db/**/*.rb
852
+
853
+ Rails/RootJoinChain:
854
+ Enabled: false
855
+ Description: 'Use a single `#join` instead of chaining on `Rails.root` or `Rails.public_path`.'
856
+ VersionAdded: '2.13'
857
+
858
+ Rails/RootPathnameMethods:
859
+ Enabled: false
860
+ Description: 'Use `Rails.root` IO methods instead of passing it to `File`.'
861
+ SafeAutoCorrect: false
862
+ VersionAdded: '2.16'
863
+
864
+ Rails/RootPublicPath:
865
+ Enabled: false
866
+ Description: "Favor `Rails.public_path` over `Rails.root` with `'public'`."
867
+ VersionAdded: '2.15'
594
868
 
595
869
  Rails/SafeNavigation:
596
- Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`."
597
870
  Enabled: true
871
+ Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`."
598
872
  VersionAdded: '0.43'
599
873
  # This will convert usages of `try` to use safe navigation as well as `try!`.
600
874
  # `try` and `try!` work slightly differently. `try!` and safe navigation will
@@ -603,8 +877,8 @@ Rails/SafeNavigation:
603
877
  ConvertTry: false
604
878
 
605
879
  Rails/SafeNavigationWithBlank:
606
- Description: 'Avoid `foo&.blank?` in conditionals.'
607
880
  Enabled: true
881
+ Description: 'Avoid `foo&.blank?` in conditionals.'
608
882
  VersionAdded: '2.4'
609
883
  # While the safe navigation operator is generally a good idea, when
610
884
  # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually
@@ -615,26 +889,34 @@ Rails/SafeNavigationWithBlank:
615
889
  SafeAutoCorrect: false
616
890
 
617
891
  Rails/SaveBang:
892
+ Enabled: false
618
893
  Description: 'Identifies possible cases where Active Record save! or related should be used.'
619
894
  StyleGuide: 'https://rails.rubystyle.guide#save-bang'
620
- Enabled: false
621
895
  VersionAdded: '0.42'
622
896
  VersionChanged: '0.59'
623
897
  AllowImplicitReturn: true
624
898
  AllowedReceivers: []
625
899
  SafeAutoCorrect: false
626
900
 
901
+ Rails/SchemaComment:
902
+ Enabled: false
903
+ Description: >-
904
+ Enforces the use of the `comment` option when adding a new table or column
905
+ to the database during a migration.
906
+ VersionAdded: '2.13'
907
+
627
908
  Rails/ScopeArgs:
628
- Description: 'Checks the arguments of ActiveRecord scopes.'
629
909
  Enabled: true
910
+ Description: 'Checks the arguments of ActiveRecord scopes.'
630
911
  VersionAdded: '0.19'
912
+ VersionChanged: '2.12'
631
913
  Include:
632
914
  - app/models/**/*.rb
633
915
 
634
916
  Rails/ShortI18n:
917
+ Enabled: false
635
918
  Description: 'Use the short form of the I18n methods: `t` instead of `translate` and `l` instead of `localize`.'
636
919
  StyleGuide: 'https://rails.rubystyle.guide/#short-i18n'
637
- Enabled: 'pending'
638
920
  VersionAdded: '2.7'
639
921
  EnforcedStyle: conservative
640
922
  SupportedStyles:
@@ -642,11 +924,11 @@ Rails/ShortI18n:
642
924
  - aggressive
643
925
 
644
926
  Rails/SkipsModelValidations:
927
+ Enabled: false
645
928
  Description: >-
646
929
  Use methods that skips model validations with caution.
647
930
  See reference for more information.
648
931
  Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
649
- Enabled: true
650
932
  VersionAdded: '0.47'
651
933
  VersionChanged: '2.7'
652
934
  ForbiddenMethods:
@@ -671,88 +953,174 @@ Rails/SkipsModelValidations:
671
953
  AllowedMethods: []
672
954
 
673
955
  Rails/SquishedSQLHeredocs:
956
+ Enabled: false
674
957
  Description: 'Checks SQL heredocs to use `.squish`.'
675
958
  StyleGuide: 'https://rails.rubystyle.guide/#squished-heredocs'
676
- Enabled: 'pending'
677
959
  VersionAdded: '2.8'
678
960
  VersionChanged: '2.9'
679
961
  # Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines
680
- # to be preserved in order to work, thus auto-correction is not safe.
962
+ # to be preserved in order to work, thus autocorrection is not safe.
681
963
  SafeAutoCorrect: false
682
964
 
965
+ Rails/StripHeredoc:
966
+ Enabled: true
967
+ Description: 'Enforces the use of squiggly heredoc over `strip_heredoc`.'
968
+ StyleGuide: 'https://rails.rubystyle.guide/#prefer-squiggly-heredoc'
969
+ VersionAdded: '2.15'
970
+
971
+ Rails/TableNameAssignment:
972
+ Enabled: false
973
+ Description: >-
974
+ Do not use `self.table_name =`. Use Inflections or `table_name_prefix` instead.
975
+ StyleGuide: 'https://rails.rubystyle.guide/#keep-ar-defaults'
976
+ VersionAdded: '2.14'
977
+ Include:
978
+ - app/models/**/*.rb
979
+
980
+ Rails/ThreeStateBooleanColumn:
981
+ Enabled: true
982
+ Description: 'Add a default value and a `NOT NULL` constraint to boolean columns.'
983
+ StyleGuide: 'https://rails.rubystyle.guide/#three-state-boolean'
984
+ VersionAdded: '2.19'
985
+ Include:
986
+ - db/**/*.rb
987
+
683
988
  Rails/TimeZone:
989
+ Enabled: false
684
990
  Description: 'Checks the correct usage of time zone aware methods.'
685
991
  StyleGuide: 'https://rails.rubystyle.guide#time'
686
992
  Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
687
- Enabled: true
688
- Safe: false
993
+ SafeAutoCorrect: false
689
994
  VersionAdded: '0.30'
690
- VersionChanged: '0.68'
995
+ VersionChanged: '2.13'
691
996
  # The value `strict` means that `Time` should be used with `zone`.
692
997
  # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
693
998
  EnforcedStyle: flexible
694
999
  SupportedStyles:
695
1000
  - strict
696
1001
  - flexible
1002
+ Exclude:
1003
+ - '**/*.gemspec'
1004
+
1005
+ Rails/TimeZoneAssignment:
1006
+ Enabled: true
1007
+ Description: 'Prefer the usage of `Time.use_zone` instead of manually updating `Time.zone` value.'
1008
+ Reference: 'https://thoughtbot.com/blog/its-about-time-zones'
1009
+ VersionAdded: '2.10'
1010
+ Include:
1011
+ - spec/**/*.rb
1012
+ - test/**/*.rb
1013
+
1014
+ Rails/ToFormattedS:
1015
+ Enabled: false
1016
+ Description: 'Checks for consistent uses of `to_fs` or `to_formatted_s`.'
1017
+ StyleGuide: 'https://rails.rubystyle.guide/#prefer-to-fs'
1018
+ EnforcedStyle: to_fs
1019
+ SupportedStyles:
1020
+ - to_fs
1021
+ - to_formatted_s
1022
+ VersionAdded: '2.15'
1023
+
1024
+ Rails/ToSWithArgument:
1025
+ Enabled: false
1026
+ Description: 'Identifies passing any argument to `#to_s`.'
1027
+ Safe: false
1028
+ VersionAdded: '2.16'
1029
+
1030
+ Rails/TopLevelHashWithIndifferentAccess:
1031
+ Enabled: false
1032
+ Description: 'Identifies top-level `HashWithIndifferentAccess`.'
1033
+ Reference: 'https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#top-level-hashwithindifferentaccess-is-soft-deprecated'
1034
+ Severity: warning
1035
+ VersionAdded: '2.16'
1036
+ VersionChanged: '2.18'
1037
+
1038
+ Rails/TransactionExitStatement:
1039
+ Enabled: false
1040
+ Description: 'Avoid the usage of `return`, `break` and `throw` in transaction blocks.'
1041
+ Reference:
1042
+ - https://github.com/rails/rails/commit/15aa4200e083
1043
+ VersionAdded: '2.14'
697
1044
 
698
1045
  Rails/UniqBeforePluck:
699
- Description: 'Prefer the use of uniq or distinct before pluck.'
700
1046
  Enabled: true
1047
+ Description: 'Prefer the use of uniq or distinct before pluck.'
701
1048
  VersionAdded: '0.40'
702
- VersionChanged: '2.8'
1049
+ VersionChanged: '2.13'
703
1050
  EnforcedStyle: conservative
704
1051
  SupportedStyles:
705
1052
  - conservative
706
1053
  - aggressive
707
1054
  SafeAutoCorrect: false
708
- AutoCorrect: false
709
1055
 
710
1056
  Rails/UniqueValidationWithoutIndex:
711
- Description: 'Uniqueness validation should be with a unique index.'
712
- Enabled: true
1057
+ Enabled: false
1058
+ Description: 'Uniqueness validation should have a unique index on the database column.'
713
1059
  VersionAdded: '2.5'
714
1060
  Include:
715
1061
  - app/models/**/*.rb
716
1062
 
717
1063
  Rails/UnknownEnv:
1064
+ Enabled: false
718
1065
  Description: 'Use correct environment name.'
719
- Enabled: true
1066
+ Severity: warning
720
1067
  VersionAdded: '0.51'
1068
+ VersionChanged: '2.18'
721
1069
  Environments:
722
1070
  - development
723
1071
  - test
724
1072
  - production
725
1073
 
1074
+ Rails/UnusedIgnoredColumns:
1075
+ Enabled: true
1076
+ Description: 'Remove a column that does not exist from `ignored_columns`.'
1077
+ VersionAdded: '2.11'
1078
+ Include:
1079
+ - app/models/**/*.rb
1080
+
726
1081
  Rails/Validation:
1082
+ Enabled: false
727
1083
  Description: 'Use validates :attribute, hash of validations.'
728
- Enabled: true
729
1084
  VersionAdded: '0.9'
730
1085
  VersionChanged: '0.41'
731
1086
  Include:
732
1087
  - app/models/**/*.rb
733
1088
 
734
1089
  Rails/WhereEquals:
1090
+ Enabled: false
735
1091
  Description: 'Pass conditions to `where` as a hash instead of manually constructing SQL.'
736
1092
  StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
737
- Enabled: 'pending'
1093
+ SafeAutoCorrect: false
738
1094
  VersionAdded: '2.9'
1095
+ VersionChanged: '2.10'
739
1096
 
740
1097
  Rails/WhereExists:
1098
+ Enabled: false
741
1099
  Description: 'Prefer `exists?(...)` over `where(...).exists?`.'
742
- Enabled: 'pending'
1100
+ SafeAutoCorrect: false
743
1101
  EnforcedStyle: exists
744
1102
  SupportedStyles:
745
1103
  - exists
746
1104
  - where
747
1105
  VersionAdded: '2.7'
748
- VersionChanged: '2.8'
1106
+ VersionChanged: '2.10'
1107
+
1108
+ Rails/WhereMissing:
1109
+ Enabled: true
1110
+ Description: 'Use `where.missing(...)` to find missing relationship records.'
1111
+ StyleGuide: 'https://rails.rubystyle.guide/#finding-missing-relationship-records'
1112
+ VersionAdded: '2.16'
749
1113
 
750
1114
  Rails/WhereNot:
1115
+ Enabled: true
751
1116
  Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.'
752
1117
  StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
753
- Enabled: 'pending'
754
1118
  VersionAdded: '2.8'
755
1119
 
756
- # Accept `redirect_to(...) and return` and similar cases.
757
- Style/AndOr:
758
- EnforcedStyle: conditionals
1120
+ Rails/WhereNotWithMultipleConditions:
1121
+ Enabled: false
1122
+ Description: 'Do not use `where.not(...)` with multiple conditions.'
1123
+ StyleGuide: 'https://rails.rubystyle.guide/#where-not-with-multiple-attributes'
1124
+ Severity: warning
1125
+ VersionAdded: '2.17'
1126
+ VersionChanged: '2.18'