-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Error when parsing nameless method in Style/MultilineMethodSignature cop #11765
Labels
Comments
8 tasks
koic
added a commit
to koic/rubocop
that referenced
this issue
Apr 6, 2023
Fixes rubocop#11765. This PR fixes an error for `Style/MultilineMethodSignature` when line break after `def` keyword. It seems preferable that the following cases can be detected by a new different cop: ```ruby def method_name arg; end ``` This is probably not a common line break, the new cop will be able to handle `class`, `module`, class method definitions, and others as well. And this `Style/MultilineMethodSignature` cop is disabled by default, but I have a feeling that the new cop can be enabled by default.
@koic thank you for taking a look at this! I've found another testcase for this bug, not sure if your fix also handles it: class Test
def initialize settings, user = nil, test =
@user = user
end
def test; end
end |
Yeah, #11768 also prevents that error case. |
bbatsov
pushed a commit
that referenced
this issue
Apr 6, 2023
Fixes #11765. This PR fixes an error for `Style/MultilineMethodSignature` when line break after `def` keyword. It seems preferable that the following cases can be detected by a new different cop: ```ruby def method_name arg; end ``` This is probably not a common line break, the new cop will be able to handle `class`, `module`, class method definitions, and others as well. And this `Style/MultilineMethodSignature` cop is disabled by default, but I have a feeling that the new cop can be enabled by default.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rubocop errors out while parsing an invalid Ruby file. I'm experiencing this issue (vim displaying rubocop's error) with ruby-lsp and vim every time I type "def" in a Ruby class.
Expected behavior
Not seeing this error.
Actual behavior
An error in Rubocop.
Debug info:
Steps to reproduce the problem
Given
test.rb
file with the following content:run:
RuboCop version
The text was updated successfully, but these errors were encountered: