config/default.yml in rubocop-rails-2.10.1 vs config/default.yml in rubocop-rails-2.11.0
- old
+ new
@@ -81,10 +81,20 @@
`String#starts_with?`, `String#ends_with?`,
`Array#append`, `Array#prepend`.
Enabled: true
VersionAdded: '0.48'
+Rails/AddColumnIndex:
+ Description: >-
+ Rails migrations don't make use of a given `index` key, but also
+ doesn't given an error when it's used, so it makes it seem like an
+ index might be used.
+ Enabled: pending
+ VersionAdded: '2.11'
+ Include:
+ - db/migrate/*.rb
+
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.
@@ -191,20 +201,21 @@
Description: >-
Checks the correct usage of date aware methods,
such as Date.today, Date.current etc.
Enabled: true
VersionAdded: '0.30'
- VersionChanged: '0.33'
+ VersionChanged: '2.11'
# The value `strict` disallows usage of `Date.today`, `Date.current`,
# `Date#to_time` etc.
# The value `flexible` allows usage of `Date.current`, `Date.yesterday`, etc
# (but not `Date.today`) which are overridden by ActiveSupport to handle current
# time zone.
EnforcedStyle: flexible
SupportedStyles:
- strict
- flexible
+ AllowToTime: true
Rails/DefaultScope:
Description: 'Avoid use of `default_scope`.'
StyleGuide: 'https://rails.rubystyle.guide#avoid-default-scope'
Enabled: false
@@ -238,10 +249,16 @@
AllowedMethods:
- find_by_sql
AllowedReceivers:
- Gem::Specification
+Rails/EagerEvaluationLogMessage:
+ Description: 'Checks that blocks are used for interpolated strings passed to `Rails.logger.debug`.'
+ Reference: 'https://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance'
+ Enabled: pending
+ VersionAdded: '2.11'
+
Rails/EnumHash:
Description: 'Prefer hash syntax over array syntax when defining enums.'
StyleGuide: 'https://rails.rubystyle.guide#enums'
Enabled: true
VersionAdded: '2.3'
@@ -260,12 +277,14 @@
Enabled: true
VersionAdded: '0.52'
Rails/EnvironmentVariableAccess:
Description: 'Do not access `ENV` directly after initialization.'
- Enabled: pending
+ # TODO: Set to `pending` status in RuboCop Rails 2 series when migration doc will be written.
+ Enabled: false
VersionAdded: '2.10'
+ VersionChanged: '2.11'
Include:
- app/**/*.rb
- lib/**/*.rb
Exclude:
- lib/**/*.rake
@@ -284,10 +303,15 @@
- config/**/*.rb
- lib/**/*.rb
Exclude:
- lib/**/*.rake
+Rails/ExpandedDateRange:
+ Description: 'Checks for expanded date range.'
+ Enabled: pending
+ VersionAdded: '2.11'
+
Rails/FilePath:
Description: 'Use `Rails.root.join` for file path joining.'
Enabled: true
VersionAdded: '0.47'
VersionChanged: '2.4'
@@ -299,10 +323,12 @@
Rails/FindBy:
Description: 'Prefer find_by over where.first.'
StyleGuide: 'https://rails.rubystyle.guide#find_by'
Enabled: true
VersionAdded: '0.30'
+ VersionChanged: '2.11'
+ IgnoreWhereFirst: true
Include:
- app/models/**/*.rb
Rails/FindById:
Description: >-
@@ -360,15 +386,24 @@
Rails/HttpStatus:
Description: 'Enforces use of symbolic or numeric value to define HTTP status.'
Enabled: true
VersionAdded: '0.54'
+ VersionChanged: '2.11'
EnforcedStyle: symbolic
SupportedStyles:
- numeric
- symbolic
+Rails/I18nLocaleAssignment:
+ Description: 'Prefer the usage of `I18n.with_locale` instead of manually updating `I18n.locale` value.'
+ Enabled: 'pending'
+ VersionAdded: '2.11'
+ Include:
+ - spec/**/*.rb
+ - test/**/*.rb
+
Rails/IgnoredSkipActionFilterOption:
Description: 'Checks that `if` and `only` (or `except`) are not used together as options of `skip_*` action filter.'
Reference: 'https://api.rubyonrails.org/classes/AbstractController/Callbacks/ClassMethods.html#method-i-_normalize_callback_options'
Enabled: true
VersionAdded: '0.63'
@@ -781,9 +816,16 @@
VersionAdded: '0.51'
Environments:
- development
- test
- production
+
+Rails/UnusedIgnoredColumns:
+ Description: 'Remove a column that does not exist from `ignored_columns`.'
+ Enabled: pending
+ VersionAdded: '2.11'
+ Include:
+ - app/models/**/*.rb
Rails/Validation:
Description: 'Use validates :attribute, hash of validations.'
Enabled: true
VersionAdded: '0.9'