Skip to content

Comments not indented as expected #360

@aoki1980taichi

Description

@aoki1980taichi

This code

class C
  def f
    raise "unexpected" unless array.all?{ |e|
      next (
        # method1 should be gtrater than 0
        method1>0 ||
        (
          # or it shoule be 0 and
          method1==0 &&
          (
            (
              # methos2 should be satisfied
              some_method2
            )||
            (
              #or method3
              some_method3
            )
          )
        )
      )
    }
  end
end

gets formatted to this code

class C
  def f
    raise "unexpected" unless array.all? { |e|
      next (
 # method1 should be gtrater than 0
             method1 > 0 ||
             (
 # or it shoule be 0 and
               method1 == 0 &&
               ((
 # methos2 should be satisfied
                 some_method2) ||
                (
 #or method3
                  some_method3))))
    }
  end
end

Is this the expected behavior for rufo?
I personally wanted the comments to be on the same identation with the code.

I checked with the latest rufo.
https://github.com/ruby-formatter/rufo/tree/5186ef60d6b34fde3da5f66699ce625620c41090

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions