Skip to content

missing-public-init-documentation (PDF614)

Added in 1.0.0 Never fix By default

Part of the PDF rule category.

View source · View documentation source · Search issues

Fix is not available.

What it does

Checks for public __init__ methods that are missing docstrings.

The rule is separate from dunder-method checks so projects can select constructor documentation independently. An __init__ method is public when its containing class and containing module path are public.

Why is this useful?

Constructors often define required initialization arguments and side effects.

Ruff compatibility

This rule replaces Ruff's D107.

Examples

A public __init__ method without a docstring is reported:

class Client:
    """Client."""

    def __init__(self, timeout):
        self.timeout = timeout
PDF614: Line 4: Public __init__ method 'Client.__init__' is missing docstring

A documented public __init__ method is accepted:

class Client:
    """Client."""

    def __init__(self, timeout):
        """Initialize the client."""
        self.timeout = timeout

Other dunder methods are handled by PDF612 and PDF613 instead:

class Client:
    """Client."""

    def __str__(self):
        return "client"

Private owner chains are handled by PDF615 instead:

class _Client:
    """Client."""

    def __init__(self, timeout):
        self.timeout = timeout

Options