guides icon indicating copy to clipboard operation
guides copied to clipboard

Ruby identation of conditions within assignments

Open naps62 opened this issue 10 years ago • 1 comments

The setting we currently have in Rubocop enforces this:

value = if condition
          1
        else
          2
        end

Personally, I like it, but I believe some people prefer the other option:

value = if condition
  1
else
  2
end

My only issue with changing is that vim's auto-indent currently does the first option. If we change rubocop, we need to change vim as well, which I don't know how to do.

This was created because @zamith and I started this discussion during a code review.

PS: let's please not start a discussion about which one is better or why, and just focus on the decision and the vim issue :panda_face:

naps62 avatar May 08 '15 16:05 naps62

Actually I would indent the second version two spaces more, like I did in the issue.

That is the version I prefer, but I have no problem with any of them. On Fri 8 May 2015 at 17:41 Miguel Palhas [email protected] wrote:

The setting we currently have in Rubocop enforces this:

value = if condition 1 else 2 end

Personally, I like it, but I believe some people prefer the other option:

value = if condition 1else 2end

My only issue with changing is that vim's auto-indent currently does the first option. If we change rubocop, we need to change vim as well, which I don't know how to do.

This was created because @zamith https://github.com/zamith and I started this discussion during a code review.

PS: let's please not start a discussion about which one is better or why, and just focus on the decision and the vim issue [image: :panda_face:]

— Reply to this email directly or view it on GitHub https://github.com/groupbuddies/guides/issues/5.

zamith avatar May 08 '15 18:05 zamith