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

Support endless method definitions #1381

Merged
merged 1 commit into from
May 6, 2021
Merged

Support endless method definitions #1381

merged 1 commit into from
May 6, 2021

Conversation

rkh
Copy link
Contributor

@rkh rkh commented May 6, 2021

Description

Ruby 3.0 introduces endless method definitions:

def method = "return value"

This raises an exception in YARD, as the Ruby parser never calls on_params, thus there is no ParameterNode inside the method definition (see #1376). I've adjusted the code slightly to be able to handle this case.

I've added a test and have also confirmed on a real world project that with this change YARD correctly handles endless method definitions without parameters.

Endless method definitions with parameters were already supported. I've also added a test for them, as there was none.

Completed Tasks

  • I have read the Contributing Guide.
  • The pull request is complete (implemented / written).
  • Git commits have been cleaned up (squash WIP / revert commits).
  • I wrote tests and ran bundle exec rake locally (if code is attached to PR).

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 93.404% when pulling 5bbbd9e on rkh:rkh-ruby-3 into 3590066 on lsegal:main.

@rkh
Copy link
Contributor Author

rkh commented May 6, 2021

The coverage report decrease is a false positive (false negative?), as the lines in question are only executed with Ruby 3.0 or higher.

@rkh rkh mentioned this pull request May 6, 2021
@lsegal lsegal merged commit b589fa0 into lsegal:main May 6, 2021
@lsegal
Copy link
Owner

lsegal commented May 6, 2021

Thanks for your PR! Sometimes coverage acts up on small deltas.

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

3 participants