bbatsov/ruby-style-guide — Issue #80: Indentation on multi-line method calls
Author: Odaeus
Created: 2012-02-29 18:42:22+00:00
State: open

I can't see anything about indenting multi-line method calls, which are relatively common if you need to supply a lot of params to an object.

Examples of the styles:

```
# Original
def send_mail(source)
Mailer.deliver(to: "bob@example.com", from: "us@example.com", subject: "Important message", body: source.text)
end

# Two-indent
def send_mail(source)
Mailer.deliver(
to: "bob@example.com",
from: "us@example.com",
subject: "Important message",
body: source.text)
end

# Four-indent (my preferred)
def send_mail(source)
Mailer.deliver(
to: "bob@example.com",
from: "us@example.com",
subject: "Important message",
body: source.text)
end

# Aligned
def send_mail(source)
Mailer.deliver(to: "bob@example.com",
from: "us@example.com",
subject: "Important message",
body: source.text)
end
```

I prefer double my normal indentation (so four spaces) to make it clear these are params, but I don't think it's common at all. I'm not keen on aligned style even though it's more common because of the effort and maintenance required.

What do you think should be in the style guide?