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
I presume there's another cop involved in the final auto-correction; by itself it corrects to val = defined? inc.name ? inc.name : inc, which is incorrect.
…correction if it is not parenthesized.
Without parens, `defined?` will apply to the entire ternary instead of its previous argument, which makes this autocorrection incorrect.
…ion if it is not parenthesized.
Without parens, `defined?` will apply to the entire ternary instead of its previous argument, which makes this autocorrection incorrect.
I have a project with this line in it:
rubocop -a
autocorrects this to:Which is clearly not the same thing because one returns a Boolean and another returns the
name
.The correct way to fix this, IMO, to make Rubocop happy:
I thought this issue was common enough that I would've been able to find someone who had it before, and I did find:
#3505
#3450
But it seems like this problem has persisted...
Thoughts?
RuboCop version
The text was updated successfully, but these errors were encountered: