Skip to content

Add --ignore-private and --ignore-uncommented flag support #35

Description

@zwimer

Just like there is an --ignore-magic flag, it would be nice if there were an --ignore-private and --ignore-uncommented flags.

Per the README for --ignore-magic:

Exclude dunder methods such as init, str, repr, eq, etc. from docstring generation. These are often implementation details that add noise rather than value to public documentation:

I'd say this statement can very much hold true for private or completely uncommented methods. For example, a small private method that is only briefly made to avoid code-deduplication by a printing function:

def _format(index: int, x: MyType) -> str:
    return f"{index}: {x}"

def print_stuff(stuff: Stuff) -> None:
    ...
    print(_format(1, x) + "\n" + _format(2, y))

In this case, adding a multi-line docstring would be unnecessary bloat.

Additionally, docstrings generated from completely uncommented might not be useful/helpful depending on why they are needed; A docstring with zero human comments might be useful for some program analyzing the system or metrics, but if they are being written for human eyes, since they are generated from the function signature, they might make it harder to read; i.e. "add noise rather than value to public documentation".

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions