From: Dmitry Gutov <dgutov@yandex.ru>
To: Bozhidar Batsov <bozhidar@batsov.com>
Cc: 16996@debbugs.gnu.org, Lars Ingebrigtsen <larsi@gnus.org>
Subject: bug#16996: 24.3.50; [ruby-mode] Incorrect indentation for implicit hash arguments
Date: Sun, 18 Jul 2021 04:05:25 +0300 [thread overview]
Message-ID: <3d615d6e-9848-cb11-6257-25f3a15bfd95@yandex.ru> (raw)
In-Reply-To: <CAM9Zgm0yd=scT4oEG38dNx6JeaogZ2Ge8VDhO8M3rrjYgoU8-w@mail.gmail.com>
On 30.06.2021 11:25, Bozhidar Batsov wrote:
> Sorry for the slow responses.
Same. :-(
> On Sat, 29 May 2021 at 21:25, Dmitry Gutov <dgutov@yandex.ru
> <mailto:dgutov@yandex.ru>> wrote:
>
> 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.
>
>
> Perhaps we should first discuss our options there and adjust ruby-mode
> afterwards? It's always a bit painful to discuss indentation issues over
> email. :D
I'm happy to do that anywhere. You can ping me on Discord too.
> Ruby Style Guide strategically avoids this example, and
> https://www.rubydoc.info/gems/rubocop/0.83.0/RuboCop/Cop/Layout/HashAlignment
> <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
> <https://www.rubydoc.info/gems/rubocop/0.83.0/RuboCop/Cop/Layout/ArgumentAlignment>
>
> do that too.
>
>
> Most likely that's just an oversight. People tend to focus on the most
> common scenarios.
I was also thinking that perhaps you had been unfortunately biased
toward not explicitly recommending a style which ruby-mode cannot
support. :(
> 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
>
>
> You get those offenses for fixed indentation? For align that seems like
> an offense indeed, but for fixed it seems quite natural.
What's a "fixed indentation"? In both of the above cases I get
complaints from the Layout/HashAlignment cop. I think we're using its
default config.
> 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.
>
>
> I have to admit that I always stick to:
>
> top(1,
> :a => 1,
> :b => 2)
Likewise, if only out of necessity.
> Still, the second option seems somewhat reasonable if you're into mixing
> argument types on the same line, although probably aligning on the hash
> keys would be better for the readability of the code. Probably
> your example makes even more sense for keyword arguments.
Sure. Depending on the code, or particular invocation, I could see
either style being more reasonable than the other.
prev parent reply other threads:[~2021-07-18 1:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-12 10:53 bug#16996: 24.3.50; [ruby-mode] Incorrect indentation for implicit hash arguments Bozhidar Batsov
2014-03-12 15:18 ` Dmitry Gutov
2021-05-29 8:55 ` Lars Ingebrigtsen
2021-05-29 18:25 ` Dmitry Gutov
[not found] ` <CAM9Zgm0yd=scT4oEG38dNx6JeaogZ2Ge8VDhO8M3rrjYgoU8-w@mail.gmail.com>
2021-07-18 1:05 ` Dmitry Gutov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3d615d6e-9848-cb11-6257-25f3a15bfd95@yandex.ru \
--to=dgutov@yandex.ru \
--cc=16996@debbugs.gnu.org \
--cc=bozhidar@batsov.com \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).