You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Autocorrect is complementary and should not be named arbitrarily. Also, it can be assumed that people's tastes (and situations) will likely differ, so there will still be some skepticism as to whether it can be replaced.
Is your feature request related to a problem? Please describe.
While using rubocop-performance, I encountered the following offense:
I see. So you want me to use
map { |x| x.value.to_s }
instead. If you go so far as to say that, wouldn't it be nice if you supported autocorrect?The comment states that autocorrection is not supported because appropriate block argument names cannot be determined.
rubocop-performance/lib/rubocop/cop/performance/map_method_chain.rb
Line 8 in 3ba5d91
Since the message says to use
x
, shouldn't it bex
?Or, you say that the good example code uses
item
, why not just useitem
?rubocop-performance/lib/rubocop/cop/performance/map_method_chain.rb
Lines 37 to 41 in 3ba5d91
I believe that it is more valuable to provide autocorrection than to provide perfectly considered argument names.
Describe the solution you'd like
How about supporting the autocorrection feature with an argument name of
item
?Describe alternatives you've considered
Alternatively, using numbered parameters
_1
or, in future Ruby,it
could be an option.Additional context
Performance/MapMethodChain
cop was added at the following pull request:Performance/MapMethodChain
cop #364I searched past Issues, comments, etc., but could not find any indication that this point has already been discussed.
The text was updated successfully, but these errors were encountered: