[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16996: 24.3.50; [ruby-mode] Incorrect indentation for implicit hash
From: |
Dmitry Gutov |
Subject: |
bug#16996: 24.3.50; [ruby-mode] Incorrect indentation for implicit hash arguments |
Date: |
Sat, 29 May 2021 21:25:22 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
On 29.05.2021 11:55, Lars Ingebrigtsen wrote:
The current indentation in Ruby here seems pretty natural to me, so I'm
closing this bug report.
We should probably reopen it. It's not very urgent (as the bug creation
date will confirm), but I wanted to get around to this someday.
Bozhidar, could you confirm it's still needed (or good to have)?
I wanted to find some style guide or other solid description of this
style, but haven't managed to.
Ruby Style Guide strategically avoids this example, and
https://www.rubydoc.info/gems/rubocop/0.83.0/RuboCop/Cop/Layout/HashAlignment
and
https://www.rubydoc.info/gems/rubocop/0.83.0/RuboCop/Cop/Layout/ArgumentAlignment
do that too.
Despite that, I actually have to deal with this implicit recommendation
on a regular basis at work, because when both cops are enabled, Rubocop
will frown on
top(1, :a => 1,
:b => 2
and
top 1, a: 1,
b: 2
I do remember style like
top(1, :a => 1,
:b => 2)
being popular back in the day, but AFAICT a lot of editors now (like
Atom and VS Code) don't support it either.