GNU bug report logs - #16996
24.3.50; [ruby-mode] Incorrect indentation for implicit hash arguments

Previous Next

Package: emacs;

Reported by: Bozhidar Batsov <bozhidar <at> batsov.com>

Date: Wed, 12 Mar 2014 10:55:02 UTC

Severity: minor

Found in version 24.3.50

Full log


Message #16 received at 16996 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 16996 <at> debbugs.gnu.org, Bozhidar Batsov <bozhidar <at> batsov.com>
Subject: Re: bug#16996: 24.3.50; [ruby-mode] Incorrect indentation for
 implicit hash arguments
Date: Sat, 29 May 2021 21:25:22 +0300
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.




This bug report was last modified 3 years and 332 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.