GNU bug report logs -
#16182
24.3.50; ruby-mode: Indentation style of multiline literals with hanging open paren inside other parens
Previous Next
Reported by: Dmitry Gutov <dgutov <at> yandex.ru>
Date: Wed, 18 Dec 2013 03:56:02 UTC
Severity: minor
Found in version 24.3.50
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 19.12.2013 14:54, Bozhidar Batsov wrote:
> I can confirm that your method args indentation fix is working. I did,
> however, notice the following problem after I mentioned the
> if/unless/case with assignment indentation. Consider the following:
>
> res = method do |x, y|
> something
> end
>
> Might make sense to indent those like:
>
> res = method do |x, y|
> something
> end
>
> for consistency with the if/unless/case indentation by default.
It might be more consistent, but I don't see any projects doing that.
For example, ActiveRecord, Grape, Goliath and Rack don't.
Check out the examples at the top:
https://github.com/rails/rails/blob/master/activerecord/lib/active_record/base.rb
https://github.com/rack/rack/blob/master/lib/rack/builder.rb
It can be an option, though.
---
Come to think of it, do you see the "align end to the keyword" style
much? I did a grep on my gems directory, and the other style seems to be
prevalent, especially among the non-core gems:
Pry, RDoc, Minitest, Rubygems, EventMachine, Nokogiri align to keyword.
ActiveRecord, ActiveSupport, other Active* gems, Cucumber, Thor, Grape,
Excon, WebMock, Faraday align to the beginning of the statement.
RSpec uses both. Yard aligns to keyword after "=", but to statement
after "||=".
Maybe we even should align to the statement by default, because, you
know, Rails.
> Also:
>
> res =
> method do |x, y|
> something
> end
>
> is actually indented like this:
>
> res =
> method do |x, y|
> something
> end
Guess we can special-case this.
This bug report was last modified 11 years and 247 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.