Skip to content

Docs that restate the name ("""Get the user.""", name: The name., @returns The result.) ​

Comments and text: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as narration.

What makes docs that restate the name a bad practice? ​

The standards that call it a bad practice: Clean Code: Mandated Comments; Google Python Style Guide (no types in docstrings where annotations exist).

What does lessloc do about docs that restate the name? ​

lessloc catches it as narration.

  • narration (tier 3): Comments that narrate the code, decorate it or restate a name, closing-brace comments, and log lines that narrate each step.

Examples ​

Caught as narration:

python
def ship(order, carrier):
    """Ship an order.

    Args:
        order: The order.
        carrier: The carrier.
    """
    return order

Written well:

python
def ship(order, carrier):
    """Hand the order to the carrier; raises if the address is unverified.

    Args:
        carrier: one of "ups", "dhl"; anything else ships by post.
    """
    return order

The other patterns in Comments and text:

Released under the Apache-2.0 license. · llms.txt