Coding style: Your preference in multi-lines instruction styling?

#1

Just for my curiosity, what is your preferred writing style for multi-lines instructions and why?

    room.bookings
      .for_day(start_date)
      .with_client.each do |booking|
    room.bookings.
      for_day(start_date).
      with_client.each do |booking|
    room.bookings.
    for_day(start_date).
    with_client.each do |booking|

Questions are:

  • The points before NEWLINE or at start of the next line ?
  • Are you adding a tab after the first line ?

Rubocop with AirBnB rules enforce second style.

I do prefer the first one however :slight_smile:

Cheers,

1 Like

#2

crystal tool format agrees with you (it enforces first), so i think there is no question.
Point at start of line clearly shows that it’s not separate line but a chained call.

5 Likes

#3

Indeed I forgot about crystal tool format ;-)

0 Likes