rubomatic 1.3.0 → 2.0.0.pre.rc.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce8e0f7a87f9d63addb88eb2a46878a93a5fce7dc6fa2d7a30e8a25d58823641
4
- data.tar.gz: bf207e649b1097f481b4e2a55ed8266cc3b6df650ee4c66a2eced23e2fbc11a5
3
+ metadata.gz: 781a17ca01b8e55f315cfd78066883ac1f8828c65d4a2b6ad9346b2c1b726592
4
+ data.tar.gz: fe528fb933699beae07e199c0e532963ef744095df61d5dbd341f32629ea3f5c
5
5
  SHA512:
6
- metadata.gz: 24b1b06a1335c8d90f06586a0714af7a79d70afbb38515abb20dcb25a1af009908e0cd7adab1f74610bdd230d9e04ce1a278a29b5fbac6f6a4ef0458705c995c
7
- data.tar.gz: 7eaea3d006d4581d3d341800ffee16df481d4dce5e595667b036f40eca9546de8074c71356d937248a2160726d3e92ce016c0a9e0e871e93f81ca45657e3ef8e
6
+ metadata.gz: b0bfe220e25cbf36493375f5cf8d7d356621937a47ffb8a040cc271d021e5ba9d266c7ca625b45ff5e078f9a8b97d3d4ea8bfeea2475b28f959134ccd17e9a63
7
+ data.tar.gz: e30d46d1214c38f3b8815079a21dcb706d78be1862b9343093fcfd7d345fe9985d3438dadcdc1277a4b17c0b57d89b3ba3cffb0e02d84679d72f861e35d660ee
data/CHANGELOG.adoc CHANGED
@@ -1,3 +1,10 @@
1
+ == 2.0.0
2
+
3
+ === Dependencies
4
+
5
+ * Removed ``rubocop-rails``
6
+ ** It will be part of ``rubomatic-rails``
7
+
1
8
  == 1.3.0
2
9
 
3
10
  === Config
data/README.adoc CHANGED
@@ -26,7 +26,6 @@ Add the following to your ``.rubocop.yml`` config file
26
26
  [source,yaml]
27
27
  ----
28
28
  require:
29
- - rubocop-rails
30
29
  - rubocop-performance
31
30
  - rubocop-brands_insurance
32
31
 
@@ -40,7 +39,6 @@ If you need to override a setting:
40
39
  ----
41
40
  # Add to Naming/VariableNumber.AllowedIdentifiers
42
41
  require:
43
- - rubocop-rails
44
42
  - rubocop-performance
45
43
  - rubocop-brands_insurance
46
44
 
@@ -59,7 +57,6 @@ Naming/VariableNumber:
59
57
  ----
60
58
  # Completely override Naming/VariableNumber.AllowedIdentifiers
61
59
  require:
62
- - rubocop-rails
63
60
  - rubocop-performance
64
61
  - rubocop-brands_insurance
65
62
 
data/configs/rubocop.yml CHANGED
@@ -9,7 +9,6 @@ inherit_from:
9
9
  - ./migration.yml
10
10
  - ./naming.yml
11
11
  - ./performance.yml
12
- - ./rails.yml
13
12
  - ./security.yml
14
13
  - ./style.yml
15
14
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rubomatic
4
- VERSION = '1.3.0'
4
+ VERSION = '2.0.0-rc.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubomatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.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-04-03 00:00:00.000000000 Z
11
+ date: 2023-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.16.0
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop-rails
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 2.18.0
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 2.18.0
69
55
  description:
70
56
  email:
71
57
  - documents@brandsinsurance.com
@@ -87,7 +73,6 @@ files:
87
73
  - configs/migration.yml
88
74
  - configs/naming.yml
89
75
  - configs/performance.yml
90
- - configs/rails.yml
91
76
  - configs/rubocop.yml
92
77
  - configs/security.yml
93
78
  - configs/style.yml
@@ -112,9 +97,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
112
97
  version: 3.0.1
113
98
  required_rubygems_version: !ruby/object:Gem::Requirement
114
99
  requirements:
115
- - - ">="
100
+ - - ">"
116
101
  - !ruby/object:Gem::Version
117
- version: '0'
102
+ version: 1.3.1
118
103
  requirements: []
119
104
  rubygems_version: 3.2.15
120
105
  signing_key:
data/configs/rails.yml DELETED
@@ -1,1065 +0,0 @@
1
- require: rubocop-rails
2
-
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
- Enabled: true
8
- SafeAutoCorrect: false
9
- VersionAdded: '2.16'
10
-
11
- 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
- Enabled: true
16
- SafeAutoCorrect: false
17
- VersionAdded: '2.14'
18
- Include:
19
- - '**/test/**/*.rb'
20
-
21
- Rails/ActionFilter:
22
- Description: 'Enforces consistent use of action filter methods.'
23
- Enabled: true
24
- VersionAdded: '0.19'
25
- EnforcedStyle: action
26
- SupportedStyles:
27
- - action
28
- - filter
29
- Include:
30
- - app/controllers/**/*.rb
31
- - app/mailers/**/*.rb
32
-
33
- Rails/ActionOrder:
34
- Description: 'Enforce consistent ordering of controller actions.'
35
- Enabled: false
36
- VersionAdded: '2.17'
37
- ExpectedOrder:
38
- - index
39
- - show
40
- - new
41
- - edit
42
- - create
43
- - update
44
- - destroy
45
- Include:
46
- - app/controllers/**/*.rb
47
-
48
- Rails/ActiveRecordAliases:
49
- Description: >-
50
- Avoid Active Record aliases:
51
- Use `update` instead of `update_attributes`.
52
- Use `update!` instead of `update_attributes!`.
53
- Enabled: true
54
- VersionAdded: '0.53'
55
- SafeAutoCorrect: false
56
-
57
- 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
- Enabled: true
61
- VersionAdded: '2.7'
62
- Include:
63
- - app/models/**/*.rb
64
-
65
- Rails/ActiveRecordOverride:
66
- Description: >-
67
- Check for overriding Active Record methods instead of using
68
- callbacks.
69
- Enabled: true
70
- VersionAdded: '0.67'
71
- Include:
72
- - app/models/**/*.rb
73
-
74
- 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
- Enabled: true
80
- VersionAdded: '0.48'
81
-
82
- Rails/ActiveSupportOnLoad:
83
- Description: 'Use `ActiveSupport.on_load(...)` to patch Rails framework classes.'
84
- 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
-
91
- 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
- Enabled: true
97
- VersionAdded: '2.11'
98
- Include:
99
- - db/migrate/*.rb
100
-
101
- 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
- Enabled: true
107
- VersionAdded: '2.8'
108
-
109
- Rails/ApplicationController:
110
- Description: 'Check that controllers subclass ApplicationController.'
111
- Enabled: true
112
- SafeAutoCorrect: false
113
- VersionAdded: '2.4'
114
- VersionChanged: '2.5'
115
-
116
- Rails/ApplicationJob:
117
- Description: 'Check that jobs subclass ApplicationJob.'
118
- Enabled: true
119
- SafeAutoCorrect: false
120
- VersionAdded: '0.49'
121
- VersionChanged: '2.5'
122
-
123
- Rails/ApplicationMailer:
124
- Description: 'Check that mailers subclass ApplicationMailer.'
125
- Enabled: true
126
- SafeAutoCorrect: false
127
- VersionAdded: '2.4'
128
- VersionChanged: '2.5'
129
-
130
- Rails/ApplicationRecord:
131
- Description: 'Check that models subclass ApplicationRecord.'
132
- Enabled: true
133
- SafeAutoCorrect: false
134
- VersionAdded: '0.49'
135
- VersionChanged: '2.5'
136
-
137
- Rails/ArelStar:
138
- Description: 'Enforces `Arel.star` instead of `"*"` for expanded columns.'
139
- Enabled: true
140
- SafeAutoCorrect: false
141
- VersionAdded: '2.9'
142
-
143
- Rails/AssertNot:
144
- Description: 'Use `assert_not` instead of `assert !`.'
145
- Enabled: true
146
- VersionAdded: '0.56'
147
- Include:
148
- - '**/test/**/*'
149
-
150
- Rails/AttributeDefaultBlockValue:
151
- Description: 'Pass method call in block for attribute option `default`.'
152
- Enabled: true
153
- VersionAdded: '2.9'
154
- Include:
155
- - 'app/models/**/*'
156
-
157
- Rails/BelongsTo:
158
- Description: >-
159
- Use `optional: true` instead of `required: false` for
160
- `belongs_to` relations.
161
- Enabled: true
162
- VersionAdded: '0.62'
163
-
164
- Rails/Blank:
165
- Description: 'Enforces use of `blank?`.'
166
- Enabled: true
167
- SafeAutoCorrect: false
168
- VersionAdded: '0.48'
169
- VersionChanged: '2.10'
170
- # Convert usages of `nil? || empty?` to `blank?`
171
- NilOrEmpty: true
172
- # Convert usages of `!present?` to `blank?`
173
- NotPresent: true
174
- # Convert usages of `unless present?` to `if blank?`
175
- UnlessPresent: true
176
-
177
- Rails/BulkChangeTable:
178
- Description: 'Check whether alter queries are combinable.'
179
- Enabled: true
180
- VersionAdded: '0.57'
181
- Database: null
182
- SupportedDatabases:
183
- - mysql
184
- - postgresql
185
- Include:
186
- - db/migrate/*.rb
187
-
188
- Rails/CompactBlank:
189
- Description: 'Checks if collection can be blank-compacted with `compact_blank`.'
190
- Enabled: true
191
- Safe: false
192
- VersionAdded: '2.13'
193
-
194
- 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'
203
- # This `Exclude` config prevents false positives for `tag` calls to `has_one: tag` and Puma configuration:
204
- # https://puma.io/puma/Puma/DSL.html#tag-instance_method
205
- # No helpers are used in normal models and configs.
206
- Exclude:
207
- - app/models/**/*.rb
208
- - config/**/*.rb
209
-
210
- Rails/CreateTableWithTimestamps:
211
- Description: >-
212
- Checks the migration for which timestamps are not included
213
- when creating a new table.
214
- Enabled: true
215
- VersionAdded: '0.52'
216
- Include:
217
- - db/migrate/*.rb
218
- Exclude:
219
- # Respect the `active_storage_variant_records` table of `*_create_active_storage_tables.active_storage.rb`
220
- # auto-generated by `bin/rails active_storage:install` even if `created_at` is not specified.
221
- - db/migrate/*_create_active_storage_tables.active_storage.rb
222
-
223
- Rails/Date:
224
- Description: >-
225
- Checks the correct usage of date aware methods,
226
- such as Date.today, Date.current etc.
227
- Enabled: true
228
- VersionAdded: '0.30'
229
- VersionChanged: '2.11'
230
- # The value `strict` disallows usage of `Date.today`, `Date.current`,
231
- # `Date#to_time` etc.
232
- # The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
233
- # (but not `Date.today`) which are overridden by ActiveSupport to handle current
234
- # time zone.
235
- EnforcedStyle: strict
236
- SupportedStyles:
237
- - strict
238
- - flexible
239
- AllowToTime: false
240
-
241
- Rails/DefaultScope:
242
- Description: 'Avoid use of `default_scope`.'
243
- StyleGuide: 'https://rails.rubystyle.guide#avoid-default-scope'
244
- Enabled: true
245
- VersionAdded: '2.7'
246
-
247
- Rails/Delegate:
248
- Description: 'Prefer delegate method for delegations.'
249
- Enabled: true
250
- VersionAdded: '0.21'
251
- VersionChanged: '0.50'
252
- # When set to true, using the target object as a prefix of the
253
- # method name without using the `delegate` method will be a
254
- # violation. When set to false, this case is legal.
255
- EnforceForPrefixed: true
256
-
257
- Rails/DelegateAllowBlank:
258
- Description: 'Do not use allow_blank as an option to delegate.'
259
- Enabled: true
260
- VersionAdded: '0.44'
261
-
262
- Rails/DeprecatedActiveModelErrorsMethods:
263
- Description: 'Avoid manipulating ActiveModel errors hash directly.'
264
- Enabled: true
265
- Safe: false
266
- VersionAdded: '2.14'
267
- VersionChanged: '2.15'
268
-
269
- 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
- Enabled: true
273
- VersionAdded: '2.15'
274
-
275
- Rails/DuplicateAssociation:
276
- Description: "Don't repeat associations in a model."
277
- Enabled: true
278
- VersionAdded: '2.14'
279
-
280
- Rails/DuplicateScope:
281
- Description: 'Multiple scopes share this same where clause.'
282
- Enabled: true
283
- VersionAdded: '2.14'
284
-
285
- Rails/DurationArithmetic:
286
- Description: 'Do not use duration as arithmetic operand with `Time.current`.'
287
- StyleGuide: 'https://rails.rubystyle.guide#duration-arithmetic'
288
- Enabled: true
289
- VersionAdded: '2.13'
290
-
291
- Rails/DynamicFindBy:
292
- Description: 'Use `find_by` instead of dynamic `find_by_*`.'
293
- StyleGuide: 'https://rails.rubystyle.guide#find_by'
294
- Enabled: true
295
- Safe: false
296
- VersionAdded: '0.44'
297
- VersionChanged: '2.10'
298
- # The `Whitelist` has been deprecated, Please use `AllowedMethods` instead.
299
- Whitelist:
300
- - find_by_sql
301
- - find_by_token_for
302
- AllowedMethods:
303
- - find_by_sql
304
- - find_by_token_for
305
- AllowedReceivers:
306
- - Gem::Specification
307
- - page # Prevents a warning for `page.find_by_id`. See: https://github.com/rubocop/rubocop-rails/issues/778
308
-
309
- 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
- Enabled: true
313
- VersionAdded: '2.11'
314
-
315
- Rails/EnumHash:
316
- Description: 'Prefer hash syntax over array syntax when defining enums.'
317
- StyleGuide: 'https://rails.rubystyle.guide#enums'
318
- Enabled: true
319
- VersionAdded: '2.3'
320
- Include:
321
- - app/models/**/*.rb
322
-
323
- Rails/EnumUniqueness:
324
- Description: 'Avoid duplicate integers in hash-syntax `enum` declaration.'
325
- Enabled: true
326
- VersionAdded: '0.46'
327
- Include:
328
- - app/models/**/*.rb
329
-
330
- Rails/EnvironmentComparison:
331
- Description: "Favor `Rails.env.production?` over `Rails.env == 'production'`."
332
- Enabled: true
333
- VersionAdded: '0.52'
334
-
335
- Rails/EnvironmentVariableAccess:
336
- Description: 'Do not access `ENV` directly after initialization.'
337
- Enabled: true
338
- VersionAdded: '2.10'
339
- VersionChanged: '2.11'
340
- Include:
341
- - app/**/*.rb
342
- - lib/**/*.rb
343
- Exclude:
344
- - lib/**/*.rake
345
- AllowReads: false
346
- AllowWrites: false
347
-
348
- 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
- Enabled: true
354
- VersionAdded: '0.41'
355
- Include:
356
- - app/**/*.rb
357
- - config/**/*.rb
358
- - lib/**/*.rb
359
- Exclude:
360
- - lib/**/*.rake
361
-
362
- Rails/ExpandedDateRange:
363
- Description: 'Checks for expanded date range.'
364
- StyleGuide: 'https://rails.rubystyle.guide/#date-time-range'
365
- Enabled: true
366
- VersionAdded: '2.11'
367
-
368
- Rails/FilePath:
369
- Description: 'Use `Rails.root.join` for file path joining.'
370
- Enabled: true
371
- VersionAdded: '0.47'
372
- VersionChanged: '2.4'
373
- EnforcedStyle: arguments
374
- SupportedStyles:
375
- - slashes
376
- - arguments
377
-
378
- Rails/FindBy:
379
- Description: 'Prefer find_by over where.first.'
380
- StyleGuide: 'https://rails.rubystyle.guide#find_by'
381
- Enabled: true
382
- VersionAdded: '0.30'
383
- VersionChanged: '2.11'
384
- IgnoreWhereFirst: false
385
- Include:
386
- - app/models/**/*.rb
387
- - app/controllers/**/*.rb
388
- - app/helpers/**/*.rb
389
-
390
- 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
- Enabled: true
396
- VersionAdded: '2.7'
397
-
398
- Rails/FindEach:
399
- Description: 'Prefer all.find_each over all.find.'
400
- StyleGuide: 'https://rails.rubystyle.guide#find-each'
401
- Enabled: true
402
- VersionAdded: '0.30'
403
- VersionChanged: '2.9'
404
- Include: [ ]
405
- AllowedMethods:
406
- # Methods that don't work well with `find_each`.
407
- - order
408
- - limit
409
- - select
410
- - lock
411
- AllowedPatterns: [ ]
412
-
413
- 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
- Enabled: false
417
- VersionAdded: '2.16'
418
- SafeAutoCorrect: false
419
-
420
- Rails/HasAndBelongsToMany:
421
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
422
- StyleGuide: 'https://rails.rubystyle.guide#has-many-through'
423
- Enabled: true
424
- VersionAdded: '0.12'
425
- Include:
426
- - app/models/**/*.rb
427
-
428
- 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
- Enabled: true
432
- VersionAdded: '0.50'
433
- Include:
434
- - app/models/**/*.rb
435
-
436
- Rails/HelperInstanceVariable:
437
- Description: 'Do not use instance variables in helpers.'
438
- Enabled: true
439
- VersionAdded: '2.0'
440
- Include:
441
- - app/helpers/**/*.rb
442
- Exclude:
443
- - app/helpers/sessions_helper.rb
444
-
445
- Rails/HttpPositionalArguments:
446
- Description: 'Use keyword arguments instead of positional arguments in http method calls.'
447
- Enabled: true
448
- VersionAdded: '0.44'
449
- Include:
450
- - 'spec/**/*'
451
- - 'test/**/*'
452
-
453
- Rails/HttpStatus:
454
- Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
455
- Enabled: true
456
- VersionAdded: '0.54'
457
- VersionChanged: '2.11'
458
- EnforcedStyle: symbolic
459
- SupportedStyles:
460
- - numeric
461
- - symbolic
462
-
463
- 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
- Enabled: false
468
- VersionAdded: '2.14'
469
- Include:
470
- - 'app/controllers/**/*.rb'
471
-
472
- Rails/I18nLocaleAssignment:
473
- Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.'
474
- Enabled: true
475
- VersionAdded: '2.11'
476
- Include:
477
- - spec/**/*.rb
478
- - test/**/*.rb
479
-
480
- 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
- Enabled: false
484
- VersionAdded: '2.14'
485
-
486
- Rails/IgnoredColumnsAssignment:
487
- Description: 'Looks for assignments of `ignored_columns` that override previous assignments.'
488
- StyleGuide: 'https://rails.rubystyle.guide/#append-ignored-columns'
489
- Enabled: true
490
- SafeAutoCorrect: false
491
- VersionAdded: '2.17'
492
-
493
- 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
- Enabled: true
497
- VersionAdded: '0.63'
498
- Include:
499
- - app/controllers/**/*.rb
500
- - app/mailers/**/*.rb
501
-
502
- Rails/IndexBy:
503
- Description: 'Prefer `index_by` over `each_with_object`, `to_h`, or `map`.'
504
- Enabled: true
505
- VersionAdded: '2.5'
506
- VersionChanged: '2.8'
507
-
508
- Rails/IndexWith:
509
- Description: 'Prefer `index_with` over `each_with_object`, `to_h`, or `map`.'
510
- Enabled: true
511
- VersionAdded: '2.5'
512
- VersionChanged: '2.8'
513
-
514
- 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
- Enabled: true
518
- VersionAdded: '2.7'
519
-
520
- Rails/InverseOf:
521
- Description: 'Checks for associations where the inverse cannot be determined automatically.'
522
- Enabled: true
523
- VersionAdded: '0.52'
524
- IgnoreScopes: false
525
- Include:
526
- - app/models/**/*.rb
527
-
528
- 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
- Enabled: true
532
- Safe: false
533
- VersionAdded: '0.52'
534
- Include:
535
- - app/controllers/**/*.rb
536
- - app/mailers/**/*.rb
537
-
538
- 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
- Enabled: false
545
- VersionAdded: '0.62'
546
-
547
- Rails/MailerName:
548
- Description: 'Mailer should end with `Mailer` suffix.'
549
- StyleGuide: 'https://rails.rubystyle.guide/#mailer-name'
550
- Enabled: true
551
- SafeAutoCorrect: false
552
- VersionAdded: '2.7'
553
- Include:
554
- - app/mailers/**/*.rb
555
-
556
- 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
- Enabled: true
562
- VersionAdded: '2.7'
563
- Include:
564
- - config/routes.rb
565
- - config/routes/**/*.rb
566
-
567
- Rails/MigrationClassName:
568
- Description: 'The class name of the migration should match its file name.'
569
- Enabled: true
570
- VersionAdded: '2.14'
571
- Include:
572
- - db/migrate/*.rb
573
-
574
- Rails/NegateInclude:
575
- Description: 'Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`.'
576
- StyleGuide: 'https://rails.rubystyle.guide#exclude'
577
- Enabled: true
578
- Safe: false
579
- VersionAdded: '2.7'
580
- VersionChanged: '2.9'
581
-
582
- Rails/NotNullColumn:
583
- Description: 'Do not add a NOT NULL column without a default value.'
584
- Enabled: false
585
- VersionAdded: '0.43'
586
- Include:
587
- - db/migrate/*.rb
588
-
589
- 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
- Enabled: false
595
- VersionAdded: '2.8'
596
-
597
- Rails/Output:
598
- Description: 'Checks for calls to puts, print, etc.'
599
- Enabled: true
600
- SafeAutoCorrect: false
601
- VersionAdded: '0.15'
602
- VersionChanged: '0.19'
603
- Include:
604
- - app/**/*.rb
605
- - config/**/*.rb
606
- - lib/**/*.rb
607
- Exclude:
608
- - lib/generators/**/*.rb
609
-
610
- Rails/OutputSafety:
611
- Description: 'The use of `html_safe` or `raw` may be a security risk.'
612
- Enabled: true
613
- Severity: info # Or warning
614
- VersionAdded: '0.41'
615
-
616
- Rails/Pick:
617
- Description: 'Prefer `pick` over `pluck(...).first`.'
618
- StyleGuide: 'https://rails.rubystyle.guide#pick'
619
- Enabled: true
620
- Safe: false
621
- VersionAdded: '2.6'
622
-
623
- Rails/Pluck:
624
- Description: 'Prefer `pluck` over `map { ... }`.'
625
- StyleGuide: 'https://rails.rubystyle.guide#pluck'
626
- Enabled: true
627
- VersionAdded: '2.7'
628
-
629
- Rails/PluckId:
630
- Description: 'Use `ids` instead of `pluck(:id)` or `pluck(primary_key)`.'
631
- StyleGuide: 'https://rails.rubystyle.guide/#ids'
632
- Enabled: true
633
- Safe: false
634
- VersionAdded: '2.7'
635
-
636
- Rails/PluckInWhere:
637
- Description: 'Use `select` instead of `pluck` in `where` query methods.'
638
- Enabled: true
639
- Safe: false
640
- VersionAdded: '2.7'
641
- VersionChanged: '2.8'
642
- EnforcedStyle: conservative
643
- SupportedStyles:
644
- - conservative
645
- - aggressive
646
-
647
- Rails/PluralizationGrammar:
648
- Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
649
- Enabled: true
650
- VersionAdded: '0.35'
651
-
652
- Rails/Presence:
653
- Description: 'Checks code that can be written more easily using `Object#presence` defined by Active Support.'
654
- Enabled: true
655
- VersionAdded: '0.52'
656
-
657
- Rails/Present:
658
- Description: 'Enforces use of `present?`.'
659
- Enabled: true
660
- VersionAdded: '0.48'
661
- VersionChanged: '0.67'
662
- # Convert usages of `!nil? && !empty?` to `present?`
663
- NotNilAndNotEmpty: true
664
- # Convert usages of `!blank?` to `present?`
665
- NotBlank: true
666
- # Convert usages of `unless blank?` to `if present?`
667
- UnlessBlank: true
668
-
669
- Rails/RakeEnvironment:
670
- Description: 'Include `:environment` as a dependency for all Rake tasks.'
671
- Enabled: true
672
- Safe: false
673
- VersionAdded: '2.4'
674
- VersionChanged: '2.6'
675
- Include:
676
- - '**/Rakefile'
677
- - '**/*.rake'
678
- Exclude:
679
- - 'lib/capistrano/tasks/**/*.rake'
680
-
681
- 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
- Enabled: true
687
- VersionAdded: '0.20'
688
- VersionChanged: '0.29'
689
- Include:
690
- - app/models/**/*.rb
691
-
692
- Rails/RedundantAllowNil:
693
- Description: >-
694
- Finds redundant use of `allow_nil` when `allow_blank` is set to
695
- certain values in model validations.
696
- Enabled: true
697
- VersionAdded: '0.67'
698
- Include:
699
- - app/models/**/*.rb
700
-
701
- Rails/RedundantForeignKey:
702
- Description: 'Checks for associations where the `:foreign_key` option is redundant.'
703
- Enabled: true
704
- VersionAdded: '2.6'
705
-
706
- Rails/RedundantPresenceValidationOnBelongsTo:
707
- Description: 'Checks for redundant presence validation on belongs_to association.'
708
- Enabled: true
709
- SafeAutoCorrect: false
710
- VersionAdded: '2.13'
711
-
712
- Rails/RedundantReceiverInWithOptions:
713
- Description: 'Checks for redundant receiver in `with_options`.'
714
- Enabled: true
715
- VersionAdded: '0.52'
716
-
717
- Rails/RedundantTravelBack:
718
- Description: Checks for redundant `travel_back` calls.
719
- Enabled: true
720
- VersionAdded: '2.12'
721
- Include:
722
- - spec/**/*.rb
723
- - test/**/*.rb
724
-
725
- Rails/ReflectionClassName:
726
- Description: 'Use a string for `class_name` option value in the definition of a reflection.'
727
- Enabled: true
728
- Safe: false
729
- VersionAdded: '0.64'
730
- VersionChanged: '2.10'
731
-
732
- Rails/RefuteMethods:
733
- Description: 'Use `assert_not` methods instead of `refute` methods.'
734
- Enabled: true
735
- VersionAdded: '0.56'
736
- EnforcedStyle: assert_not
737
- SupportedStyles:
738
- - assert_not
739
- - refute
740
- Include:
741
- - '**/test/**/*'
742
-
743
- Rails/RelativeDateConstant:
744
- Description: 'Do not assign relative date to constants.'
745
- Enabled: true
746
- SafeAutoCorrect: false
747
- VersionAdded: '0.48'
748
- VersionChanged: '2.13'
749
-
750
- Rails/RenderInline:
751
- Description: 'Prefer using a template over inline rendering.'
752
- StyleGuide: 'https://rails.rubystyle.guide/#inline-rendering'
753
- Enabled: true
754
- VersionAdded: '2.7'
755
-
756
- Rails/RenderPlainText:
757
- Description: 'Prefer `render plain:` over `render text:`.'
758
- StyleGuide: 'https://rails.rubystyle.guide/#plain-text-rendering'
759
- Enabled: true
760
- VersionAdded: '2.7'
761
- # Convert only when `content_type` is explicitly set to `text/plain`.
762
- ContentTypeCompatibility: true
763
-
764
- Rails/RequestReferer:
765
- Description: 'Use consistent syntax for request.referer.'
766
- Enabled: true
767
- VersionAdded: '0.41'
768
- EnforcedStyle: referer
769
- SupportedStyles:
770
- - referer
771
- - referrer
772
-
773
- 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
- Enabled: false
777
- VersionAdded: '2.10'
778
-
779
- Rails/ResponseParsedBody:
780
- Description: Prefer `response.parsed_body` to `JSON.parse(response.body)`.
781
- Enabled: true
782
- SafeAutoCorrect: false
783
- VersionAdded: '2.18'
784
- Include:
785
- - spec/controllers/**/*.rb
786
- - spec/requests/**/*.rb
787
- - test/controllers/**/*.rb
788
- - test/integration/**/*.rb
789
-
790
- 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
- Enabled: true
795
- VersionAdded: '0.47'
796
- VersionChanged: '2.13'
797
- Include:
798
- - db/**/*.rb
799
-
800
- Rails/ReversibleMigrationMethodDefinition:
801
- Description: 'Checks whether the migration implements either a `change` method or both an `up` and a `down` method.'
802
- Enabled: true
803
- VersionAdded: '2.10'
804
- VersionChanged: '2.13'
805
- Include:
806
- - db/**/*.rb
807
-
808
- Rails/RootJoinChain:
809
- Description: 'Use a single `#join` instead of chaining on `Rails.root` or `Rails.public_path`.'
810
- Enabled: true
811
- VersionAdded: '2.13'
812
-
813
- Rails/RootPathnameMethods:
814
- Description: 'Use `Rails.root` IO methods instead of passing it to `File`.'
815
- Enabled: true
816
- SafeAutoCorrect: false
817
- VersionAdded: '2.16'
818
-
819
- Rails/RootPublicPath:
820
- Description: "Favor `Rails.public_path` over `Rails.root` with `'public'`."
821
- Enabled: true
822
- VersionAdded: '2.15'
823
-
824
- Rails/SafeNavigation:
825
- Description: "Use Ruby's safe navigation operator (`&.`) instead of `try!`."
826
- Enabled: true
827
- VersionAdded: '0.43'
828
- # This will convert usages of `try` to use safe navigation as well as `try!`.
829
- # `try` and `try!` work slightly differently. `try!` and safe navigation will
830
- # both raise a `NoMethodError` if the receiver of the method call does not
831
- # implement the intended method. `try` will not raise an exception for this.
832
- ConvertTry: true
833
-
834
- Rails/SafeNavigationWithBlank:
835
- Description: 'Avoid `foo&.blank?` in conditionals.'
836
- Enabled: true
837
- VersionAdded: '2.4'
838
- # While the safe navigation operator is generally a good idea, when
839
- # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually
840
- # do the opposite of what the author intends.
841
- #
842
- # foo&.blank? #=> nil
843
- # foo.blank? #=> true
844
- SafeAutoCorrect: false
845
-
846
- 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
- Enabled: true
850
- VersionAdded: '0.42'
851
- VersionChanged: '0.59'
852
- AllowImplicitReturn: true
853
- AllowedReceivers: [ ]# Project specific
854
- SafeAutoCorrect: false
855
-
856
- 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
- Enabled: false
861
- VersionAdded: '2.13'
862
-
863
- Rails/ScopeArgs:
864
- Description: 'Checks the arguments of ActiveRecord scopes.'
865
- Enabled: true
866
- VersionAdded: '0.19'
867
- VersionChanged: '2.12'
868
- Include:
869
- - app/models/**/*.rb
870
-
871
- 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
- Enabled: true
875
- VersionAdded: '2.7'
876
- EnforcedStyle: conservative
877
- SupportedStyles:
878
- - conservative
879
- - aggressive
880
-
881
- 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
- Enabled: true
887
- VersionAdded: '0.47'
888
- VersionChanged: '2.7'
889
- ForbiddenMethods:
890
- - decrement!
891
- - decrement_counter
892
- - increment!
893
- - increment_counter
894
- - insert
895
- - insert!
896
- - insert_all
897
- - insert_all!
898
- - toggle!
899
- - update_all
900
- - update_attribute
901
- - update_column
902
- - update_columns
903
- - update_counters
904
- - upsert
905
- - upsert_all
906
- AllowedMethods:
907
- - touch
908
- - touch_all
909
-
910
- Rails/SquishedSQLHeredocs:
911
- Description: 'Checks SQL heredocs to use `.squish`.'
912
- StyleGuide: 'https://rails.rubystyle.guide/#squished-heredocs'
913
- Enabled: false
914
- VersionAdded: '2.8'
915
- VersionChanged: '2.9'
916
- # Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines
917
- # to be preserved in order to work, thus autocorrection is not safe.
918
- SafeAutoCorrect: false
919
-
920
- Rails/StripHeredoc:
921
- Description: 'Enforces the use of squiggly heredoc over `strip_heredoc`.'
922
- StyleGuide: 'https://rails.rubystyle.guide/#prefer-squiggly-heredoc'
923
- Enabled: true
924
- VersionAdded: '2.15'
925
-
926
- 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
- Enabled: true
931
- VersionAdded: '2.14'
932
- Include:
933
- - app/models/**/*.rb
934
-
935
- 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
- Enabled: true
940
- SafeAutoCorrect: false
941
- VersionAdded: '0.30'
942
- VersionChanged: '2.13'
943
- # The value `strict` means that `Time` should be used with `zone`.
944
- # The value `flexible` allows usage of `in_time_zone` instead of `zone`.
945
- EnforcedStyle: flexible
946
- SupportedStyles:
947
- - strict
948
- - flexible
949
- Exclude:
950
- - '**/*.gemspec'
951
-
952
- 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
- Enabled: true
956
- VersionAdded: '2.10'
957
- Include:
958
- - spec/**/*.rb
959
- - test/**/*.rb
960
-
961
- Rails/ToFormattedS:
962
- Description: 'Checks for consistent uses of `to_fs` or `to_formatted_s`.'
963
- StyleGuide: 'https://rails.rubystyle.guide/#prefer-to-fs'
964
- Enabled: true
965
- EnforcedStyle: to_fs
966
- SupportedStyles:
967
- - to_fs
968
- - to_formatted_s
969
- VersionAdded: '2.15'
970
-
971
- Rails/ToSWithArgument:
972
- Description: 'Identifies passing any argument to `#to_s`.'
973
- Enabled: true
974
- Safe: false
975
- VersionAdded: '2.16'
976
-
977
- Rails/TopLevelHashWithIndifferentAccess:
978
- Description: 'Identifies top-level `HashWithIndifferentAccess`.'
979
- Reference: 'https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#top-level-hashwithindifferentaccess-is-soft-deprecated'
980
- Enabled: true
981
- VersionAdded: '2.16'
982
-
983
- Rails/TransactionExitStatement:
984
- Description: 'Avoid the usage of `return`, `break` and `throw` in transaction blocks.'
985
- Enabled: true
986
- VersionAdded: '2.14'
987
-
988
- Rails/UniqBeforePluck:
989
- Description: 'Prefer the use of uniq or distinct before pluck.'
990
- Enabled: true
991
- VersionAdded: '0.40'
992
- VersionChanged: '2.13'
993
- EnforcedStyle: aggressive
994
- SupportedStyles:
995
- - conservative
996
- - aggressive
997
- SafeAutoCorrect: false
998
-
999
- Rails/UniqueValidationWithoutIndex:
1000
- Description: 'Uniqueness validation should have a unique index on the database column.'
1001
- Enabled: true
1002
- VersionAdded: '2.5'
1003
- Include:
1004
- - app/models/**/*.rb
1005
-
1006
- Rails/UnknownEnv:
1007
- Description: 'Use correct environment name.'
1008
- Enabled: true
1009
- VersionAdded: '0.51'
1010
- Environments:
1011
- - development
1012
- - test
1013
- - staging
1014
- - production
1015
-
1016
- Rails/UnusedIgnoredColumns:
1017
- Description: 'Remove a column that does not exist from `ignored_columns`.'
1018
- Enabled: true
1019
- VersionAdded: '2.11'
1020
- Include:
1021
- - app/models/**/*.rb
1022
-
1023
- Rails/Validation:
1024
- Description: 'Use validates :attribute, hash of validations.'
1025
- Enabled: true
1026
- VersionAdded: '0.9'
1027
- VersionChanged: '0.41'
1028
- Include:
1029
- - app/models/**/*.rb
1030
-
1031
- Rails/WhereEquals:
1032
- Description: 'Pass conditions to `where` as a hash instead of manually constructing SQL.'
1033
- StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
1034
- Enabled: true
1035
- SafeAutoCorrect: false
1036
- VersionAdded: '2.9'
1037
- VersionChanged: '2.10'
1038
-
1039
- Rails/WhereExists:
1040
- Description: 'Prefer `exists?(...)` over `where(...).exists?`.'
1041
- Enabled: true
1042
- SafeAutoCorrect: false
1043
- EnforcedStyle: exists
1044
- SupportedStyles:
1045
- - exists
1046
- - where
1047
- VersionAdded: '2.7'
1048
- VersionChanged: '2.10'
1049
-
1050
- Rails/WhereMissing:
1051
- Description: 'Use `where.missing(...)` to find missing relationship records.'
1052
- StyleGuide: 'https://rails.rubystyle.guide/#finding-missing-relationship-records'
1053
- Enabled: true
1054
- VersionAdded: '2.16'
1055
-
1056
- Rails/WhereNot:
1057
- Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.'
1058
- StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
1059
- Enabled: true
1060
- VersionAdded: '2.8'
1061
-
1062
- Rails/WhereNotWithMultipleConditions:
1063
- Description: 'Do not use `where.not(...)` with multiple conditions.'
1064
- Enabled: true
1065
- VersionAdded: '2.17'