Yes, the community style guide was recently updated and RuboCop's default config reflects the style guide.
hm interesting.... in that case, the aforementioned link to the line in enabled yml might want to me be re-worded as well. thanks for the quick response!
@bbatsov:
Yes, the community style guide was recently updated and RuboCop's default config reflects the style guide.
The Rubocop documentation for Style/Alias references this section of the styleguide which still recommends using alias_method vs alias. Why/where has the recommendation changed?
@floehopper That part is a recommendation for runtime aliasing. The relevant section for write-time is above it, here. 馃檪
@Drenmi Thanks for pointing that out. However, I'm still confused. As far as I can see there is only one alias-related rule in Rubocop, i.e. Style/Alias, which doesn't allow me to discriminate between write-time or run-time aliasing. So I have to choose to either prefer alias or alias_method for all scenarios which means I can't completely satisfy the style guide. Or am I missing something?
..
Style/Alias.. doesn't allow me to discriminate between write-time or run-time aliasing. So I have to choose to either preferaliasoralias_methodfor _all_ scenarios which means I can't completely satisfy the style guide. Or am I missing something?
I had the same question. It looks like the cop is more sophisticated than that. It behaves differently in "dynamic" and "lexical" scopes. See alias_keyword_possible? below.
Most helpful comment
I had the same question. It looks like the cop is more sophisticated than that. It behaves differently in "dynamic" and "lexical" scopes. See
alias_keyword_possible?below.https://github.com/rubocop-hq/rubocop/blob/2f303909317f241336e52eedc340dc96bed71f39/lib/rubocop/cop/style/alias.rb#L34-L40