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

Style/RedundantBegin syntax error after auto-correction #10004

Closed
cordis-dev opened this issue Aug 12, 2021 · 0 comments · Fixed by #10005
Closed

Style/RedundantBegin syntax error after auto-correction #10004

cordis-dev opened this issue Aug 12, 2021 · 0 comments · Fixed by #10005
Labels

Comments

@cordis-dev
Copy link
Contributor

Expected behavior

Given this code:

begin puts 'Test'; exit(0); end unless defined?(IORTable)

I'm expecting it to work after auto-correction (if it's needed).

Actual behavior

The code is changed to:

 puts 'Test'; exit(0);  unless defined?(IORTable)

Which shows this error when trying to run with ruby command: test.rb:1: syntax error, unexpected end-of-input

RuboCop version

1.18.4 (using Parser 3.0.1.1, rubocop-ast 1.9.1, running on ruby 3.0.1 x64-mingw32)
@Drenmi Drenmi added the bug label Aug 12, 2021
koic added a commit to koic/rubocop that referenced this issue Aug 12, 2021
Fixes rubocop#10004.

This PR fixes a false positive for `Style/RedundantBegin`
when using one-liner with semicolon.
bbatsov pushed a commit that referenced this issue Aug 17, 2021
Fixes #10004.

This PR fixes a false positive for `Style/RedundantBegin`
when using one-liner with semicolon.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants