-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinity loop in Style/YodaCondition
autofix
#4412
Comments
Seems we didn't account for situations where both sides of an expression are some literals. :-) |
I can also reproduce it with this code:
|
There is a bug in this version, Rubocop 0.49.0, fixed by rubocop/rubocop#4412, which causes it to be broken when the condition has literals on both sides, as in sidekiq_web.ru. This disabled the cop, and we'll re-enable it when we update.
@bbatsov my bad, missed that case. Thanks guys for fixing that really quick. |
I'll likely do this after the weekend. I don't view the bug as critical as it affects a single cop which can easily be disabled. |
The following code produces YodaCondition errors in both directions: module StringRefinements
refine String do
def met?
self == 'Met'
end
end
end Here are the errors:
|
Steps to reproduce the problem
temp.rb
filerubocop -a temp.rb
. This cause exceptionInfinite loop detected in /path/test.rb
RuboCop version
The text was updated successfully, but these errors were encountered: