Skip to content

missing-private-class-documentation (PDF605)

Added in 1.0.0 Never fix Requires explicit

Part of the PDF rule category.

View source · View documentation source · Search issues

Fix is not available.

Rule must by default be explicitly selected, unless it is removed from require-explicit.

What it does

Checks for private top-level classes that are missing docstrings.

A top-level class is private when its own name or containing module path is private.

Why is this useful?

Private classes can still benefit from local documentation when a project chooses to require it.

Ruff compatibility

None.

Examples

A private top-level class without a docstring is reported:

class _Client:
    pass
PDF605: Line 1: Private class '_Client' is missing docstring

A public-looking class in a private module path is private:

class Client:
    pass
PDF605: Line 1: Private class 'Client' is missing docstring

A documented private top-level class is accepted:

class _Client:
    """Internal client."""

Public top-level classes are handled by PDF604 instead:

class Client:
    pass

Options

None.