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
Style/NestedTernaryOperator auto-correction produces syntactically invalid code. It seems to occur when the nested ternary is enclosed within parentheses. Though it could be argued that in the example outlined later, the "nested ternary" isn't really even a nested ternary but a completely separate statement.
Expected behavior
I would expect it to produce valid code or not try to auto-correct at all.
…aryOperator`
Fixesrubocop#8821
This PR fixes an incorrect autocorrect for `Style/NestedTernaryOperator` when
using a nested ternary operator expression with no parentheses on the outside.
…ator` (#8832)
Fixes#8821
This PR fixes an incorrect autocorrect for `Style/NestedTernaryOperator` when
using a nested ternary operator expression with no parentheses on the outside.
Co-authored-by: Bozhidar Batsov <bozhidar@batsov.com>
Style/NestedTernaryOperator auto-correction produces syntactically invalid code. It seems to occur when the nested ternary is enclosed within parentheses. Though it could be argued that in the example outlined later, the "nested ternary" isn't really even a nested ternary but a completely separate statement.
Expected behavior
I would expect it to produce valid code or not try to auto-correct at all.
Actual behavior
Style/NestedTernaryOperator auto-correction produces syntactically invalid code.
Steps to reproduce the problem
Run it on any file that contains structure similar to:
You can then see that it produces =>
which is obviously syntactically invalid, since it's missing the closing parenthesis
)
.RuboCop version
The text was updated successfully, but these errors were encountered: