Extra space characters are inserted when force-aligning equal signs, with if-unless-modifier disabled. Example input:
a = if b?
c.d = :e
end
The above code block showcases an assignment of an if-block, inside which there's another assignment.
Remains unchanged.
a = if b?
c.d = :e
end
Scroll to the right and see that it inserted an absurd amount of space characters in between:
a = if b?
c.d = :e
end
When given the following Ruby source,
a = if b?
c.d = :e
end
and the following .rubocop.yml,
Layout/ExtraSpacing:
ForceEqualSignAlignment: true
Style/IfUnlessModifier:
Enabled: false
run Rubocop with autofix.
$ rubocop -V
0.65.0 (using Parser 2.6.0.0, running on ruby 2.5.3 x86_64-darwin18)
Thanks for the report! The reproduction steps helped a lot. 馃檱
This is reproducible on latest master. The corruption happens because an infinite correction loop between Layout/ExtraSpacing and Layout/SpaceAroundOperators, and subsequently Layout/ExtraSpacing and Layout/IndentationWidth. The loop eventually terminates after a configured number of iterations, leaving the code far off to the right.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!
Stale bot, this problem still exists as of:
$ rubocop -V
0.72.0 (using Parser 2.6.3.0, running on ruby 2.6.3 x86_64-darwin18)
This should be fixed in #7211
@Drenmi this can be closed.