interrogate

1.7.0 · active · verified Sat Apr 11

interrogate checks your Python codebase for missing docstrings. It aims to make documentation as important as code itself by highlighting methods, functions, classes, and modules that lack docstrings. This tool, currently at version 1.7.0, helps developers understand docstring coverage, enforce documentation in CI/CD pipelines, and assess code quality and maintainability. It supports Python 3.8 and above, with a moderate release cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a simple Python module and then run `interrogate` against it from the command line, showing basic usage, verbose output, and common options like ignoring `__init__` methods and setting a custom failure threshold.

mkdir my_project
cd my_project
cat <<EOF > my_module.py
"""A module-level docstring."""

def my_function(a, b):
    # Missing docstring
    return a + b

class MyClass:
    """A class with a docstring."""
    def __init__(self):
        # Missing __init__ docstring
        pass

    def my_method(self):
        """A method with a docstring."""
        pass
EOF

# Run interrogate with default settings (fail-under 80%)
interrogate my_module.py

# Run with verbose output to see details of missing docstrings
interrogate -vv my_module.py

# Run and ignore __init__ methods, and set a custom fail-under percentage
interrogate --ignore-init-method --fail-under 100 my_module.py

view raw JSON →