rubyrubocop

rubocop indent multiline assignment rule


I have the following code:

var = SomeLongClassName.new(foo)
                       .bar
                       .baz

How can I configure Rubocop to enforce the following indentation?

    var = SomeLongClassName.new(foo)
            .bar
            .baz

Solution

  • I think you might be looking for Layout/MultilineMethodCallIndentation

    From their docs:

    myvariable = Thing
                   .a
                   .b
                   .c