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
Updating from 2.17.0 to 2.17.1 leads to an incorrect error and incorrect auto-fix.
CI error:
Offenses: blah.rb:44:31: C: [Correctable] Rails/Pluck: Prefer pluck(key) over map { |key| row[key] }. exporter << columns.map { |key| row[key] } ^^^^^^^^^^^^^^^^^^^^^^
Autofix result:
diff --git a/blah.rb b/blah.rb index 7347dfd3f9..855a2d63c7 100644 --- a/blah.rb +++ b/blah.rb @@ -40,8 +40,8 @@ module Backoffice Exporter.generate do |exporter| exporter << columns.map { |key| self.class.csv_columns[key] } - data.each do |row| - exporter << columns.map { |key| row[key] } + data.each do |_row| + exporter << columns.pluck(key) end end end
It seems like pluck is not applicable here at all since key is dynamic
pluck
key
rubocop auto-fixes code that fails to work
$ rubocop -V 1.37.1 (using Parser 3.1.2.1, rubocop-ast 1.23.0, running on ruby 2.7.2) [arm64-darwin21] - rubocop-graphql 0.15.1 - rubocop-rails 2.17.1 - rubocop-rake 0.6.0 - rubocop-rspec 2.13.2
The text was updated successfully, but these errors were encountered:
Ah, I suspect it is just a duplicate of #833 and a fix is already merged.
Sorry, something went wrong.
I tested it against main branch here, and it works as expected. We will wait for next release then and will not upgrade to the buggy x.1.
No branches or pull requests
Updating from 2.17.0 to 2.17.1 leads to an incorrect error and incorrect auto-fix.
CI error:
Autofix result:
Expected behavior
It seems like
pluck
is not applicable here at all sincekey
is dynamicActual behavior
rubocop auto-fixes code that fails to work
RuboCop version
The text was updated successfully, but these errors were encountered: