rubocop-rubomatic-rails 1.3.0.pre.rc.1 → 1.4.0.pre.rc.1

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