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
[Fix #7795] Make Layout/EmptyLineAfterGuardClause
aware of and return
#7796
[Fix #7795] Make Layout/EmptyLineAfterGuardClause
aware of and return
#7796
Conversation
066c001
to
4007253
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fair. It is a guard clause by our definition of the word.
4007253
to
e191613
Compare
26467b6
to
c281156
Compare
@Drenmi Thanks for your kindness review! |
Shouldn't we also cover usages of |
c281156
to
3e7cd7e
Compare
Sure! I updated this PR to support |
@koic Looks good! Feel free to merge it and the other PRs I just approved. I was a bit too lazy to resolve the merge conflicts in the changelog myself. :-) |
Yeah, I will resolve conflicts and merge. Thank you for the review! |
…and return` Resolves rubocop#7795. This PR makes `Layout/EmptyLineAfterGuardClause` aware of `and return`. It was proposed based on the following code controlled by Rails controller. ```ruby render :foo and return if condition do_something ``` I think that it can be generalized as a control flow. ```ruby foo(arg) and return if condition do_something ``` So it will be newly detected by `Layout/EmptyLineAfterGuardClause` cop.
3e7cd7e
to
2e9f9e2
Compare
Resolves #7795.
This PR makes
Layout/EmptyLineAfterGuardClause
aware ofand return
.It was proposed based on the following code controlled by Rails controller.
I think that it can be generalized as a control flow.
So it will be newly detected by
Layout/EmptyLineAfterGuardClause
cop.Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.