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

RescueEnsureAlignment and IndentationWidth don't work properly together #7470

Closed
snowe2010 opened this issue Oct 29, 2019 · 7 comments
Closed

Comments

@snowe2010
Copy link

An indented begin rescue expression does not indent the inner begin section correctly nor the end


Expected behavior

    result = begin
      yield 
    rescue Exception => e
      exit(1)
    end

should be reformated to be

    result = begin
               yield 
             rescue Exception => e
               exit(1)
             end

Actual behavior

it reformats to

    result = begin
      yield 
             rescue Exception => e
               exit(1)
    end

where both the yield and the end are not indented.

Steps to reproduce the problem

The above code should reproduce

RuboCop version

➜ rubocop -V                                                                                                                                                                                                                                                                                                                                                                           
0.76.0 (using Parser 2.6.4.1, running on ruby 2.5.3 x86_64-darwin18)
@nc-williamss
Copy link

We have this issue too, we just have the cop disabled because alignment is much worse when this cop is turned on. would love a nice fix to it someday

@ianfixes
Copy link
Contributor

Subscribing in case this is related to / fixed by #7531

My use case: #7531 (comment)

@stale
Copy link

stale bot commented Sep 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

@stale stale bot added the stale Issues that haven't been active in a while label Sep 20, 2020
@snowe2010
Copy link
Author

This is still an issue...

@stale stale bot removed the stale Issues that haven't been active in a while label Sep 20, 2020
@dylanahsmith
Copy link
Contributor

I think this is now addressed by enabling the Layout/BeginEndAlignment cop with EnforcedStyleAlignWith: start_of_line

@nc-williamss
Copy link

nc-williamss commented Nov 6, 2020

I think this is now addressed by enabling the Layout/BeginEndAlignment cop with EnforcedStyleAlignWith: start_of_line

I tested this against our application and saw little-to-no issues anymore. Quite nice actually. So you can consider my comment resolved. Might be able to just close this issue

@snowe2010
Copy link
Author

Ah yes I meant to test this. If someone else has tested then I think we can close it. Thanks for the fix!

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

No branches or pull requests

4 participants