Skip to content

False positive in D402 #3769

Description

@DeD1rk

I stumbled upon a false positive for pydocstyle's D402 (First line should not be the function's signature) in ruff 0.0.259, python 3.8.10.

I'm not sure what pydocstyle itself would do, but it seems incorrect even if pydocstyle would also be triggered:

class A(models.QuerySet):
    def b(self):
        """Call `C.b()` on something."""
        pass

Here the b(in the docstring seems to cause the violation. The rule is also triggered by """Call 'C.b(x)' on something.""", """Call 'b(' on something.""" and """Call 'b(a,c)' on something.""", but not if it does not contain b(.

Activity

  1. charliermarsh commented on Mar 28, 2023

    @charliermarsh
    Member

    Yeah FWIW pydocstyle also flags this. I can't think of a more reliable way to implement this off the top of my head while still catching a reasonable number of true positives.

  2. added
    docstringRelated to docstring linting, formatting, or rendering in Ruff or ty
    on Mar 28, 2023
  3. MichaReiser commented on Aug 5, 2026

    @MichaReiser
    Member

    See #13388

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docstringRelated to docstring linting, formatting, or rendering in Ruff or ty

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions