Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
amoeba opened this issue Jan 7, 2023 · 2 comments · Fixed by #447
Closed

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

amoeba opened this issue Jan 7, 2023 · 2 comments · Fixed by #447

Comments

@amoeba
Copy link
Contributor

amoeba commented Jan 7, 2023

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?

@amoeba
Copy link
Contributor Author

amoeba commented Jan 7, 2023

I sent in a draft PR at #447 for consideration.

@rossbar
Copy link
Contributor

rossbar commented Jan 23, 2023

This is definitely a bug, thanks for raising!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants