From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#16996: 24.3.50; [ruby-mode] Incorrect indentation for implicit hash arguments Date: Sun, 18 Jul 2021 04:05:25 +0300 Message-ID: <3d615d6e-9848-cb11-6257-25f3a15bfd95@yandex.ru> References: <0CEC46C2A06B4B8DB6502F39A05D5E45@gmail.com> <87eh278mza.fsf@yandex.ru> <87zgwd7wd5.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11688"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 Cc: 16996@debbugs.gnu.org, Lars Ingebrigtsen To: Bozhidar Batsov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 18 03:06:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m4vFx-0002qm-Gh for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Jul 2021 03:06:09 +0200 Original-Received: from localhost ([::1]:46678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4vFw-0006J3-0S for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Jul 2021 21:06:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4vFq-0006Iu-KF for bug-gnu-emacs@gnu.org; Sat, 17 Jul 2021 21:06:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43360) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4vFq-0002zV-9r for bug-gnu-emacs@gnu.org; Sat, 17 Jul 2021 21:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m4vFq-0007Jj-5U for bug-gnu-emacs@gnu.org; Sat, 17 Jul 2021 21:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Jul 2021 01:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16996 X-GNU-PR-Package: emacs Original-Received: via spool by 16996-submit@debbugs.gnu.org id=B16996.162657033528092 (code B ref 16996); Sun, 18 Jul 2021 01:06:02 +0000 Original-Received: (at 16996) by debbugs.gnu.org; 18 Jul 2021 01:05:35 +0000 Original-Received: from localhost ([127.0.0.1]:54906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4vFO-0007J1-Vb for submit@debbugs.gnu.org; Sat, 17 Jul 2021 21:05:35 -0400 Original-Received: from mail-ed1-f52.google.com ([209.85.208.52]:41751) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4vFN-0007Io-Hm for 16996@debbugs.gnu.org; Sat, 17 Jul 2021 21:05:34 -0400 Original-Received: by mail-ed1-f52.google.com with SMTP id w14so18148347edc.8 for <16996@debbugs.gnu.org>; Sat, 17 Jul 2021 18:05:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=u7BjtEEEMeFtoGG5q+8JaWZQDZb0SlK/06o8EDrakWY=; b=MdE+daE3GHWxaQD0ArUYbUEJ0cz0kz1l0n2gIlzxjTzMMjZECZ4FCV9BxFhIEwsj+J HtitUcyjNlPJlMHIaMo5iEqAX7SfHe/PusuHNYejduuqMAhnoKurYpM4J2vzromzDHTR rLNiVVI2XCaHr741Y7z9BNIAfIVN144KBGD2JJBpu8UqbA8ot38L8a51kt1aaXGifd98 Xo0i+DF7A42j8x7XGcNtQgiNC6WsAFnycthXgkEmhItS4a2XmfQ4wiw7fPVGm8vDCr+N n/MhFo/FJQG/T8IT8K+lOazhGsSHPoKRNFcFtCMyF2kSPFpi0/6tEgco2SdcApjExI0S e/jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=u7BjtEEEMeFtoGG5q+8JaWZQDZb0SlK/06o8EDrakWY=; b=JmMn2a9bOh+ovBqO1ODtLa9oxrbbYvrraG6xPYQO+kX0urOH5Jsqa3YUQhbQtBMB6+ VvR0j3wD+9Bz51/pxjMV+BkQ1ghxW/ARhTloUytIDZHjXmqQd4Mi89nNlO2PEUpy78zN qlP0wkE4g/uLQ4Sxwm67bGT8EOOzx5QJ28lAQODkqyN9w0Q3lwjAGLzjiEi8ONRZcsf4 Q9Uwb6i2rh2yr4G+7DePc/gGS9DCvQYqG2MNLOi+ToQm9li7ZcY2b/FkO1pzhmGhGGIe jFL0OXLoYTF+8ytglZvnFcVcAqTuY4G3eHtZsH8HkaMzAxgk3K1eCmwZPOyE9zqm0pgs JITg== X-Gm-Message-State: AOAM533AwmB23fD+FI6R5lcOLWMRC/CE3bbNG2Id90b4XMiYchRrtZmT 9KVyi18rP6kAyW9vzJ96Uq4gZMi3Js0= X-Google-Smtp-Source: ABdhPJwEwjjbjBlICLiX/SNPXFnEZI3upSXOrvyj4sKfQGTIuh9SF6YluLYNWBt/6UYx96UYHf6j/g== X-Received: by 2002:a05:6402:144f:: with SMTP id d15mr25056865edx.27.1626570327764; Sat, 17 Jul 2021 18:05:27 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id v11sm4361562ejx.104.2021.07.17.18.05.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 17 Jul 2021 18:05:26 -0700 (PDT) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:210157 Archived-At: 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 > 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 > > > and > 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.