class documentation

class DocstringParameterChecker(BaseChecker): (source)

View In Hierarchy

Checker for Sphinx, Google, or Numpy style docstrings. * Check that all function, method and constructor parameters are mentioned in the params and types part of the docstring. Constructor parameters can be documented in either the class docstring or ``__init__`` docstring, but not both. * Check that there are no naming inconsistencies between the signature and the documentation, i.e. also report documented parameters that are missing in the signature. This is important to find cases where parameters are renamed only in the code, not in the documentation. * Check that all explicitly raised exceptions in a function are documented in the function docstring. Caught exceptions are ignored. Activate this checker by adding the line:: load-plugins=pylint.extensions.docparams to the ``MAIN`` section of your ``.pylintrc``.

Method check_arguments_in_docstring Check that all parameters are consistent with the parameters mentioned in the parameter documentation (e.g. the Sphinx tags 'param' and 'type').
Method check_functiondef_params Undocumented
Method check_functiondef_returns Undocumented
Method check_functiondef_yields Undocumented
Method check_single_constructor_params Undocumented
Method visit_functiondef Called for function and method definitions (def).
Method visit_raise Undocumented
Method visit_return Undocumented
Method visit_yield Undocumented
Class Variable constructor_names Undocumented
Class Variable msgs Undocumented
Class Variable name Name of the provider.
Class Variable not_needed_param_in_docstring Undocumented
Class Variable options Options provided by this provider.
Method _add_raise_message Adds a message on :param:`node` for the missing exception type.
Method _compare_different_args Compare the found argument names with the expected ones and generate a message if there are extra arguments found.
Method _compare_ignored_args Compare the found argument names with the ignored ones and generate a message if there are ignored arguments found.
Method _compare_missing_args Compare the found argument names with the expected ones and generate a message if there are arguments missing.

Inherited from BaseChecker:

Method __eq__ Permit to assert Checkers are equal.
Method __gt__ Sorting of checkers.
Method __hash__ Make Checker hashable.
Method __init__ Checker instances should have the linter as argument.
Method __repr__ Undocumented
Method __str__ This might be incomplete because multiple classes inheriting BaseChecker can have the same name.
Method add_message Undocumented
Method check_consistency Check the consistency of msgid.
Method close Called after visiting project (i.e set of modules).
Method create_message_definition_from_tuple Undocumented
Method get_full_documentation Undocumented
Method get_map_data Undocumented
Method get_message_definition Undocumented
Method open Called before visiting project (i.e. set of modules).
Method reduce_map_data Undocumented
Class Variable enabled Undocumented
Class Variable reports Undocumented
Instance Variable linter Undocumented
Property messages Undocumented

Inherited from _ArgumentsProvider (via BaseChecker):

Method get_option_def DEPRECATED: Return the dictionary defining an option given its name.
Method level.setter Undocumented
Method load_defaults DEPRECATED: Initialize the provider using default values.
Method option_attrname DEPRECATED: Get the config attribute corresponding to opt.
Method option_value DEPRECATED: Get the current value for the given option.
Method options_and_values DEPRECATED.
Method options_by_section DEPRECATED: Return an iterator on options grouped by section.
Method set_option DEPRECATED: Method called to set an option (registered in the options list).
Class Variable option_groups_descs Option groups of this provider and their descriptions.
Property config Undocumented
Property level Undocumented
Instance Variable _arguments_manager The manager that will parse and register any options provided.
Instance Variable _level Undocumented
def check_arguments_in_docstring(self, doc: Docstring, arguments_node: astroid.Arguments, warning_node: astroid.NodeNG, accept_no_param_doc: bool|None = None): (source)

Check that all parameters are consistent with the parameters mentioned in the parameter documentation (e.g. the Sphinx tags 'param' and 'type'). * Undocumented parameters except 'self' are noticed. * Undocumented parameter types except for 'self' and the ``*<args>`` and ``**<kwargs>`` parameters are noticed. * Parameters mentioned in the parameter documentation that don't or no longer exist in the function parameter list are noticed. * If the text "For the parameters, see" or "For the other parameters, see" (ignoring additional white-space) is mentioned in the docstring, missing parameter documentation is tolerated. * If there's no Sphinx style, Google style or NumPy style parameter documentation at all, i.e. ``:param`` is never mentioned etc., the checker assumes that the parameters are documented in another format and the absence is tolerated. :param doc: Docstring for the function, method or class. :type doc: :class:`Docstring` :param arguments_node: Arguments node for the function, method or class constructor. :type arguments_node: :class:`astroid.scoped_nodes.Arguments` :param warning_node: The node to assign the warnings to :type warning_node: :class:`astroid.scoped_nodes.Node` :param accept_no_param_doc: Whether to allow no parameters to be documented. If None then this value is read from the configuration. :type accept_no_param_doc: bool or None

def check_functiondef_params(self, node: nodes.FunctionDef, node_doc: Docstring): (source)

Undocumented

def check_functiondef_returns(self, node: nodes.FunctionDef, node_doc: Docstring): (source)

Undocumented

def check_functiondef_yields(self, node: nodes.FunctionDef, node_doc: Docstring): (source)

Undocumented

def check_single_constructor_params(self, class_doc: Docstring, init_doc: Docstring, class_node: nodes.ClassDef): (source)

Undocumented

def visit_functiondef(self, node: nodes.FunctionDef): (source)

Called for function and method definitions (def). :param node: Node for a function or method definition in the AST :type node: :class:`astroid.scoped_nodes.Function`

def visit_raise(self, node: nodes.Raise): (source)

Undocumented

def visit_return(self, node: nodes.Return): (source)

Undocumented

def visit_yield(self, node: nodes.Yield|nodes.YieldFrom): (source)

Undocumented

constructor_names: set[str] = (source)

Undocumented

Name of the provider.

not_needed_param_in_docstring: set[str] = (source)

Undocumented

Options provided by this provider.

def _add_raise_message(self, missing_exceptions: set[str], node: nodes.FunctionDef): (source)

Adds a message on :param:`node` for the missing exception type. :param missing_exceptions: A list of missing exception types. :param node: The node show the message on.

def _compare_different_args(self, found_argument_names: set[str], message_id: str, not_needed_names: set[str], expected_argument_names: set[str], warning_node: nodes.NodeNG): (source)

Compare the found argument names with the expected ones and generate a message if there are extra arguments found. :param found_argument_names: argument names found in the docstring :param message_id: pylint message id :param not_needed_names: names that may be omitted :param expected_argument_names: Expected argument names :param warning_node: The node to be analyzed

def _compare_ignored_args(self, found_argument_names: set[str], message_id: str, ignored_argument_names: set[str], warning_node: nodes.NodeNG): (source)

Compare the found argument names with the ignored ones and generate a message if there are ignored arguments found. :param found_argument_names: argument names found in the docstring :param message_id: pylint message id :param ignored_argument_names: Expected argument names :param warning_node: The node to be analyzed

def _compare_missing_args(self, found_argument_names: set[str], message_id: str, not_needed_names: set[str], expected_argument_names: set[str], warning_node: nodes.NodeNG): (source)

Compare the found argument names with the expected ones and generate a message if there are arguments missing. :param found_argument_names: argument names found in the docstring :param message_id: pylint message id :param not_needed_names: names that may be omitted :param expected_argument_names: Expected argument names :param warning_node: The node to be analyzed