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
Relax alignment requirements #7
Comments
To clarify: The cop in question is Layout/RescueEnsureAlignment. And yes, you are right, Rubocop's layout cops default to aligning the entire statement, as outlined in your 3rd code block (which is a preferred way for many Rubyists). While the 2nd code block satisfies the cop, we definitely would not want that. The cop's actual intention is still valid: Since this is an issue in Rubocop, I agree we should disable the cop for now. If you suggest disabling further cops, please name them explicitly. Other cops, like EndAlignment, work as required and we would not want to disable them unless they cause similar issues. |
There is an issue on this topic rubocop/rubocop#6254. While its fix was released in 0.64 rubocop/rubocop#6753, it still has problems which haven't been fixed yet rubocop/rubocop#6771. Need to have an eye on this and update our fork once that thing is straight. |
Cop has been disabled in 3.1.0 |
Once Rubocop's related issues have been resolved, we will open a new issue for discussion if we want to re-enable the cop with a different configuration. |
This little method tries to parse a date from request parameters and falls back to "today":
However, Rubocop complains that
rescue
doesn't align withbegin
. While this satiesfies it (WAT) ...... probably this is what Rubocop wants:
This huge indentation is no good thing. It denies the "indent with 2 spaces" principle and worse, it makes many lines depend on a single other line: when the
@date
variable is renamed, all the lines below need to be rearranged.Verdict
Rubocop should not force
begin
andrescue
to align. There's nothing wrong in the first code example.Probably there are related alignment rules that need to be adapted similarly.
The text was updated successfully, but these errors were encountered: