Skip to content

Commit 246d4f2

Browse files
committed
Raise severity of some cops to warning
The cops below belong to linting, not style preference, so make set the severity to warning. The following emulates warnings for deprecated APIs: - Rails/DeprecatedActiveModelErrorsMethods - Rails/TopLevelHashWithIndifferentAccess - Rails/WhereNotWithMultipleConditions The following suggests incorrect usage of APIs: - Rails/ActiveRecordOverride - Rails/DuplicateAssociation - Rails/DuplicateScope
1 parent b930670 commit 246d4f2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#896](https://github.com/rubocop/rubocop-rails/pull/896): Raise severity of `Rails/ActiveRecordOverride`, `Rails/DeprecatedActiveModelErrorsMethods`, `Rails/DuplicateAssociation`, `Rails/DuplicateScope`, `Rails/TopLevelHashWithIndifferentAccess`, and `Rails/WhereNotWithMultipleConditions` cops to warning. ([@koic][])

config/default.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ Rails/ActiveRecordOverride:
135135
Check for overriding Active Record methods instead of using
136136
callbacks.
137137
Enabled: true
138+
Severity: warning
138139
VersionAdded: '0.67'
140+
VersionChanged: '<<next>>'
139141
Include:
140142
- app/models/**/*.rb
141143

@@ -330,9 +332,10 @@ Rails/DelegateAllowBlank:
330332
Rails/DeprecatedActiveModelErrorsMethods:
331333
Description: 'Avoid manipulating ActiveModel errors hash directly.'
332334
Enabled: pending
335+
Severity: warning
333336
Safe: false
334337
VersionAdded: '2.14'
335-
VersionChanged: '2.15'
338+
VersionChanged: '<<next>>'
336339

337340
Rails/DotSeparatedKeys:
338341
Description: 'Enforces the use of dot-separated keys instead of `:scope` options in `I18n` translation methods.'
@@ -343,12 +346,16 @@ Rails/DotSeparatedKeys:
343346
Rails/DuplicateAssociation:
344347
Description: "Don't repeat associations in a model."
345348
Enabled: pending
349+
Severity: warning
346350
VersionAdded: '2.14'
351+
VersionChanged: '<<next>>'
347352

348353
Rails/DuplicateScope:
349354
Description: 'Multiple scopes share this same where clause.'
350355
Enabled: pending
356+
Severity: warning
351357
VersionAdded: '2.14'
358+
VersionChanged: '<<next>>'
352359

353360
Rails/DurationArithmetic:
354361
Description: 'Do not use duration as arithmetic operand with `Time.current`.'
@@ -1038,7 +1045,9 @@ Rails/TopLevelHashWithIndifferentAccess:
10381045
Description: 'Identifies top-level `HashWithIndifferentAccess`.'
10391046
Reference: 'https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#top-level-hashwithindifferentaccess-is-soft-deprecated'
10401047
Enabled: pending
1048+
Severity: warning
10411049
VersionAdded: '2.16'
1050+
VersionChanged: '<<next>>'
10421051

10431052
Rails/TransactionExitStatement:
10441053
Description: 'Avoid the usage of `return`, `break` and `throw` in transaction blocks.'
@@ -1066,7 +1075,9 @@ Rails/UniqueValidationWithoutIndex:
10661075
Rails/UnknownEnv:
10671076
Description: 'Use correct environment name.'
10681077
Enabled: true
1078+
Severity: warning
10691079
VersionAdded: '0.51'
1080+
VersionChanged: '<<next>>'
10701081
Environments:
10711082
- development
10721083
- test
@@ -1121,7 +1132,9 @@ Rails/WhereNot:
11211132
Rails/WhereNotWithMultipleConditions:
11221133
Description: 'Do not use `where.not(...)` with multiple conditions.'
11231134
Enabled: 'pending'
1135+
Severity: warning
11241136
VersionAdded: '2.17'
1137+
VersionChanged: '<<next>>'
11251138

11261139
# Accept `redirect_to(...) and return` and similar cases.
11271140
Style/AndOr:

0 commit comments

Comments
 (0)