-
-
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
inifinite loop in Ternary Parentheses #3347
Comments
The problem with conditional styles is which one should take precedence. I.e. you prefer to have parentheses on all ternaries except where the condition is a method call, but it is also likely that someone else might want to omit parentheses around all method calls, except when used as a condition in a ternary. I'll sit down and think about the interactions of these two cops, and see if there are any configuration options that could make sense here. |
one way is to tell the user of the conflict and to explictly remove one of the conflicting rules |
I think we have instances where a cop allows a certain construct if it sees (by checking another cop's configuration) that a manual or automatic correction to comply with the cop's own rule would be reversed by the other cop. So in this case, |
@jonas054: Thanks! I guess ideally, down the line, cops shouldn't know about each other, but should be fine for now. 😀 |
…` cop When this cop was configured to enforce parentheses and the `RedundantParentheses` cop was enabled, it would cause an infinite loop as they compete to add and remove the parens respectively. This change fixes that.
…` cop (rubocop#3354) When this cop was configured to enforce parentheses and the `RedundantParentheses` cop was enabled, it would cause an infinite loop as they compete to add and remove the parens respectively. This change fixes that.
I've set
but then it get stuck in a loop due to some other rule:
Not sure what rule causes to remove the parentheses but I think that
res = var == "nope" ? true : false
should be
res = (var == "nope") ? true : false
The text was updated successfully, but these errors were encountered: