-
-
Notifications
You must be signed in to change notification settings - Fork 266
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
Config to ignore old migrations for Rails/ThreeStateBooleanColumn
#985
base: master
Are you sure you want to change the base?
Config to ignore old migrations for Rails/ThreeStateBooleanColumn
#985
Conversation
StartAfter
config for ThreeStateBooleanColumn
Rails/ThreeStateBooleanColumn
061dd1e
to
a7cedaf
Compare
@fatkodima I'm a little confused by the discussion in those pull requests. Is the intent for offenses in older migrations to never be fixed, not even by using a later migration to change the schema? |
These cops are checking migration files when doing their job, so there is no point to do this for older migrations. It would be nice if |
Thanks, @fatkodima, that clears things up. |
Are there any specific blockers or issues preventing them from being merged? Since |
If this PR will be merged first, I will with no problems update with these changes those other two. |
IMHO, |
This may be a bit off topic, but in projects where inspecting old migration files seems pointless, I usually disable the inspections as follows: # .rubocop.yml
inherit_mode:
merge:
- Exclude
AllCops:
Exclude:
- "db/migrate/2020*.rb"
- "db/migrate/2021*.rb"
- "db/migrate/202201*.rb"
- "db/migrate/202202*.rb"
- "db/migrate/202203*.rb"
- "db/migrate/202204*.rb"
- "db/migrate/202205*.rb"
- "db/migrate/202206*.rb"
- "db/migrate/202207*.rb"
- "db/migrate/202208*.rb"
- "db/migrate/202209*.rb" (In this example, the project here has existed since 2020 and I added this setting on 2022-10-01) |
@koic Can you please reconsider this? I am currently in a need for such an option. |
Hello, first-time contributor here 👋
I noticed that the
Rails/ThreeStateBooleanColumn
cop reports offenses in old migrations. And as mentioned by @mvz in #982, fixing these offenses in existing migrations is not practical. Currently, the only way to address this issue is to exclude all offending migrations in the config file, which can add unnecessary noise.To improve this situation, I propose adding a configuration option for this cop that ignores offenses occurring before a specified migration version. This approach is inspired by the strong_migrations gem. The configuration would look like this:
I'm open to suggestions for a better name for this configuration option. For now, I've used the name from strong_migrations.
Please let me know if you have any feedback or suggestions for improvement. I'm looking forward to your input and would be happy to make any necessary changes.
Thank you!
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.