Jason Swett
Jason Swett

Reputation: 45134

Enforce one argument per line in RuboCop

Using RuboCop, I want to disallow method argument formatting that looks like this:

some_method(arg_1,
  arg_2)

And allow formatting that looks like this:

some_method(
  arg_1,
  arg_2
)

I also want to allow formatting that looks like this:

some_method(arg_1, arg_2)

How can I achieve this?

Upvotes: 2

Views: 192

Answers (1)

beniutek
beniutek

Reputation: 1777

Seems this is the rule you are looking for:

https://www.rubydoc.info/gems/rubocop/0.45.0/RuboCop/Cop/Style/FirstMethodArgumentLineBreak

to enable it just write this in your rubocop.yml file:

Style/FirstMethodArgumentLineBreak:
  Enabled: True

Upvotes: 1

Related Questions