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

Bug in Rails/DeprecatedActiveModelErrorsMethods #717

Closed
bquorning opened this issue Jun 17, 2022 · 0 comments · Fixed by #721
Closed

Bug in Rails/DeprecatedActiveModelErrorsMethods #717

bquorning opened this issue Jun 17, 2022 · 0 comments · Fixed by #721
Labels
bug Something isn't working

Comments

@bquorning
Copy link
Contributor

When running bundle exec rubocop --debug --only=Rails/DeprecatedActiveModelErrorsMethods -- test.rb against a file test.rb containing

result = "foo"
result.errors.keys

I get an error:

An error occurred while Rails/DeprecatedActiveModelErrorsMethods cop was inspecting /Users/bquorning/Code/rubocop/rubocop-rails/test.rb:2:0.
undefined method `method?' for s(:lvar, :result):RuboCop::AST::Node
Did you mean?  method
               methods
/Users/bquorning/Code/rubocop/rubocop-rails/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb:122:in `autocorrect'
/Users/bquorning/Code/rubocop/rubocop-rails/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb:112:in `block (2 levels) in on_send'
/Users/bquorning/.gem/ruby/2.7.6/bundler/gems/rubocop-a5de777eb80f/lib/rubocop/cop/base.rb:342:in `correct'
/Users/bquorning/.gem/ruby/2.7.6/bundler/gems/rubocop-a5de777eb80f/lib/rubocop/cop/base.rb:127:in `add_offense'
/Users/bquorning/Code/rubocop/rubocop-rails/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb:109:in `block in on_send'
/Users/bquorning/Code/rubocop/rubocop-rails/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb:58:in `any_manipulation?'
/Users/bquorning/Code/rubocop/rubocop-rails/lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb:108:in `on_send'
[...]

RuboCop version

$ ❯ bundle exec rubocop -V
1.30.0 (using Parser 3.1.2.0, rubocop-ast 1.18.0, running on ruby 2.7.6 x86_64-darwin20)
  - rubocop-performance 1.14.2
  - rubocop-rails 2.15.0
  - rubocop-rspec 2.11.1
@koic koic added the bug Something isn't working label Jun 17, 2022
koic added a commit to koic/rubocop-rails that referenced this issue Jun 17, 2022
koic added a commit to koic/rubocop-rails that referenced this issue Jun 17, 2022
…Methods`

Fixes rubocop#717.

This PR fixes an error for `Rails/DeprecatedActiveModelErrorsMethods`
when root receiver is a variable.
koic added a commit to koic/rubocop-rails that referenced this issue Jun 17, 2022
…Methods`

Fixes rubocop#717.

This PR fixes an error for `Rails/DeprecatedActiveModelErrorsMethods`
when root receiver is a variable.
@koic koic closed this as completed in #721 Jun 18, 2022
koic added a commit that referenced this issue Jun 18, 2022
…ctive_model_errors_methods

[Fix #717] Fix an error for `Rails/DeprecatedActiveModelErrorsMethods`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants