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
[Fix #8006] Fix infinite loop for Style/IfUnlessModifier
#8026
Conversation
2ddb69c
to
7f6ebcf
Compare
The following line will still produce an infinite loop with this commit pulled into master: puts " #{' ' if true}"
|
@joe-p Now it should not. |
Style/IfUnlessModifier
Style/IfUnlessModifier
RUBY | ||
end | ||
|
||
it 'does not result in infinite loop with any other statement' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An infinite loop error is caused by a combination of cops. Con you add a reproduction test for infinite loop error to spec/rubocop/cli/cli_autocorrect_spec.rb? E.g.: https://github.com/rubocop-hq/rubocop/pull/7901/files#diff-0e7dbdd6e99e0defc2bab2cb544b42da
And I think the description of this test better to be updated to not register an offense.
I'd love to see this merged. Is there anything I could help with? |
I also opened #8283 (but didn't know about this) As I wrote there, I feel it is imperative that the code that builds the replacement string should be used for the calculation length. The same bugs exist for The refactoring I made yesterday should help a bit. |
I agree with @marcandre's approach. Closing this for now. |
Closes #8006
Closes #8025
Closes #7969
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.