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

Add missing deprecated errors methods #742

Conversation

BrianHawley
Copy link
Contributor

Fixes for Rails/DeprecatedActiveModelErrorsMethods:

  • The values, to_h, and to_xml methods are deprecated too.

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • 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.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.

@BrianHawley
Copy link
Contributor Author

BrianHawley commented Jul 6, 2022

There's no check for errors.each do |key, value| because I don't know how to specify that. The each method is only deprecated if you pass a block with two parameters to it; the new each method takes a block with one parameter. This isn't easily autocorrectable, but the manual change could be given as an example in docs.

@BrianHawley
Copy link
Contributor Author

@koic as requested.

@BrianHawley BrianHawley force-pushed the fix_rails_deprecated_active_model_errors_methods_20220706_3 branch 2 times, most recently from 64d5964 to fbca49e Compare July 8, 2022 16:43
@BrianHawley
Copy link
Contributor Author

@koic rebased.

@koic
Copy link
Member

koic commented Jul 10, 2022

There's no check for errors.each do |key, value| because I don't know how to specify that. The each method is only deprecated if you pass a block with two parameters to it; the new each method takes a block with one parameter. This isn't easily autocorrectable, but the manual change could be given as an example in docs.

Yep. I think it can be solved separately from this PR. Can you rebase with the latest master branch?

Fixes for Rails/DeprecatedActiveModelErrorsMethods:
- The `values`, `to_h`, and `to_xml` methods are deprecated too.
@BrianHawley BrianHawley force-pushed the fix_rails_deprecated_active_model_errors_methods_20220706_3 branch from fbca49e to 4d11b85 Compare July 11, 2022 15:38
@BrianHawley
Copy link
Contributor Author

@koic rebased.

@koic koic merged commit 4032c62 into rubocop:master Jul 13, 2022
@koic
Copy link
Member

koic commented Jul 13, 2022

Thanks!

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.

None yet

2 participants