miq_bot
miq_bot copied to clipboard
Find cop for preferred methods
For example prefer .to_sym over .intern.
The existing preferred methods cop only works on collections.
@Fryguy do you have a source for the preferred methods you were thinking of? I can't find anything on the above example.
mostly the guide and what in my head like .to_sym over .intern. I was just hoping there was an existing cop that we can configure
i can't find one =) cops tend to be very specific, as with collection methods, deprecated hash methods, class methods, etc...
WDYT about creating our own?
This has been partly resolved in https://github.com/bbatsov/rubocop/pull/2204. Like the collection methods, this new cop specifies preferred methods on a specific class/module - in this case String
for intern
vs to_sym
. So I guess in order to continue to expand upon preferred methods we could either continue in this way, or maybe there could be a case for generalizing these cops into a PreferredMethods
cop. The latter might not be feasible since the CollectionMethods
cop has some special logic for trying to tell if the method in question really is coming from Enumerable
... I'll give this some thought on the best way to proceed.
This issue has been automatically marked as stale because it has not been updated for at least 3 months.
If you can still reproduce this issue on the current release or on master
, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions! More information about the ManageIQ triage process can be found in the traige process documentation.