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

Please remove Rails/UnusedIgnoredColumns #1249

Closed
rafaelfranca opened this issue Mar 5, 2024 · 1 comment · Fixed by #1252
Closed

Please remove Rails/UnusedIgnoredColumns #1249

rafaelfranca opened this issue Mar 5, 2024 · 1 comment · Fixed by #1252

Comments

@rafaelfranca
Copy link
Contributor

Is your feature request related to a problem? Please describe.

This cop was added in #494.

While the idea is good in practice it doesn't work. You should only delete the ignore_column when that column is removed from the production database, but if you have that cop enabled, it is using the development information to tell you that the column was already removed, which at that point you have no way to know yet.

This will cause the same pull request that removes the column from the database, to also remove it from the ignore_column list, negating the reason why you need to use ignore_column, and potentially causing downtime for systems.

Describe the solution you'd like

I don't see how to implement this cop is a way that would actually work since you need to have access to the production database schema to tell if a column was already removed or not, so I think this cop should be deprecated and removed.

@rafaelfranca
Copy link
Contributor Author

@pocke did you find any case where you can safely know a column was already removed in production that made you implement this cop? As far as I know, checking schema.rb always will lead the cop to think the column was removed in the same pull request that just added ignore_column.

Earlopain added a commit to Earlopain/rubocop-rails that referenced this issue Mar 15, 2024
Earlopain added a commit to Earlopain/rubocop-rails that referenced this issue Mar 15, 2024
Earlopain added a commit to Earlopain/rubocop-rails that referenced this issue Mar 20, 2024
koic added a commit that referenced this issue Mar 31, 2024
[Fix #1249] Disable `Rails/UnusedIgnoredColumns` by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant