Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New cop: Empty line after conditions spanning multiple lines #8384

Closed
fatkodima opened this issue Jul 22, 2020 · 0 comments · Fixed by #8411
Closed

New cop: Empty line after conditions spanning multiple lines #8384

fatkodima opened this issue Jul 22, 2020 · 0 comments · Fixed by #8411

Comments

@fatkodima
Copy link
Contributor

Inspired by https://github.com/airbnb/ruby#multiline-if-newline

It is better to differentiate between conditions and body in this case

if @reservation_alteration.checkin == @reservation.start_date &&
   @reservation_alteration.checkout == (@reservation.start_date + @reservation.nights)

  redirect_to_alteration @reservation_alteration
end

rather than in this

if @reservation_alteration.checkin == @reservation.start_date &&
   @reservation_alteration.checkout == (@reservation.start_date + @reservation.nights)
  redirect_to_alteration @reservation_alteration
end

This can be extended to other syntax constructs like unless, while, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant