We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Rails/Presence should not replace hash access with method call
Rails/Presence cop replaces hash access with method call
if object.blank? some_hash['bar'] else object end
gets replaced with
object.presence || some_hash('bar')
While the object.presence is fine, some_hash is a hash, not a method, so the code breaks.
object.presence
some_hash
Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:
rubocop -V
bundle exec rubocop -V
0.74.0 (using Parser 2.6.4.1, running on ruby 2.6.3 x86_64-darwin18)
The text was updated successfully, but these errors were encountered:
Thanks for the feedback. PR #131 has been opened to solve this one.
Sorry, something went wrong.
#131 has been merged.
No branches or pull requests
Expected behavior
Rails/Presence should not replace hash access with method call
Actual behavior
Rails/Presence cop replaces hash access with method call
Steps to reproduce the problem
gets replaced with
While the
object.presence
is fine,some_hash
is a hash, not a method, so the code breaks.RuboCop version
Include the output of
rubocop -V
orbundle exec rubocop -V
if using Bundler. Here's an example:The text was updated successfully, but these errors were encountered: