Closed r7kamura closed 7 months ago
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.
I understand that autocorrection will not be supported in the future. Thank you for your quick response 👍
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.
https://github.com/rubocop/rubocop-performance/blob/3ba5d912e55e3b76672a6437511662fdadb64079/lib/rubocop/cop/performance/map_method_chain.rb#L8
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
?https://github.com/rubocop/rubocop-performance/blob/3ba5d912e55e3b76672a6437511662fdadb64079/lib/rubocop/cop/performance/map_method_chain.rb#L37-L41
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:I searched past Issues, comments, etc., but could not find any indication that this point has already been discussed.