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
When linting this with Layout/HashAlignment and EnforcedColonStyle: table, Rubocop flags this as: Layout/HashAlignment: Align the keys and values of a hash literal if they span more than one line
and during auto-correction, errors out with: Infinite loop detected in file.rb and caused by Layout/HashAlignment
…t` when a `kwsplat` node is on the same line as a `pair` node with table style.
Keyword splats were previously treated as pairs using colon style, which some hacks in the Alignment classes to handle them. However, this did not account for all possibilities and would cause previous pairs on the same line as the `kwsplat` to be removed by autocorrection.
Instead, now a special `KeywordSplatAlignment` type was added to handle `kwsplat`s. The previously behaviour about `kwsplat`s was retained (they will still be aligned with the beginning of the rest of the hash, regardless of enforced style), and the hacks in `KeyAlignment` and `TableAlignment` for `kwsplat`s were removed.
… a `kwsplat` node is on the same line as a `pair` node with table style.
Keyword splats were previously treated as pairs using colon style, which some hacks in the Alignment classes to handle them. However, this did not account for all possibilities and would cause previous pairs on the same line as the `kwsplat` to be removed by autocorrection.
Instead, now a special `KeywordSplatAlignment` type was added to handle `kwsplat`s. The previously behaviour about `kwsplat`s was retained (they will still be aligned with the beginning of the rest of the hash, regardless of enforced style), and the hacks in `KeyAlignment` and `TableAlignment` for `kwsplat`s were removed.
Consider this snippet:
When linting this with
Layout/HashAlignment
andEnforcedColonStyle: table
, Rubocop flags this as:Layout/HashAlignment: Align the keys and values of a hash literal if they span more than one line
and during auto-correction, errors out with:
Infinite loop detected in file.rb and caused by Layout/HashAlignment
Expected behavior
It should not crash
RuboCop version
The text was updated successfully, but these errors were encountered: