Layout/ArgumentAlignment
and Layout/FirstHashElementIndentation
cops are incompatible
#9811
Labels
Layout/ArgumentAlignment
and Layout/FirstHashElementIndentation
cops are incompatible
#9811
After upgrading
rubocop
from version1.14.0
to1.15.0
, I started seeing new, auto-correctable offenses. But when trying to auto-correct, two of my configurations collide in such a way as to prevent auto-correction because of an infinite loop of back-and-forth corrections. I've tried to build a simple example to demonstrate the issue below. Thank you! 💛Expected behavior
It seems to me that the
Layout/ArgumentAlignment
cop is behaving unexpectedly when:with_fixed_indentation
To make matters more interesting, the
Layout/FirstHashElementIndentation
cop will try to correct theLayout/ArgumentAlignment
cop's bad behavior, resulting in an infinite loop.Given the following Rubocop configuration:
and the following Ruby:
I expect no offenses when I run:
💭
🤔 Note: You might think that I should change my Ruby to something like:
and I might agree in a single-argument case but this is also an issue with multiple arguments as you might see in testing:
Actual behavior
Instead of seeing no offenses, I see the following output:
And if I try to auto-correct the offenses with:
I see:
If I disable
Layout/FirstHashElementIndentation
, I can seeLayout/ArgumentAlignment
's strange attempted behavior. Changing the Rubocop configuration to:and running:
produces the following output:
and the following "corrected" Ruby:
Steps to reproduce the problem
See above! 😄
RuboCop version
The text was updated successfully, but these errors were encountered: