Skip to content

Allow one way (allow raises docs even if they don't exist in the body) skip for checking raises #283

Description

@armanckeser

Currently the option -scr works as follows:

  1. --skip-checking-raises (shortform: -scr, default: False)
    If True, pydoclint won’t report DOC501 or DOC502 if there are raise statements in the function/method but there aren’t any “raises” sections in the docstring (or vice versa).

The vice versa part means that

def my_func():
	"""Simple func

	Raises:
		Exception: underlying function might raise
	"""
	might_raise_exception()

the above will fail pydoclint with skip-checking-raises=false.

I understand that pydoclint doesn't want to add dynamic or dynamic-ish checks to keep performance, so its unlikely for a feature like "capture all possible exceptions from the source code up and force documentation" to exist, however with the all or nothing approach, -scr option somewhat disincentivizes documenting pass-through exceptions as it would require wrapping logic in try-except-raise.

It would be nice to allow a one way option, where pydoclint forces you to document exceptions you raise in the body, but also allows you to mention any other exception.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions