config/default.yml in rubocop-rails-2.13.2 vs config/default.yml in rubocop-rails-2.14.0
- old
+ new
@@ -5,11 +5,13 @@
- Exclude
AllCops:
Exclude:
- bin/*
- - db/schema.rb
+ # Exclude db/schema.rb and db/[CONFIGURATION_NAMESPACE]_schema.rb by default.
+ # See: https://guides.rubyonrails.org/active_record_multiple_databases.html#setting-up-your-application
+ - db/*schema.rb
# What version of Rails is the inspected code using? If a value is specified
# for TargetRailsVersion then it is used. Acceptable values are specified
# as a float (i.e. 5.1); the patch version of Rails should not be included.
# If TargetRailsVersion is not set, RuboCop will parse the Gemfile.lock or
# gems.locked file to find the version of Rails that has been bound to the
@@ -36,10 +38,20 @@
- weeks
- fortnight
- fortnights
- in_milliseconds
+Rails/ActionControllerTestCase:
+ Description: 'Use `ActionDispatch::IntegrationTest` instead of `ActionController::TestCase`.'
+ StyleGuide: 'https://rails.rubystyle.guide/#integration-testing'
+ Reference: 'https://api.rubyonrails.org/classes/ActionController/TestCase.html'
+ Enabled: 'pending'
+ SafeAutocorrect: false
+ VersionAdded: '2.14'
+ Include:
+ - '**/test/**/*.rb'
+
Rails/ActionFilter:
Description: 'Enforces consistent use of action filter methods.'
Enabled: true
VersionAdded: '0.19'
EnforcedStyle: action
@@ -193,13 +205,16 @@
- 'https://github.com/rails/rails/issues/25195'
- 'https://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag'
Enabled: true
VersionAdded: '2.6'
VersionChanged: '2.12'
- # This `Exclude` config prevents false positives for `tag` calls to `has_one: tag`. No helpers are used in normal models.
+ # This `Exclude` config prevents false positives for `tag` calls to `has_one: tag` and Puma configuration:
+ # https://puma.io/puma/Puma/DSL.html#tag-instance_method
+ # No helpers are used in normal models and configs.
Exclude:
- app/models/**/*.rb
+ - config/**/*.rb
Rails/CreateTableWithTimestamps:
Description: >-
Checks the migration for which timestamps are not included
when creating a new table.
@@ -249,10 +264,26 @@
Rails/DelegateAllowBlank:
Description: 'Do not use allow_blank as an option to delegate.'
Enabled: true
VersionAdded: '0.44'
+Rails/DeprecatedActiveModelErrorsMethods:
+ Description: 'Avoid manipulating ActiveModel errors hash directly.'
+ Enabled: pending
+ Safe: false
+ VersionAdded: '2.14'
+
+Rails/DuplicateAssociation:
+ Description: "Don't repeat associations in a model."
+ Enabled: pending
+ VersionAdded: '2.14'
+
+Rails/DuplicateScope:
+ Description: 'Multiple scopes share this same where clause.'
+ Enabled: pending
+ VersionAdded: '2.14'
+
Rails/DurationArithmetic:
Description: 'Do not use duration as arithmetic operand with `Time.current`.'
StyleGuide: 'https://rails.rubystyle.guide#duration-arithmetic'
Enabled: pending
VersionAdded: '2.13'
@@ -413,18 +444,33 @@
EnforcedStyle: symbolic
SupportedStyles:
- numeric
- symbolic
+Rails/I18nLazyLookup:
+ Description: 'Checks for places where I18n "lazy" lookup can be used.'
+ StyleGuide: 'https://rails.rubystyle.guide/#lazy-lookup'
+ Reference: 'https://guides.rubyonrails.org/i18n.html#lazy-lookup'
+ Enabled: pending
+ VersionAdded: '2.14'
+ Include:
+ - 'controllers/**/*'
+
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/I18nLocaleTexts:
+ Description: 'Enforces use of I18n and locale files instead of locale specific strings.'
+ StyleGuide: 'https://rails.rubystyle.guide/#locale-texts'
+ Enabled: pending
+ VersionAdded: '2.14'
+
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'
@@ -493,10 +539,17 @@
VersionAdded: '2.7'
Include:
- config/routes.rb
- config/routes/**/*.rb
+Rails/MigrationClassName:
+ Description: 'The class name of the migration should match its file name.'
+ Enabled: pending
+ VersionAdded: '2.14'
+ Include:
+ - db/migrate/*.rb
+
Rails/NegateInclude:
Description: 'Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`.'
StyleGuide: 'https://rails.rubystyle.guide#exclude'
Enabled: 'pending'
Safe: false
@@ -815,10 +868,19 @@
VersionChanged: '2.9'
# Some SQL syntax (e.g. PostgreSQL comments and functions) requires newlines
# to be preserved in order to work, thus auto-correction is not safe.
SafeAutoCorrect: false
+Rails/TableNameAssignment:
+ Description: >-
+ Do not use `self.table_name =`. Use Inflections or `table_name_prefix` instead.
+ StyleGuide: 'https://rails.rubystyle.guide/#keep-ar-defaults'
+ Enabled: false
+ VersionAdded: '2.14'
+ Include:
+ - app/models/**/*.rb
+
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
@@ -840,9 +902,14 @@
Enabled: 'pending'
VersionAdded: '2.10'
Include:
- spec/**/*.rb
- test/**/*.rb
+
+Rails/TransactionExitStatement:
+ Description: 'Avoid the usage of `return`, `break` and `throw` in transaction blocks.'
+ Enabled: pending
+ VersionAdded: '2.14'
Rails/UniqBeforePluck:
Description: 'Prefer the use of uniq or distinct before pluck.'
Enabled: true
VersionAdded: '0.40'