jshwi / docsig

Check signature params for proper documentation
https://docsig.readthedocs.io
MIT License
36 stars 2 forks source link

SIG401 false positive #427

Closed FlotterCodername closed 2 months ago

FlotterCodername commented 3 months ago

Using an rst directive with an indent of 3 spaces can lead to a false positive regarding the indentation of params. When using 4 spaces, this false positive does not appear.

Please note that 3-space indent style is the one preferred by docutils and sphinx docs also. When nesting rst statements, you end up with unsightly/unpredicable results quickly if you try to enforce 4-space indentation.

def method(*, arg1 = "") -> str:
    """
    Description text

    .. code-block:: python
       print()

    :param arg1: text
    :return: text
    :raises TypeError: Incorrect argument(s)
    """
    return ""

Expected: no error

Environment:

jshwi commented 2 months ago

Hi @FlotterCodername

Thanks for spotting this, and logging this issue. It helps a lot to improve this package

This goes against the expected behaviour. I don't think the docstring description should be raising errors. The intended scope is to check function signature documentation

I've added the fix, and your code-blocks should not raise any errors anymore

This is available with version 0.60.1. Hope this helps! Please don't hesitate to raise another issue if you come across anything else

Cheers, Stephen

FlotterCodername commented 2 months ago

Hi Stephen,

wow that was fast, thanks so much! If anything comes up, I will definitely take care to write a good issue. Thank you for all the hard work and helping us make our Python docs better!

Best regards Fabian