-
-
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
InfiniteCorrectionLoop when auto-correcting constant assignment with implicit array #3170
Comments
...Just passed through and discovered that 122 open issues have accumulated! Youch! |
just close 23 and we are back under 100 ;) On Mon, May 30, 2016 at 7:12 AM, Alex Dowad [email protected]
|
`Style/ConditionalAssignment` cop's autocorrection results in invalid syntax when it encounters assignment to unbracketed array. This commit modifies ConditionalAssignment cop's autocorrection so, it wraps array in brackets, if needed. This issue is very simillar to rubocop#3170, where `Style/MutableConstant` wasn't able to properly handle assignment to unbracketed array. Since both `MutableConstant` and `ConditionalAssignment` cops need to check whether array node is bracketed or not, new method `Rubocop::AST::ArrayNode#bracketed?` was introduced, to avoid duplication.
`Style/ConditionalAssignment` cop's autocorrection results in invalid syntax when it encounters assignment to unbracketed array. This commit modifies ConditionalAssignment cop's autocorrection so, it wraps array in brackets, if needed. This issue is very simillar to #3170, where `Style/MutableConstant` wasn't able to properly handle assignment to unbracketed array. Since both `MutableConstant` and `ConditionalAssignment` cops need to check whether array node is bracketed or not, new method `Rubocop::AST::ArrayNode#bracketed?` was introduced, to avoid duplication.
code
result
expected result
either do not correct or wrap in array and then add freeze
backtrace
version
0.40.0 (using Parser 2.3.1.0, running on ruby 2.1.8 x86_64-darwin14.0)
The text was updated successfully, but these errors were encountered: