standard-rails 0.2.0 → 1.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.
data/config/base.yml CHANGED
@@ -28,1099 +28,408 @@ AllCops:
28
28
  Lint/RedundantSafeNavigation:
29
29
  Enabled: false
30
30
 
31
- Rails:
32
- DocumentationBaseURL: https://docs.rubocop.org/rubocop-rails
31
+ Lint/SafeNavigationChain:
32
+ Enabled: true
33
+ AllowedMethods:
34
+ - present?
35
+ - blank?
36
+ - presence
37
+ - presence_in
38
+ - try
39
+ - try!
40
+ - in?
33
41
 
34
42
  Rails/ActionControllerFlashBeforeRender:
35
43
  Enabled: false
36
- Description: 'Use `flash.now` instead of `flash` before `render`.'
37
- SafeAutoCorrect: false
38
- VersionAdded: '2.16'
39
44
 
40
45
  Rails/ActionControllerTestCase:
41
46
  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
47
 
50
48
  Rails/ActionFilter:
51
- Enabled: false
52
- Description: 'Enforces consistent use of action filter methods.'
53
- VersionAdded: '0.19'
54
- EnforcedStyle: action
55
- SupportedStyles:
56
- - action
57
- - filter
58
- Include:
59
- - app/controllers/**/*.rb
60
- - app/mailers/**/*.rb
49
+ Enabled: true
61
50
 
62
51
  Rails/ActionOrder:
63
52
  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
76
53
 
77
54
  Rails/ActiveRecordAliases:
78
- Enabled: false
79
- Description: >-
80
- Avoid Active Record aliases:
81
- Use `update` instead of `update_attributes`.
82
- Use `update!` instead of `update_attributes!`.
83
- VersionAdded: '0.53'
84
- SafeAutoCorrect: false
55
+ Enabled: true
85
56
 
86
57
  Rails/ActiveRecordCallbacksOrder:
87
- Enabled: false
88
- Description: 'Order callback declarations in the order in which they will be executed.'
89
- StyleGuide: 'https://rails.rubystyle.guide/#callbacks-order'
90
- VersionAdded: '2.7'
91
- Include:
92
- - app/models/**/*.rb
58
+ Enabled: true
93
59
 
94
60
  Rails/ActiveRecordOverride:
95
61
  Enabled: true
96
- Description: >-
97
- Check for overriding Active Record methods instead of using
98
- callbacks.
99
- Severity: warning
100
- VersionAdded: '0.67'
101
- VersionChanged: '2.18'
102
- Include:
103
- - app/models/**/*.rb
104
62
 
105
63
  Rails/ActiveSupportAliases:
106
64
  Enabled: false
107
- Description: >-
108
- Avoid ActiveSupport aliases of standard ruby methods:
109
- `String#starts_with?`, `String#ends_with?`,
110
- `Array#append`, `Array#prepend`.
111
- VersionAdded: '0.48'
112
65
 
113
66
  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'
67
+ Enabled: true
121
68
 
122
69
  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
70
+ Enabled: true
131
71
 
132
72
  Rails/AfterCommitOverride:
133
- Enabled: false
134
- Description: >-
135
- Enforces that there is only one call to `after_commit`
136
- (and its aliases - `after_create_commit`, `after_update_commit`,
137
- and `after_destroy_commit`) with the same callback name per model.
138
- VersionAdded: '2.8'
73
+ Enabled: true
139
74
 
140
75
  Rails/ApplicationController:
141
76
  Enabled: true
142
- Description: 'Check that controllers subclass ApplicationController.'
143
- SafeAutoCorrect: false
144
- VersionAdded: '2.4'
145
- VersionChanged: '2.5'
146
77
 
147
78
  Rails/ApplicationJob:
148
79
  Enabled: true
149
- Description: 'Check that jobs subclass ApplicationJob.'
150
- SafeAutoCorrect: false
151
- VersionAdded: '0.49'
152
- VersionChanged: '2.5'
153
80
 
154
81
  Rails/ApplicationMailer:
155
82
  Enabled: true
156
- Description: 'Check that mailers subclass ApplicationMailer.'
157
- SafeAutoCorrect: false
158
- VersionAdded: '2.4'
159
- VersionChanged: '2.5'
160
83
 
161
84
  Rails/ApplicationRecord:
162
85
  Enabled: true
163
- Description: 'Check that models subclass ApplicationRecord.'
164
- SafeAutoCorrect: false
165
- VersionAdded: '0.49'
166
- VersionChanged: '2.5'
167
86
 
168
87
  Rails/ArelStar:
169
- Enabled: false
170
- Description: 'Enforces `Arel.star` instead of `"*"` for expanded columns.'
171
- SafeAutoCorrect: false
172
- VersionAdded: '2.9'
88
+ Enabled: true
173
89
 
174
90
  Rails/AssertNot:
175
91
  Enabled: false
176
- Description: 'Use `assert_not` instead of `assert !`.'
177
- VersionAdded: '0.56'
178
- Include:
179
- - '**/test/**/*'
180
92
 
181
93
  Rails/AttributeDefaultBlockValue:
182
- Enabled: false
183
- Description: 'Pass method call in block for attribute option `default`.'
184
- VersionAdded: '2.9'
185
- Include:
186
- - 'app/models/**/*'
94
+ Enabled: true
187
95
 
188
96
  Rails/BelongsTo:
189
97
  Enabled: true
190
- Description: >-
191
- Use `optional: true` instead of `required: false` for
192
- `belongs_to` relations.
193
- Reference:
194
- - https://guides.rubyonrails.org/5_0_release_notes.html
195
- - https://github.com/rails/rails/pull/18937
196
- VersionAdded: '0.62'
197
98
 
198
99
  Rails/Blank:
199
100
  Enabled: true
200
- Description: 'Enforces use of `blank?`.'
201
- SafeAutoCorrect: false
202
- VersionAdded: '0.48'
203
- VersionChanged: '2.10'
204
- # Convert usages of `nil? || empty?` to `blank?`
205
- NilOrEmpty: true
206
- # Convert usages of `!present?` to `blank?`
207
- NotPresent: true
208
- # Convert usages of `unless present?` to `if blank?`
209
- UnlessPresent: true
210
101
 
211
102
  Rails/BulkChangeTable:
212
- Enabled: false
213
- Description: 'Check whether alter queries are combinable.'
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
217
- VersionAdded: '0.57'
218
- Database: null
219
- SupportedDatabases:
220
- - mysql
221
- - postgresql
222
- Include:
223
- - db/migrate/*.rb
103
+ Enabled: true
224
104
 
225
105
  Rails/CompactBlank:
226
- Enabled: false
227
- Description: 'Checks if collection can be blank-compacted with `compact_blank`.'
228
- Safe: false
229
- VersionAdded: '2.13'
106
+ Enabled: true
230
107
 
231
108
  Rails/ContentTag:
232
- Enabled: false
233
- Description: 'Use `tag.something` instead of `tag(:something)`.'
234
- Reference:
235
- - 'https://github.com/rubocop/rubocop-rails/issues/260'
236
- - 'https://github.com/rails/rails/issues/25195'
237
- - 'https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag'
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
109
+ Enabled: true
246
110
 
247
111
  Rails/CreateTableWithTimestamps:
248
112
  Enabled: true
249
- Description: >-
250
- Checks the migration for which timestamps are not included
251
- when creating a new table.
252
- VersionAdded: '0.52'
253
- Include:
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
113
+
114
+ Rails/DangerousColumnNames:
115
+ Enabled: true
259
116
 
260
117
  Rails/Date:
261
118
  Enabled: true
262
- Description: >-
263
- Checks the correct usage of date aware methods,
264
- such as Date.today, Date.current etc.
265
- VersionAdded: '0.30'
266
- VersionChanged: '2.11'
267
- # The value `strict` disallows usage of `Date.today`, `Date.current`,
268
- # `Date#to_time` etc.
269
- # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
270
- # (but not `Date.today`) which are overridden by ActiveSupport to handle current
271
- # time zone.
272
- EnforcedStyle: flexible
273
- SupportedStyles:
274
- - strict
275
- - flexible
276
- AllowToTime: true
277
119
 
278
120
  Rails/DefaultScope:
279
121
  Enabled: false
280
- Description: 'Avoid use of `default_scope`.'
281
- StyleGuide: 'https://rails.rubystyle.guide#avoid-default-scope'
282
- VersionAdded: '2.7'
283
122
 
284
123
  Rails/Delegate:
285
124
  Enabled: false
286
- Description: 'Prefer delegate method for delegations.'
287
- VersionAdded: '0.21'
288
- VersionChanged: '0.50'
289
- # When set to true, using the target object as a prefix of the
290
- # method name without using the `delegate` method will be a
291
- # violation. When set to false, this case is legal.
292
- EnforceForPrefixed: true
293
125
 
294
126
  Rails/DelegateAllowBlank:
295
- Enabled: false
296
- Description: 'Do not use allow_blank as an option to delegate.'
297
- VersionAdded: '0.44'
127
+ Enabled: true
298
128
 
299
129
  Rails/DeprecatedActiveModelErrorsMethods:
300
130
  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
131
 
307
132
  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'
133
+ Enabled: true
312
134
 
313
135
  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'
136
+ Enabled: true
137
+ Autocorrect: false
319
138
 
320
139
  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'
140
+ Enabled: true
326
141
 
327
142
  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'
143
+ Enabled: true
332
144
 
333
145
  Rails/DynamicFindBy:
334
- Enabled: false
335
- Description: 'Use `find_by` instead of dynamic `find_by_*`.'
336
- StyleGuide: 'https://rails.rubystyle.guide#find_by'
337
- Safe: false
338
- VersionAdded: '0.44'
339
- VersionChanged: '2.10'
340
- # The `Whitelist` has been deprecated, Please use `AllowedMethods` instead.
341
- Whitelist:
342
- - find_by_sql
343
- - find_by_token_for
344
- AllowedMethods:
345
- - find_by_sql
346
- - find_by_token_for
347
- AllowedReceivers:
348
- - Gem::Specification
349
- - page # Prevents a warning for `page.find_by_id`. See: https://github.com/rubocop/rubocop-rails/issues/778
146
+ Enabled: true
350
147
 
351
148
  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'
149
+ Enabled: true
356
150
 
357
151
  Rails/EnumHash:
358
- Enabled: false
359
- Description: 'Prefer hash syntax over array syntax when defining enums.'
360
- StyleGuide: 'https://rails.rubystyle.guide#enums'
361
- VersionAdded: '2.3'
362
- Include:
363
- - app/models/**/*.rb
152
+ Enabled: true
364
153
 
365
154
  Rails/EnumUniqueness:
366
- Enabled: false
367
- Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
368
- VersionAdded: '0.46'
369
- Include:
370
- - app/models/**/*.rb
155
+ Enabled: true
156
+
157
+ Rails/EnvLocal:
158
+ Enabled: true
371
159
 
372
160
  Rails/EnvironmentComparison:
373
- Enabled: false
374
- Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`."
375
- VersionAdded: '0.52'
161
+ Enabled: true
376
162
 
377
163
  Rails/EnvironmentVariableAccess:
378
164
  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
165
 
391
166
  Rails/Exit:
392
- Enabled: false
393
- Description: >-
394
- Favor `fail`, `break`, `return`, etc. over `exit` in
395
- application or library code outside of Rake files to avoid
396
- exits during unit testing or running in production.
397
- VersionAdded: '0.41'
398
- Include:
399
- - app/**/*.rb
400
- - config/**/*.rb
401
- - lib/**/*.rb
402
- Exclude:
403
- - lib/**/*.rake
167
+ Enabled: true
404
168
 
405
169
  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'
170
+ Enabled: true
410
171
 
411
172
  Rails/FilePath:
412
- Enabled: false
413
- Description: 'Use `Rails.root.join` for file path joining.'
414
- VersionAdded: '0.47'
415
- VersionChanged: '2.4'
416
- EnforcedStyle: slashes
417
- SupportedStyles:
418
- - slashes
419
- - arguments
173
+ Enabled: true
420
174
 
421
175
  Rails/FindBy:
422
- Enabled: false
423
- Description: 'Prefer find_by over where.first.'
424
- StyleGuide: 'https://rails.rubystyle.guide#find_by'
425
- VersionAdded: '0.30'
426
- VersionChanged: '2.11'
427
- IgnoreWhereFirst: true
428
- Include:
429
- - app/models/**/*.rb
176
+ Enabled: true
430
177
 
431
178
  Rails/FindById:
432
- Enabled: false
433
- Description: >-
434
- Favor the use of `find` over `where.take!`, `find_by!`, and `find_by_id!` when you
435
- need to retrieve a single record by primary key when you expect it to be found.
436
- StyleGuide: 'https://rails.rubystyle.guide/#find'
437
- VersionAdded: '2.7'
179
+ Enabled: true
438
180
 
439
181
  Rails/FindEach:
440
- Enabled: false
441
- Description: 'Prefer all.find_each over all.each.'
442
- StyleGuide: 'https://rails.rubystyle.guide#find-each'
443
- Safe: false
444
- VersionAdded: '0.30'
445
- VersionChanged: '2.19'
446
- Include:
447
- - app/models/**/*.rb
448
- AllowedMethods:
449
- # Methods that don't work well with `find_each`.
450
- - order
451
- - limit
452
- - select
453
- - lock
454
- AllowedPatterns: []
182
+ Enabled: true
455
183
 
456
184
  Rails/FreezeTime:
457
185
  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
462
186
 
463
187
  Rails/HasAndBelongsToMany:
464
- Enabled: false
465
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
466
- StyleGuide: 'https://rails.rubystyle.guide#has-many-through'
467
- VersionAdded: '0.12'
468
- Include:
469
- - app/models/**/*.rb
188
+ Enabled: true
470
189
 
471
190
  Rails/HasManyOrHasOneDependent:
472
- Enabled: false
473
- Description: 'Define the dependent option to the has_many and has_one associations.'
474
- StyleGuide: 'https://rails.rubystyle.guide#has_many-has_one-dependent-option'
475
- VersionAdded: '0.50'
476
- Include:
477
- - app/models/**/*.rb
191
+ Enabled: true
478
192
 
479
193
  Rails/HelperInstanceVariable:
480
- Enabled: false
481
- Description: 'Do not use instance variables in helpers.'
482
- VersionAdded: '2.0'
483
- Include:
484
- - app/helpers/**/*.rb
194
+ Enabled: true
485
195
 
486
196
  Rails/HttpPositionalArguments:
487
- Enabled: false
488
- Description: 'Use keyword arguments instead of positional arguments in http method calls.'
489
- VersionAdded: '0.44'
490
- Include:
491
- - 'spec/**/*'
492
- - 'test/**/*'
197
+ Enabled: true
493
198
 
494
199
  Rails/HttpStatus:
495
200
  Enabled: false
496
- Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
497
- VersionAdded: '0.54'
498
- VersionChanged: '2.11'
499
- EnforcedStyle: symbolic
500
- SupportedStyles:
501
- - numeric
502
- - symbolic
503
201
 
504
202
  Rails/I18nLazyLookup:
505
203
  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
204
 
513
205
  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
206
+ Enabled: true
520
207
 
521
208
  Rails/I18nLocaleTexts:
522
209
  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
210
 
527
211
  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'
212
+ Enabled: true
533
213
 
534
214
  Rails/IgnoredSkipActionFilterOption:
535
- Enabled: false
536
- Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
537
- Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
538
- VersionAdded: '0.63'
539
- Include:
540
- - app/controllers/**/*.rb
541
- - app/mailers/**/*.rb
215
+ Enabled: true
542
216
 
543
217
  Rails/IndexBy:
544
218
  Enabled: false
545
- Description: 'Prefer `index_by` over `each_with_object`, `to_h`, or `map`.'
546
- VersionAdded: '2.5'
547
- VersionChanged: '2.8'
548
219
 
549
220
  Rails/IndexWith:
550
221
  Enabled: false
551
- Description: 'Prefer `index_with` over `each_with_object`, `to_h`, or `map`.'
552
- VersionAdded: '2.5'
553
- VersionChanged: '2.8'
554
222
 
555
223
  Rails/Inquiry:
556
224
  Enabled: false
557
- Description: "Prefer Ruby's comparison operators over Active Support's `Array#inquiry` and `String#inquiry`."
558
- StyleGuide: 'https://rails.rubystyle.guide/#inquiry'
559
- VersionAdded: '2.7'
560
225
 
561
226
  Rails/InverseOf:
562
- Enabled: false
563
- Description: 'Checks for associations where the inverse cannot be determined automatically.'
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
567
- VersionAdded: '0.52'
568
- IgnoreScopes: false
569
- Include:
570
- - app/models/**/*.rb
227
+ Enabled: true
571
228
 
572
229
  Rails/LexicallyScopedActionFilter:
573
- Enabled: false
574
- Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the class."
575
- StyleGuide: 'https://rails.rubystyle.guide#lexically-scoped-action-filter'
576
- Safe: false
577
- VersionAdded: '0.52'
578
- Include:
579
- - app/controllers/**/*.rb
580
- - app/mailers/**/*.rb
230
+ Enabled: true
581
231
 
582
232
  Rails/LinkToBlank:
583
- Enabled: false
584
- Description: 'Checks that `link_to` with a `target: "_blank"` have a `rel: "noopener"` option passed to them.'
585
- Reference:
586
- - https://mathiasbynens.github.io/rel-noopener/
587
- - https://html.spec.whatwg.org/multipage/links.html#link-type-noopener
588
- - https://html.spec.whatwg.org/multipage/links.html#link-type-noreferrer
589
- VersionAdded: '0.62'
233
+ Enabled: true
590
234
 
591
235
  Rails/MailerName:
592
- Enabled: false
593
- Description: 'Mailer should end with `Mailer` suffix.'
594
- StyleGuide: 'https://rails.rubystyle.guide/#mailer-name'
595
- SafeAutoCorrect: false
596
- VersionAdded: '2.7'
597
- Include:
598
- - app/mailers/**/*.rb
236
+ Enabled: true
599
237
 
600
238
  Rails/MatchRoute:
601
- Enabled: false
602
- Description: >-
603
- Don't use `match` to define any routes unless there is a need to map multiple request types
604
- among [:get, :post, :patch, :put, :delete] to a single action using the `:via` option.
605
- StyleGuide: 'https://rails.rubystyle.guide/#no-match-routes'
606
- VersionAdded: '2.7'
607
- Include:
608
- - config/routes.rb
609
- - config/routes/**/*.rb
239
+ Enabled: true
610
240
 
611
241
  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
242
+ Enabled: true
617
243
 
618
244
  Rails/NegateInclude:
619
245
  Enabled: false
620
- Description: 'Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`.'
621
- StyleGuide: 'https://rails.rubystyle.guide#exclude'
622
- Safe: false
623
- VersionAdded: '2.7'
624
- VersionChanged: '2.9'
625
246
 
626
247
  Rails/NotNullColumn:
627
248
  Enabled: false
628
- Description: 'Do not add a NOT NULL column without a default value.'
629
- VersionAdded: '0.43'
630
- Include:
631
- - db/migrate/*.rb
632
249
 
633
250
  Rails/OrderById:
634
- Enabled: false
635
- Description: >-
636
- Do not use the `id` column for ordering.
637
- Use a timestamp column to order chronologically.
638
- StyleGuide: 'https://rails.rubystyle.guide/#order-by-id'
639
- VersionAdded: '2.8'
251
+ Enabled: true
640
252
 
641
253
  Rails/Output:
642
- Enabled: false
643
- Description: 'Checks for calls to puts, print, etc.'
644
- SafeAutoCorrect: false
645
- VersionAdded: '0.15'
646
- VersionChanged: '0.19'
647
- Include:
648
- - app/**/*.rb
649
- - config/**/*.rb
650
- - db/**/*.rb
651
- - lib/**/*.rb
254
+ Enabled: true
652
255
 
653
256
  Rails/OutputSafety:
654
257
  Enabled: false
655
- Description: 'The use of `html_safe` or `raw` may be a security risk.'
656
- VersionAdded: '0.41'
657
258
 
658
259
  Rails/Pick:
659
- Enabled: false
660
- Description: 'Prefer `pick` over `pluck(...).first`.'
661
- StyleGuide: 'https://rails.rubystyle.guide#pick'
662
- Safe: false
663
- VersionAdded: '2.6'
260
+ Enabled: true
664
261
 
665
262
  Rails/Pluck:
666
- Enabled: false
667
- Description: 'Prefer `pluck` over `map { ... }`.'
668
- StyleGuide: 'https://rails.rubystyle.guide#pluck'
669
- Safe: false
670
- VersionAdded: '2.7'
671
- VersionChanged: '2.18'
263
+ Enabled: true
672
264
 
673
265
  Rails/PluckId:
674
- Enabled: false
675
- Description: 'Use `ids` instead of `pluck(:id)` or `pluck(primary_key)`.'
676
- StyleGuide: 'https://rails.rubystyle.guide/#ids'
677
- Safe: false
678
- VersionAdded: '2.7'
266
+ Enabled: true
679
267
 
680
268
  Rails/PluckInWhere:
681
- Enabled: false
682
- Description: 'Use `select` instead of `pluck` in `where` query methods.'
683
- Safe: false
684
- VersionAdded: '2.7'
685
- VersionChanged: '2.8'
686
- EnforcedStyle: conservative
687
- SupportedStyles:
688
- - conservative
689
- - aggressive
269
+ Enabled: true
690
270
 
691
271
  Rails/PluralizationGrammar:
692
272
  Enabled: false
693
- Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
694
- VersionAdded: '0.35'
695
273
 
696
274
  Rails/Presence:
697
- Enabled: false
698
- Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
699
- VersionAdded: '0.52'
275
+ Enabled: true
700
276
 
701
277
  Rails/Present:
702
278
  Enabled: false
703
- Description: 'Enforces use of `present?`.'
704
- VersionAdded: '0.48'
705
- VersionChanged: '0.67'
706
- # Convert usages of `!nil? && !empty?` to `present?`
707
- NotNilAndNotEmpty: true
708
- # Convert usages of `!blank?` to `present?`
709
- NotBlank: true
710
- # Convert usages of `unless blank?` to `if present?`
711
- UnlessBlank: true
712
279
 
713
280
  Rails/RakeEnvironment:
714
281
  Enabled: false
715
- Description: 'Include `:environment` as a dependency for all Rake tasks.'
716
- Safe: false
717
- VersionAdded: '2.4'
718
- VersionChanged: '2.6'
719
- Include:
720
- - '**/Rakefile'
721
- - '**/*.rake'
722
- Exclude:
723
- - 'lib/capistrano/tasks/**/*.rake'
724
282
 
725
283
  Rails/ReadWriteAttribute:
284
+ Enabled: true
285
+
286
+ Rails/RedundantActiveRecordAllMethod:
726
287
  Enabled: false
727
- Description: >-
728
- Checks for read_attribute(:attr) and
729
- write_attribute(:attr, val).
730
- StyleGuide: 'https://rails.rubystyle.guide#read-attribute'
731
- VersionAdded: '0.20'
732
- VersionChanged: '0.29'
733
- Include:
734
- - app/models/**/*.rb
735
288
 
736
289
  Rails/RedundantAllowNil:
737
- Enabled: false
738
- Description: >-
739
- Finds redundant use of `allow_nil` when `allow_blank` is set to
740
- certain values in model validations.
741
- VersionAdded: '0.67'
742
- Include:
743
- - app/models/**/*.rb
290
+ Enabled: true
744
291
 
745
292
  Rails/RedundantForeignKey:
746
- Enabled: false
747
- Description: 'Checks for associations where the `:foreign_key` option is redundant.'
748
- VersionAdded: '2.6'
293
+ Enabled: true
749
294
 
750
295
  Rails/RedundantPresenceValidationOnBelongsTo:
751
296
  Enabled: true
752
- Description: 'Checks for redundant presence validation on belongs_to association.'
753
- SafeAutoCorrect: false
754
- VersionAdded: '2.13'
755
297
 
756
298
  Rails/RedundantReceiverInWithOptions:
757
- Enabled: false
758
- Description: 'Checks for redundant receiver in `with_options`.'
759
- VersionAdded: '0.52'
299
+ Enabled: true
760
300
 
761
301
  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
302
+ Enabled: true
768
303
 
769
304
  Rails/ReflectionClassName:
770
- Enabled: false
771
- Description: 'Use a string for `class_name` option value in the definition of a reflection.'
772
- Safe: false
773
- VersionAdded: '0.64'
774
- VersionChanged: '2.10'
305
+ Enabled: true
775
306
 
776
307
  Rails/RefuteMethods:
777
308
  Enabled: false
778
- Description: 'Use `assert_not` methods instead of `refute` methods.'
779
- VersionAdded: '0.56'
780
- EnforcedStyle: assert_not
781
- SupportedStyles:
782
- - assert_not
783
- - refute
784
- Include:
785
- - '**/test/**/*'
786
309
 
787
310
  Rails/RelativeDateConstant:
788
- Enabled: false
789
- Description: 'Do not assign relative date to constants.'
790
- SafeAutoCorrect: false
791
- VersionAdded: '0.48'
792
- VersionChanged: '2.13'
311
+ Enabled: true
793
312
 
794
313
  Rails/RenderInline:
795
314
  Enabled: false
796
- Description: 'Prefer using a template over inline rendering.'
797
- StyleGuide: 'https://rails.rubystyle.guide/#inline-rendering'
798
- VersionAdded: '2.7'
799
315
 
800
316
  Rails/RenderPlainText:
801
- Enabled: false
802
- Description: 'Prefer `render plain:` over `render text:`.'
803
- StyleGuide: 'https://rails.rubystyle.guide/#plain-text-rendering'
804
- VersionAdded: '2.7'
805
- # Convert only when `content_type` is explicitly set to `text/plain`.
806
- ContentTypeCompatibility: true
317
+ Enabled: true
807
318
 
808
319
  Rails/RequestReferer:
809
320
  Enabled: false
810
- Description: 'Use consistent syntax for request.referer.'
811
- VersionAdded: '0.41'
812
- EnforcedStyle: referer
813
- SupportedStyles:
814
- - referer
815
- - referrer
816
321
 
817
322
  Rails/RequireDependency:
818
323
  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
324
 
823
325
  Rails/ResponseParsedBody:
824
326
  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
327
 
835
328
  Rails/ReversibleMigration:
836
- Enabled: false
837
- Description: 'Checks whether the change method of the migration file is reversible.'
838
- StyleGuide: 'https://rails.rubystyle.guide#reversible-migration'
839
- Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
840
- VersionAdded: '0.47'
841
- VersionChanged: '2.13'
842
- Include:
843
- - db/**/*.rb
329
+ Enabled: true
844
330
 
845
331
  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
332
+ Enabled: true
852
333
 
853
334
  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'
335
+ Enabled: true
857
336
 
858
337
  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'
338
+ Enabled: true
863
339
 
864
340
  Rails/RootPublicPath:
865
- Enabled: false
866
- Description: "Favor `Rails.public_path` over `Rails.root` with `'public'`."
867
- VersionAdded: '2.15'
341
+ Enabled: true
868
342
 
869
343
  Rails/SafeNavigation:
870
344
  Enabled: true
871
- Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`."
872
- VersionAdded: '0.43'
873
- # This will convert usages of `try` to use safe navigation as well as `try!`.
874
- # `try` and `try!` work slightly differently. `try!` and safe navigation will
875
- # both raise a `NoMethodError` if the receiver of the method call does not
876
- # implement the intended method. `try` will not raise an exception for this.
877
- ConvertTry: false
878
345
 
879
346
  Rails/SafeNavigationWithBlank:
880
347
  Enabled: true
881
- Description: 'Avoid `foo&.blank?` in conditionals.'
882
- VersionAdded: '2.4'
883
- # While the safe navigation operator is generally a good idea, when
884
- # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually
885
- # do the opposite of what the author intends.
886
- #
887
- # foo&.blank? #=> nil
888
- # foo.blank? #=> true
889
- SafeAutoCorrect: false
890
348
 
891
349
  Rails/SaveBang:
892
- Enabled: false
893
- Description: 'Identifies possible cases where Active Record save! or related should be used.'
894
- StyleGuide: 'https://rails.rubystyle.guide#save-bang'
895
- VersionAdded: '0.42'
896
- VersionChanged: '0.59'
897
- AllowImplicitReturn: true
898
- AllowedReceivers: []
899
- SafeAutoCorrect: false
350
+ Enabled: true
900
351
 
901
352
  Rails/SchemaComment:
902
353
  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
354
 
908
355
  Rails/ScopeArgs:
909
356
  Enabled: true
910
- Description: 'Checks the arguments of ActiveRecord scopes.'
911
- VersionAdded: '0.19'
912
- VersionChanged: '2.12'
913
- Include:
914
- - app/models/**/*.rb
357
+
358
+ Rails/SelectMap:
359
+ Enabled: false
915
360
 
916
361
  Rails/ShortI18n:
917
362
  Enabled: false
918
- Description: 'Use the short form of the I18n methods: `t` instead of `translate` and `l` instead of `localize`.'
919
- StyleGuide: 'https://rails.rubystyle.guide/#short-i18n'
920
- VersionAdded: '2.7'
921
- EnforcedStyle: conservative
922
- SupportedStyles:
923
- - conservative
924
- - aggressive
925
363
 
926
364
  Rails/SkipsModelValidations:
927
365
  Enabled: false
928
- Description: >-
929
- Use methods that skips model validations with caution.
930
- See reference for more information.
931
- Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
932
- VersionAdded: '0.47'
933
- VersionChanged: '2.7'
934
- ForbiddenMethods:
935
- - decrement!
936
- - decrement_counter
937
- - increment!
938
- - increment_counter
939
- - insert
940
- - insert!
941
- - insert_all
942
- - insert_all!
943
- - toggle!
944
- - touch
945
- - touch_all
946
- - update_all
947
- - update_attribute
948
- - update_column
949
- - update_columns
950
- - update_counters
951
- - upsert
952
- - upsert_all
953
- AllowedMethods: []
954
366
 
955
367
  Rails/SquishedSQLHeredocs:
956
368
  Enabled: false
957
- Description: 'Checks SQL heredocs to use `.squish`.'
958
- StyleGuide: 'https://rails.rubystyle.guide/#squished-heredocs'
959
- VersionAdded: '2.8'
960
- VersionChanged: '2.9'
961
- # Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines
962
- # to be preserved in order to work, thus autocorrection is not safe.
963
- SafeAutoCorrect: false
964
369
 
965
370
  Rails/StripHeredoc:
966
371
  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'
372
+
373
+ Rails/StripHeredoc:
374
+ Enabled: true
970
375
 
971
376
  Rails/TableNameAssignment:
972
377
  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
378
 
980
379
  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
380
+ Enabled: pending
987
381
 
988
382
  Rails/TimeZone:
989
- Enabled: false
990
- Description: 'Checks the correct usage of time zone aware methods.'
991
- StyleGuide: 'https://rails.rubystyle.guide#time'
992
- Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
993
- SafeAutoCorrect: false
994
- VersionAdded: '0.30'
995
- VersionChanged: '2.13'
996
- # The value `strict` means that `Time` should be used with `zone`.
997
- # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
998
- EnforcedStyle: flexible
999
- SupportedStyles:
1000
- - strict
1001
- - flexible
1002
- Exclude:
1003
- - '**/*.gemspec'
383
+ Enabled: true
1004
384
 
1005
385
  Rails/TimeZoneAssignment:
1006
386
  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
387
 
1014
388
  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'
389
+ Enabled: true
1018
390
  EnforcedStyle: to_fs
1019
- SupportedStyles:
1020
- - to_fs
1021
- - to_formatted_s
1022
- VersionAdded: '2.15'
1023
391
 
1024
392
  Rails/ToSWithArgument:
1025
- Enabled: false
1026
- Description: 'Identifies passing any argument to `#to_s`.'
1027
- Safe: false
1028
- VersionAdded: '2.16'
393
+ Enabled: true
1029
394
 
1030
395
  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'
396
+ Enabled: true
1037
397
 
1038
398
  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'
399
+ Enabled: true
1044
400
 
1045
401
  Rails/UniqBeforePluck:
1046
402
  Enabled: true
1047
- Description: 'Prefer the use of uniq or distinct before pluck.'
1048
- VersionAdded: '0.40'
1049
- VersionChanged: '2.13'
1050
- EnforcedStyle: conservative
1051
- SupportedStyles:
1052
- - conservative
1053
- - aggressive
1054
- SafeAutoCorrect: false
1055
403
 
1056
404
  Rails/UniqueValidationWithoutIndex:
1057
- Enabled: false
1058
- Description: 'Uniqueness validation should have a unique index on the database column.'
1059
- VersionAdded: '2.5'
1060
- Include:
1061
- - app/models/**/*.rb
405
+ Enabled: true
1062
406
 
1063
407
  Rails/UnknownEnv:
1064
408
  Enabled: false
1065
- Description: 'Use correct environment name.'
1066
- Severity: warning
1067
- VersionAdded: '0.51'
1068
- VersionChanged: '2.18'
1069
- Environments:
1070
- - development
1071
- - test
1072
- - production
1073
409
 
1074
410
  Rails/UnusedIgnoredColumns:
1075
411
  Enabled: true
1076
- Description: 'Remove a column that does not exist from `ignored_columns`.'
1077
- VersionAdded: '2.11'
1078
- Include:
1079
- - app/models/**/*.rb
412
+
413
+ Rails/UnusedRenderContent:
414
+ Enabled: true
1080
415
 
1081
416
  Rails/Validation:
1082
- Enabled: false
1083
- Description: 'Use validates :attribute, hash of validations.'
1084
- VersionAdded: '0.9'
1085
- VersionChanged: '0.41'
1086
- Include:
1087
- - app/models/**/*.rb
417
+ Enabled: true
1088
418
 
1089
419
  Rails/WhereEquals:
1090
- Enabled: false
1091
- Description: 'Pass conditions to `where` as a hash instead of manually constructing SQL.'
1092
- StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
1093
- SafeAutoCorrect: false
1094
- VersionAdded: '2.9'
1095
- VersionChanged: '2.10'
420
+ Enabled: true
1096
421
 
1097
422
  Rails/WhereExists:
1098
423
  Enabled: false
1099
- Description: 'Prefer `exists?(...)` over `where(...).exists?`.'
1100
- SafeAutoCorrect: false
1101
- EnforcedStyle: exists
1102
- SupportedStyles:
1103
- - exists
1104
- - where
1105
- VersionAdded: '2.7'
1106
- VersionChanged: '2.10'
1107
424
 
1108
425
  Rails/WhereMissing:
1109
426
  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'
1113
427
 
1114
428
  Rails/WhereNot:
1115
429
  Enabled: true
1116
- Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.'
1117
- StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
1118
- VersionAdded: '2.8'
1119
430
 
1120
431
  Rails/WhereNotWithMultipleConditions:
1121
432
  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'
433
+
434
+ Style/InvertibleUnlessCondition:
435
+ Enabled: false