diff --git a/pylint/config/arguments_provider.py b/pylint/config/arguments_provider.py index 6dfb4f1703..2ab44b1614 100644 --- a/pylint/config/arguments_provider.py +++ b/pylint/config/arguments_provider.py @@ -162,6 +162,9 @@ def options_by_section( (section, [list of (optname, optdict, optvalue)]) """ + # TODO 3.0: Make this function private see + # https://github.com/PyCQA/pylint/pull/6665#discussion_r880143229 + # It's only used in '_get_global_options_documentation' warnings.warn( "options_by_section has been deprecated. It will be removed " "in a future release.", diff --git a/pylint/utils/docs.py b/pylint/utils/docs.py index 9c051d4384..0995d5a68f 100644 --- a/pylint/utils/docs.py +++ b/pylint/utils/docs.py @@ -42,27 +42,31 @@ def _get_checkers_infos(linter: PyLinter) -> dict[str, dict[str, Any]]: return by_checker -def _get_checkers_documentation(linter: PyLinter) -> str: - """Get documentation for individual checkers.""" +def _get_global_options_documentation(linter: PyLinter) -> str: + """Get documentation for the main checker.""" result = get_rst_title("Pylint global options and switches", "-") result += """ Pylint provides global options and switches. """ for checker in linter.get_checkers(): - name = checker.name - if name == MAIN_CHECKER_NAME: - if checker.options: - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", category=DeprecationWarning) - for section, options in checker.options_by_section(): - if section is None: - title = "General options" - else: - title = f"{section.capitalize()} options" - result += get_rst_title(title, "~") - assert isinstance(options, list) - result += f"{get_rst_section(None, options)}\n" + if checker.name == MAIN_CHECKER_NAME and checker.options: + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=DeprecationWarning) + for section, options in checker.options_by_section(): + if section is None: + title = "General options" + else: + title = f"{section.capitalize()} options" + result += get_rst_title(title, "~") + assert isinstance(options, list) + result += f"{get_rst_section(None, options)}\n" + return result + + +def _get_checkers_documentation(linter: PyLinter) -> str: + """Get documentation for individual checkers.""" + result = _get_global_options_documentation(linter) result += get_rst_title("Pylint checkers' options and switches", "-") result += """\