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

Disable rescue alignment cop until bugs are fixed #168

Closed
wants to merge 2 commits into from

Conversation

zachsabin
Copy link
Collaborator

Currently the rescue alignment cop has an issue on variable assignments where it enforces this style:

return_val = begin
  # computation
             rescue
               # rescued value
end

which is bad.

rubocop/rubocop#7531 will maybe fix it, but I think it makes sense to disable this for now until it's fixed in a rubocop release.

@robotpistol
Copy link
Contributor

robotpistol commented Dec 6, 2019

The solution here is to do this instead

return_val = 
  begin
    # computation
  rescue
    # rescued value
  end

@robotpistol
Copy link
Contributor

The problem is more being caused by inconsistent lining up of en with begin block and the body. This isn't a bug but rather configuration

@zachsabin
Copy link
Collaborator Author

True, but we'd like the option to have rescue align with the variable assignment. It seems like that configuration is in the works, in the meantime the auto correct (what I posted in the PR body) is a very strange format that we'd like to avoid.

Copy link
Contributor

@Umofomia Umofomia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to this, it looks like there is a bug with the associated autocorrect too: rubocop/rubocop#6254

I'm fine with disabling this until the cop is more stable.

@zachsabin
Copy link
Collaborator Author

zachsabin commented Dec 6, 2019

I think the autocorrect bug is now fixed.

I'm going to hold off on merging this for a little bit to see if the rubocop configuration change gets merged. If it seems like it will take a while, then I'll merge this to disable the cop.

Copy link
Contributor

@BMorearty BMorearty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it

@michael-zoller-airbnb
Copy link

michael-zoller-airbnb commented Apr 14, 2022

the bug has been fixed as of rubocop version 0.9.1 which adds the BeginEndAlignment cop with the default "start_of_line"

@pariser
Copy link
Contributor

pariser commented Feb 27, 2023

Since we've progressed well past rubocop 0.9.1, I'm going to close this out. Thanks everyone for the contributions.

@pariser pariser closed this Feb 27, 2023
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 this pull request may close these issues.

None yet

6 participants