Skip to content

Handle no space between param name and colon #21

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

Open
lagru opened this issue Oct 9, 2024 · 1 comment
Open

Handle no space between param name and colon #21

lagru opened this issue Oct 9, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@lagru
Copy link
Member

lagru commented Oct 9, 2024

Consider this docstring

from numpydoc.docscrape import NumpyDocString

def foo(x):
    """Function docstring.
    
    Parameters
    ----------
    x: int
        Some description
    """

NumpyDocString(foo.__doc__)["Parameters"]

returns

[Parameter(name='x: int', type='', desc=['Some description'])]

Notice how the type of the parameter is empty! While the official syntax requires that the colon is preceded by a space, it's a typo that's very easy to miss and is very annoying in context of docstub. This case should be detected and either be warned about or handled gracefully.

@lagru lagru added the bug Something isn't working label Oct 9, 2024
@lagru
Copy link
Member Author

lagru commented Oct 9, 2024

Related numpy/numpydoc#78. The general consensus seems to be to lint this prior with numpydoc lint. However, that linter doesn't seem to detect this specific issue.

@lagru lagru added enhancement New feature or request and removed bug Something isn't working labels Oct 10, 2024
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