Forum: Ruby-core [Ruby 1.9 - Bug #5357][Open] Indentation of nested operators should nest

Posted by Nikolai Weibull (Guest)
on 2011-09-23 12:02
(Received via mailing list)
Issue #5357 has been reported by Nikolai Weibull.

----------------------------------------
Bug #5357: Indentation of nested operators should nest
http://redmine.ruby-lang.org/issues/5357

Author: Nikolai Weibull
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: trunk


Hi!

Currently,

return if
  hash.
    values_at(:a, :b, :c).
    reject{ |e| e.nil? or e.empty? }.
    empty?

is indented

as

return if
  hash.
  values_at(:a, :b, :c).
  reject{ |e| e.nil? or e.empty? }.
  empty?

I would prefer it to be indented as in the first example.
Posted by Koichi Sasada (Guest)
on 2012-03-11 07:53
(Received via mailing list)
Issue #5357 has been updated by Koichi Sasada.

Category set to misc
Status changed from Open to Assigned
Assignee set to Nobuyoshi Nakada


----------------------------------------
Bug #5357: Indentation of nested operators should nest
https://bugs.ruby-lang.org/issues/5357

Author: Nikolai Weibull
Status: Assigned
Priority: Normal
Assignee: Nobuyoshi Nakada
Category: misc
Target version:
ruby -v: trunk


Hi!

Currently,

return if
  hash.
    values_at(:a, :b, :c).
    reject{ |e| e.nil? or e.empty? }.
    empty?

is indented

as

return if
  hash.
  values_at(:a, :b, :c).
  reject{ |e| e.nil? or e.empty? }.
  empty?

I would prefer it to be indented as in the first example.
Posted by Nobuyoshi Nakada (nobu)
on 2012-12-03 03:43
(Received via mailing list)
Issue #5357 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Assigned to Feedback

=begin
Your first example seems inconsistent, why are the last 3 lines indented 
at the same column?
It would be:

  return if
    hash.
      values_at(:a, :b, :c).
        reject{ |e| e.nil? or e.empty? }.
          empty?

But it doesn't look nice to me.

=end

----------------------------------------
Bug #5357: Indentation of nested operators should nest
https://bugs.ruby-lang.org/issues/5357#change-34333

Author: now (Nikolai Weibull)
Status: Feedback
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: misc
Target version:
ruby -v: trunk


Hi!

Currently,

return if
  hash.
    values_at(:a, :b, :c).
    reject{ |e| e.nil? or e.empty? }.
    empty?

is indented

as

return if
  hash.
  values_at(:a, :b, :c).
  reject{ |e| e.nil? or e.empty? }.
  empty?

I would prefer it to be indented as in the first example.
Posted by Alex Young (regularfry)
on 2012-12-03 11:54
(Received via mailing list)
On 03/12/12 02:35, nobu (Nobuyoshi Nakada) wrote:
>      hash.
>        values_at(:a, :b, :c).
>          reject{ |e| e.nil? or e.empty? }.
>            empty?
>
> But it doesn't look nice to me.

Indenting the last 3 lines highlights that the method chain is hanging
off hash.  I do this myself.
Posted by drbrain (Eric Hodel) (Guest)
on 2013-01-25 22:48
(Received via mailing list)
Issue #5357 has been updated by drbrain (Eric Hodel).

Status changed from Feedback to Assigned
Target version set to next minor


----------------------------------------
Bug #5357: Indentation of nested operators should nest
https://bugs.ruby-lang.org/issues/5357#change-35647

Author: now (Nikolai Weibull)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: misc
Target version: next minor
ruby -v: trunk


Hi!

Currently,

return if
  hash.
    values_at(:a, :b, :c).
    reject{ |e| e.nil? or e.empty? }.
    empty?

is indented

as

return if
  hash.
  values_at(:a, :b, :c).
  reject{ |e| e.nil? or e.empty? }.
  empty?

I would prefer it to be indented as in the first example.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.