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

SyntaxError after "safe" correction into end-less method definition #9355

Closed
paddor opened this issue Jan 8, 2021 · 1 comment · Fixed by #9361
Closed

SyntaxError after "safe" correction into end-less method definition #9355

paddor opened this issue Jan 8, 2021 · 1 comment · Fixed by #9361
Labels

Comments

@paddor
Copy link

paddor commented Jan 8, 2021

rubocop -a turns one-line method definitions into syntactically incorrect end-less method definitions on Ruby 3.0.

Example:

      def sndhwm() Zsock.sndhwm(@zocket) end

Expected behavior

Correct syntax:

      def sndhwm = Zsock.sndhwm(@zocket)

Actual behavior

      def sndhwm(()) = Zsock.sndhwm(@zocket)

RuboCop version

1.8.0 (using Parser 3.0.0.0, rubocop-ast 1.4.0, running on ruby 3.0.0 x86_64-linux)

Ruby version

ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]

@bbatsov bbatsov added the bug label Jan 8, 2021
@dvandersluis
Copy link
Member

I'll take a look at this.

dvandersluis added a commit to dvandersluis/rubocop that referenced this issue Jan 10, 2021
…dless method when the original code had parens.
koic added a commit that referenced this issue Jan 10, 2021
[Fix #9355] Fix `Style/SingleLineMethods` autocorrection to endless method when the original code had parens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants