Feneric / doxypypy

A more Pythonic version of doxypy, a Doxygen filter for Python.
GNU General Public License v2.0
149 stars 49 forks source link

Add property reformatting #56

Closed jaydcarlson closed 3 years ago

jaydcarlson commented 6 years ago

Doxygen gets confused by Python properties; this PR works around this issue by rewriting the property's definition in a manner that Doxygen understands.

After applying this patch, doxypypy will transform this:

@property
def enabled(self) -> bool:
    """
    Gets or sets whether the module is enabled

    Returns:
        whether the module is enabled
    """
    return self._enabled

@enabled.setter
def enabled(self, value: bool):
    self._enabled = value

into this:

## @brief   Gets or sets whether the module is enabled
#
# @return
# @return   whether the module is enabled
#
#

enabled = property
## \private
@property
def enabled(self) -> bool:
    return self._enabled

## \private
@enabled.setter
def enabled(self, val: bool):
    self._enabled = value

We create a new property that will contain the correct docstring; we then use \private to hide the existing getter/setter from doxygen.

Closes #18.

Feneric commented 6 years ago

I'd be happy to add this, but we need some tests for it. All the major features of doxypypy are presently covered by tests in the test folder, and all of these tests get run prior to each release. We don't want to go down the path of adding in new features that'll silently break later, because that won't help anybody.