config/default.yml in rubocop-rails-2.7.1 vs config/default.yml in rubocop-rails-2.8.0
- old
+ new
@@ -60,10 +60,18 @@
`String#starts_with?`, `String#ends_with?`,
`Array#append`, `Array#prepend`.
Enabled: true
VersionAdded: '0.48'
+Rails/AfterCommitOverride:
+ Description: >-
+ This cop enforces that there is only one call to `after_commit`
+ (and its aliases - `after_create_commit`, `after_update_commit`,
+ and `after_destroy_commit`) with the same callback name per model.
+ Enabled: 'pending'
+ VersionAdded: '2.8'
+
Rails/ApplicationController:
Description: 'Check that controllers subclass ApplicationController.'
Enabled: true
SafeAutoCorrect: false
VersionAdded: '2.4'
@@ -311,18 +319,20 @@
VersionAdded: '0.63'
Include:
- app/controllers/**/*.rb
Rails/IndexBy:
- Description: 'Prefer `index_by` over `each_with_object` or `map`.'
+ Description: 'Prefer `index_by` over `each_with_object`, `to_h`, or `map`.'
Enabled: true
VersionAdded: '2.5'
+ VersionChanged: '2.8'
Rails/IndexWith:
- Description: 'Prefer `index_with` over `each_with_object` or `map`.'
+ Description: 'Prefer `index_with` over `each_with_object`, `to_h`, or `map`.'
Enabled: true
VersionAdded: '2.5'
+ VersionChanged: '2.8'
Rails/Inquiry:
Description: "Prefer Ruby's comparison operators over Active Support's `Array#inquiry` and `String#inquiry`."
StyleGuide: 'https://rails.rubystyle.guide/#inquiry'
Enabled: 'pending'
@@ -355,10 +365,11 @@
Rails/MailerName:
Description: 'Mailer should end with `Mailer` suffix.'
StyleGuide: 'https://rails.rubystyle.guide/#mailer-name'
Enabled: 'pending'
+ SafeAutoCorrect: false
VersionAdded: '2.7'
Include:
- app/mailers/**/*.rb
Rails/MatchRoute:
@@ -383,10 +394,18 @@
Enabled: true
VersionAdded: '0.43'
Include:
- db/migrate/*.rb
+Rails/OrderById:
+ Description: >-
+ Do not use the `id` column for ordering.
+ Use a timestamp column to order chronologically.
+ StyleGuide: 'https://rails.rubystyle.guide/#order-by-id'
+ Enabled: false
+ VersionAdded: '2.8'
+
Rails/Output:
Description: 'Checks for calls to puts, print, etc.'
Enabled: true
VersionAdded: '0.15'
VersionChanged: '0.19'
@@ -424,10 +443,15 @@
Rails/PluckInWhere:
Description: 'Use `select` instead of `pluck` in `where` query methods.'
Enabled: 'pending'
Safe: false
VersionAdded: '2.7'
+ VersionChanged: '2.8'
+ EnforcedStyle: conservative
+ SupportedStyles:
+ - conservative
+ - aggressive
Rails/PluralizationGrammar:
Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
Enabled: true
VersionAdded: '0.35'
@@ -622,10 +646,16 @@
- update_counters
- upsert
- upsert_all
AllowedMethods: []
+Rails/SquishedSQLHeredocs:
+ Description: 'Checks SQL heredocs to use `.squish`.'
+ StyleGuide: 'https://rails.rubystyle.guide/#squished-heredocs'
+ Enabled: 'pending'
+ VersionAdded: '2.8'
+
Rails/TimeZone:
Description: 'Checks the correct usage of time zone aware methods.'
StyleGuide: 'https://rails.rubystyle.guide#time'
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
Enabled: true
@@ -641,15 +671,16 @@
Rails/UniqBeforePluck:
Description: 'Prefer the use of uniq or distinct before pluck.'
Enabled: true
VersionAdded: '0.40'
- VersionChanged: '2.6'
+ VersionChanged: '2.8'
EnforcedStyle: conservative
SupportedStyles:
- conservative
- aggressive
+ SafeAutoCorrect: false
AutoCorrect: false
Rails/UniqueValidationWithoutIndex:
Description: 'Uniqueness validation should be with a unique index.'
Enabled: true
@@ -675,10 +706,21 @@
- app/models/**/*.rb
Rails/WhereExists:
Description: 'Prefer `exists?(...)` over `where(...).exists?`.'
Enabled: 'pending'
+ EnforcedStyle: exists
+ SupportedStyles:
+ - exists
+ - where
VersionAdded: '2.7'
+ VersionChanged: '2.8'
+
+Rails/WhereNot:
+ Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.'
+ StyleGuide: 'https://rails.rubystyle.guide/#where-not'
+ Enabled: 'pending'
+ VersionAdded: '2.8'
# Accept `redirect_to(...) and return` and similar cases.
Style/AndOr:
EnforcedStyle: conditionals