Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix #1249] Disable Rails/UnusedIgnoredColumns by default #1252

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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