Skip to content

Commit

Permalink
[Fix #1249] Disable Rails/UnusedIgnoredColumns by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Mar 15, 2024
1 parent 83c0968 commit 4ad737c
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 @@ -1162,8 +1162,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 effectivly check for unused columns because the development

Check failure on line 10 in lib/rubocop/cop/rails/unused_ignored_columns.rb

View workflow job for this annotation

GitHub Actions / Check spelling of all files with codespell

effectivly ==> effectively
# 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 4ad737c

Please sign in to comment.