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 #144] false positive for Rails/ReversibleMigration #145

Merged
merged 1 commit into from
Nov 11, 2019

Conversation

DNA
Copy link
Contributor

@DNA DNA commented Oct 31, 2019

Fixes #144

I've made this commit based on change_column_default logic, so I'm not sure if the pattern is the best one.

I've also thought about grouping the checks from change_column_default, change_table_comment and change_column_comment into a more generic check that looks if a method has a hash with :from/:to keys, but I'm not sure if it's the best approach. Let me know which way is better :)


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@koic
Copy link
Member

koic commented Nov 1, 2019

Below is a similar PR under review.
https://github.com/rubocop-hq/rubocop-rails/pull/136/files#r341516733

I think it needs to be checked that :from and :to options are included.

change_table_comment is only irreversible when passing a string as
the comment. If we pass a hash with `:from` and `:to` keys, it
works as a reversible migration

Fixes rubocop#144
@DNA
Copy link
Contributor Author

DNA commented Nov 4, 2019

@koic I've updated the code based on PR #136, let me know what you think :)

CHANGELOG.md Show resolved Hide resolved
@koic koic merged commit f823ef3 into rubocop:master Nov 11, 2019
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 this pull request may close these issues.

Rails/ReversibleMigration - False positive with change_table_comment
2 participants