mkdocstrings / pytkdocs

Load Python objects documentation.
https://mkdocstrings.github.io/pytkdocs
ISC License
50 stars 32 forks source link

[BUG] missing numpydoc parameters validation resulting in Nonetype exception #137

Closed JoeHCQ1 closed 2 years ago

JoeHCQ1 commented 2 years ago

Describe the bug

Missing parameter description results in Nonetype error down the line instead of checking for that, warning the user, and passing a safe return for further use (safe is not None).

To Reproduce

(copied from comment on https://github.com/mkdocstrings/mkdocstrings/pull/397)

"""
My numpydoc string documented function foo

Parameters
------------
param : str  # if I don't add a description below I get that None error
    Description to prevent Nonetype error.

Returns
--------
ret : str  # Interestingly if I omit elements of this I get specific warnings telling me what is wrong
    # I can also omit the description and get a pointed warning but no None error.
"""

Expected behavior

Code would display a warning or error noting that the parameter's description is missing similar to how it works in returns validation.

This: https://github.com/mkdocstrings/pytkdocs/blob/master/src/pytkdocs/parsers/docstrings/numpy.py#L104

Should have an added check like this: https://github.com/mkdocstrings/pytkdocs/blob/master/src/pytkdocs/parsers/docstrings/numpy.py#L196

System (please complete the following information):

Additional context

Discovered while trying to get to the bottom of https://github.com/mkdocstrings/mkdocstrings/pull/397.

JoeHCQ1 commented 2 years ago

I'll see if I can get a quick fix in for this - hopefully I can add this in easily and open a PR with the fix.

JoeHCQ1 commented 2 years ago

See #138 where this is addressed.