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 for YARD convention of question marks to denote nilable types #160

Open
ForeverZer0 opened this issue Oct 3, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@ForeverZer0
Copy link

Is your feature request related to a problem? Please describe.
When documenting with YARD, one can simply add a ? suffix to a type in a @param or @return to indicate that the value may be nil. However, sord generates an error when this syntax is used and does not recognize the type or that it is nilable, but merely results in an error being generated.

For example:

# @param name [String?] The new name, or `nil` to reset the default name.
def rename(name)
  ...
end

Describe the solution you'd like
That the YARD syntax be permitted and generate correct RBI/RBS.

Describe alternatives you've considered
The use [Type,nil] works well enough and achieves the expected result, though it would be ideal to not have to alter existing YARD documentation and deviate from its conventions in order to make it compliant with sord.

Additional context
N/A

@ForeverZer0 ForeverZer0 added the enhancement New feature or request label Oct 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant