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
I had this line of code:
label_value = facet_config.pivot.map(&:to_sym).map { |k| item_fq[k] }
and when I ran rubocop it complained:
Inspecting 1 file C Offenses: app/presenters/blacklight/facet_item_pivot_presenter.rb:27:56: C: [Corrected] Rails/Pluck: Prefer pluck(k) over map { |k| item_fq[k] }. label_value = facet_config.pivot.map(&:to_sym).map { |k| item_fq[k] } ^^^^^^^^^^^^^^^^^^^^^^
and it was autocorrected to
label_value = facet_config.pivot.map(&:to_sym).pluck(k)
This new code is broken as k is not defined.
k
Rubocop version 1.37.1 rubocop-rails version 2.17.1
The text was updated successfully, but these errors were encountered:
Here's another example of a bad autocorrect it did:
items.map {|_facet, opts| opts[:group] }
items.pluck(:group)
Now consider that items is:
items = { a: { group: 1}}
it results in:
no implicit conversion of Symbol into Integer (TypeError)
Sorry, something went wrong.
This is same as #833 -- the fix is on master 🙌
No branches or pull requests
I had this line of code:
and when I ran rubocop it complained:
and it was autocorrected to
This new code is broken as
k
is not defined.Rubocop version 1.37.1
rubocop-rails version 2.17.1
The text was updated successfully, but these errors were encountered: