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