Skip to content

PR06 fails when offending type name is used only as a substring #446

Closed
@amoeba

Description

@amoeba

I'm implementing numpydoc validation in my codebase and I have a case where I want to document a parameter like so,

    my_param : SubtringMatcher
Full script example
def my_fun(my_arg):
    """
    A function to test numpydoc behavior.

    This just tests out numpydoc checks for PR06.

    Parameters
    ----------
    my_arg : MyCustomSubstringClass
        My description goes here.

    See Also
    --------
    my_other_fun : Another fun I wrote.
    
    Examples
    --------
    arg = MyCustomSubstringClass("test")
    my_fun(arg)
    """
    pass

This fails with:

$ python -m numpydoc --validate script.my_fun
script.my_fun:PR06:Parameter "my_arg" type should use "str" instead of "string"

Would the project be open to changing how that validation works so PR06 only fails when an offending type name is used all by itself rather than as a substring in a custom type name?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions