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