readthedocs / sphinx-autoapi

A new approach to API documentation in Sphinx.
https://sphinx-autoapi.readthedocs.io/
MIT License
415 stars 126 forks source link

Undocumented instance attributes are ignored even with "undoc-members" selected #451

Closed hanetar closed 1 week ago

hanetar commented 3 weeks ago

I've found that undocumented instance attributes, e.g.:

class Test:
    def __init__(self):
        self.found : bool = False

are always left out of the documentation, regardless of the "undoc-members" setting in autoapi_options. They are not even sent for evaluation via the autoapi-skip-member callback. I don't think this is expected behavior.

As far as I can tell, this is due to line 216 in the parse_functiondef() method of the Parser class in "_parser.py":

result.extend(data for data in child_data if data["doc"])

IMO, the condition should be removed so that all parsed members are passed through to the filtering via autoapi_options and autoapi-skip-member, allowing the user to keep the undocumented ones as well.

sachahu1 commented 2 weeks ago

@hanetar I think this is a duplicate of #448 and #441. You might want to have a look at #448 To see if that solves your issue. Otherwise I've also tried to implement a fix in #453.