Skip to content

Commit

Permalink
[Fix rubocop#1249] Disable Rails/UnusedIgnoredColumns by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Mar 20, 2024
1 parent 2f893da commit f60be8d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/change_disable_rails_unused_ignored_columns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#1249](https://github.com/rubocop/rubocop-rails/issues/1249): Disable `Rails/UnusedIgnoredColumns` by default. ([@earlopain][])
3 changes: 2 additions & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1163,8 +1163,9 @@ Rails/UnknownEnv:

Rails/UnusedIgnoredColumns:
Description: 'Remove a column that does not exist from `ignored_columns`.'
Enabled: pending
Enabled: false
VersionAdded: '2.11'
VersionChanged: <<next>>
Include:
- app/models/**/*.rb

Expand Down
6 changes: 6 additions & 0 deletions lib/rubocop/cop/rails/unused_ignored_columns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ module Rails
# `ignored_columns` is necessary to drop a column from RDBMS, but you don't need it after the migration
# to drop the column. You avoid forgetting to remove `ignored_columns` by this cop.
#
# IMPORTANT: This cop can't be used to effectively check for unused columns because the development
# and production schema can be out of sync until the migration has been run on production. As such,
# this cop can cause `ignored_columns` to be removed even though the production schema still contains
# the column, which can lead to downtime when the migration is actually executed. Only enable this cop
# if you know your migrations will be run before any of your Rails applications boot with the modified code.
#
# @example
# # bad
# class User < ApplicationRecord
Expand Down

0 comments on commit f60be8d

Please sign in to comment.