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

docstring-missing-returns (DOC201) reports on __new__ #13079

Closed
tjkuson opened this issue Aug 23, 2024 · 0 comments · Fixed by #13300
Closed

docstring-missing-returns (DOC201) reports on __new__ #13079

tjkuson opened this issue Aug 23, 2024 · 0 comments · Fixed by #13300
Labels
docstring Related to docstring linting or formatting needs-decision Awaiting a decision from a maintainer rule Implementing or modifying a lint rule

Comments

@tjkuson
Copy link
Contributor

tjkuson commented Aug 23, 2024

Running ruff check --select DOC201 --preview --isolated on

class Foo:
    def __new__(cls, x: int) -> "Foo":
        """A very helpful docstring.

        Args:
            x: An integer.
        """
        ...  # Do something with x.
        return super().__new__(cls)

reports a docstring-missing-returns (DOC201) diagnostic.

The expected behaviour is that the return value of a __new__ method is not expected to be documented as it simply returns an instance of the class.

Related to #8085

Search terms: DOC201, docstring-missing-returns, __new__

@MichaReiser MichaReiser added rule Implementing or modifying a lint rule docstring Related to docstring linting or formatting needs-decision Awaiting a decision from a maintainer labels Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docstring Related to docstring linting or formatting needs-decision Awaiting a decision from a maintainer rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants