Don't you think 'Extract Method' could be simply simpler?
- http://youtrack.jetbrains.net/issue/RUBY-6309
- http://youtrack.jetbrains.net/issue/RUBY-6367
After every single Extract Method I execute, I need to perform manually 2 additional operations (and I shouldn't)
- remove the unnecessary "return value" in the extracted method
- move the extracted method AFTER the method it was extracted from
Example : you want to transform this code
def project t1 = "task " + '1' <-- Extract Method puts t1 t2 = "task " + '2' <-- Extract Methods puts t2 end
into this code (after 2 additional Inline)
def project puts task_1() puts task_2() enddef task_1
t1 = "task " + '1'
end
def task_2
t2 = "task " + '2'
end
but Rubymine generates instead :
def task_1 t1 = "task " + '1' return t1 # this is noise end def task_2 t2 = "task " + '2' return t2 # this is more noise end def project # should come before its 2 "children" methods puts task_1() puts task_2() end
What do you think?
请先登录再写评论。
I think this refactoring should be improved. I create an issue: http://youtrack.jetbrains.net/issue/RUBY-5918 also. I think that issue 6309 is connected with 5918.
Hy guys,
Thanks for your feedback on the Extract Method refactoring, all the issues reported are quite reasonable and are likely to be implemented before the 2.5 final version.
Best regards,
Oleg
Guys, this is still as valid and reasonable as it was 13 months ago.
This is the kind of cruft you should hunt down before adding new big-ticket features.
Note : #6367 has been half-implemented.
I've created a new ticket for
"Extract method" generates useless code
http://youtrack.jetbrains.net/issue/RUBY-9181
Hello Alain,
Finally all the requested functionality is fixed/implemented. Fixes will be available in RubyMine 4.0 EAP builds and possible in next 3.2.x minor update.
Regards,
Oleg
Thanks a lot.