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
This code (and any like this, using Array#to_h or Enumerable#to_h) is a false positive now:
Array#to_h
Enumerable#to_h
%i[a b c].zip([1, 2, 3]).to_h { |name, val| [name, val**2] }
↓
C: Style/HashTransformValues: Prefer transform_values over to_h {...}. %i[a b c].zip([1, 2, 3]).to_h { |name, val| [name, val**2] } ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(After #8517 probably)
The text was updated successfully, but these errors were encountered:
cc/ @eugeneius
Sorry, something went wrong.
This was already a problem for code using map { ... }.to_h before #8517:
map { ... }.to_h
$ rubocop _0.89.0_ --only Style/HashTransformValues --stdin foo.rb <<< "%i[a b c].zip([1, 2, 3]).map { |name, val| [name, val**2] }.to_h" Inspecting 1 file C Offenses: foo.rb:1:1: C: Style/HashTransformValues: Prefer transform_values over map {...}.to_h. %i[a b c].zip([1, 2, 3]).map { |name, val| [name, val**2] }.to_h ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected
Anyway, I opened #8648 with a fix.
f641f6e
Merge pull request #8648 from eugeneius/hash_transformation_false_pos…
67dedb8
…itives [Fix #8630] Fix some hash transformation false positives
No branches or pull requests
This code (and any like this, using
Array#to_h
orEnumerable#to_h
) is a false positive now:↓
(After #8517 probably)
The text was updated successfully, but these errors were encountered: