Skip to content

Support for YARD convention of question marks to denote nilable types #160

@ForeverZer0

Description

@ForeverZer0

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions