config/default.yml in rubocop-rails-2.3.2 vs config/default.yml in rubocop-rails-2.4.0
- old
+ new
@@ -47,15 +47,25 @@
`String#starts_with?`, `String#ends_with?`,
`Array#append`, `Array#prepend`.
Enabled: true
VersionAdded: '0.48'
+Rails/ApplicationController:
+ Description: 'Check that controllers subclass ApplicationController.'
+ Enabled: true
+ VersionAdded: '2.4'
+
Rails/ApplicationJob:
Description: 'Check that jobs subclass ApplicationJob.'
Enabled: true
VersionAdded: '0.49'
+Rails/ApplicationMailer:
+ Description: 'Check that mailers subclass ApplicationMailer.'
+ Enabled: true
+ VersionAdded: '2.4'
+
Rails/ApplicationRecord:
Description: 'Check that models subclass ApplicationRecord.'
Enabled: true
VersionAdded: '0.49'
@@ -181,12 +191,12 @@
Rails/FilePath:
Description: 'Use `Rails.root.join` for file path joining.'
Enabled: true
VersionAdded: '0.47'
- VersionChanged: '0.57'
- EnforcedStyle: arguments
+ VersionChanged: '2.4'
+ EnforcedStyle: slashes
SupportedStyles:
- slashes
- arguments
Rails/FindBy:
@@ -321,10 +331,19 @@
# Convert usages of `!blank?` to `present?`
NotBlank: true
# Convert usages of `unless blank?` to `if present?`
UnlessBlank: true
+Rails/RakeEnvironment:
+ Description: 'Set `:environment` task as a dependency to all rake task.'
+ Enabled: true
+ Safe: false
+ VersionAdded: '2.4'
+ Include:
+ - '**/Rakefile'
+ - '**/*.rake'
+
Rails/ReadWriteAttribute:
Description: >-
Checks for read_attribute(:attr) and
write_attribute(:attr, val).
StyleGuide: 'https://rails.rubystyle.guide#read-attribute'
@@ -392,9 +411,21 @@
# This will convert usages of `try` to use safe navigation as well as `try!`.
# `try` and `try!` work slightly differently. `try!` and safe navigation will
# both raise a `NoMethodError` if the receiver of the method call does not
# implement the intended method. `try` will not raise an exception for this.
ConvertTry: false
+
+Rails/SafeNavigationWithBlank:
+ Description: 'Avoid `foo&.blank?` in conditionals.'
+ Enabled: true
+ VersionAdded: '2.4'
+ # While the safe navigation operator is generally a good idea, when
+ # checking `foo&.blank?` in a conditional, `foo` being `nil` will actually
+ # do the opposite of what the author intends.
+ #
+ # foo&.blank? #=> nil
+ # foo.blank? #=> true
+ SafeAutoCorrect: false
Rails/SaveBang:
Description: 'Identifies possible cases where Active Record save! or related should be used.'
StyleGuide: 'https://rails.rubystyle.guide#save-bang'
Enabled: false