missing-raises-doc / W9006ΒΆ
Message emitted:
"%s" not documented as being raised
Description:
Please document exceptions for all raised exception types.
Problematic code:
def integer_sum(a: int, b: int): # [missing-raises-doc]
"""Returns sum of two integers
:param a: first integer
:param b: second integer
"""
if not (isinstance(a, int) and isinstance(b, int)):
raise ValueError("Function supports only integer parameters.")
return a + b
Correct code:
def integer_sum(a: int, b: int):
"""Returns sum of two integers
:param a: first integer
:param b: second integer
:raises ValueError: One of the parameters is not an integer.
"""
if not (isinstance(a, int) and isinstance(b, int)):
raise ValueError("Function supports only integer parameters.")
return a + b
Configuration file:
[MAIN]
load-plugins = pylint.extensions.docparams
[BASIC]
accept-no-raise-doc = no
Note
This message is emitted by the optional 'parameter_documentation'
checker, which requires the pylint.extensions.docparams
plugin to be loaded.
Created by the parameter_documentation checker.