Skip to content

Commit 501fa08

Browse files
committed
Remove redundant options documentation and improve formatting
1 parent bdd470d commit 501fa08

File tree

8 files changed

+360
-1426
lines changed

8 files changed

+360
-1426
lines changed

doc/exts/pylint_extensions.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ def builder_inited(app: Optional[Sphinx]) -> None:
8383
if i == max_len - 1:
8484
# Remove the \n\n at the end of the file
8585
j = -3
86-
print(checker.get_full_documentation(**information)[:j], file=stream)
86+
print(
87+
checker.get_full_documentation(**information, show_options=False)[:j],
88+
file=stream,
89+
)
8790

8891

8992
def get_plugins_info(linter, doc_files):

doc/exts/pylint_features.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def builder_inited(app: Optional[Sphinx]) -> None:
3636
3737
"""
3838
)
39-
print_full_documentation(linter, stream)
39+
print_full_documentation(linter, stream, False)
4040

4141

4242
def setup(app):

doc/exts/pylint_options.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def _get_all_options(linter: PyLinter) -> OptionsDataDict:
6666
def _create_checker_section(
6767
checker: str, options: list[OptionsData], linter: PyLinter
6868
) -> str:
69-
checker_string = get_rst_title(f"``{checker.capitalize()}`` Checker", "^")
69+
checker_string = get_rst_title(f"``{checker.capitalize()}`` **Checker**", "-")
70+
7071
toml_doc = tomlkit.document()
7172
pylint_tool_table = tomlkit.table(is_super_table=True)
7273
toml_doc.add(tomlkit.key(["tool", "pylint"]), pylint_tool_table)
@@ -75,11 +76,11 @@ def _create_checker_section(
7576

7677
for option in sorted(options, key=lambda x: x.name):
7778
checker_string += get_rst_title(f"--{option.name}", '"')
78-
checker_string += f"\nDescription:\n *{option.optdict.get('help')}*\n\n"
79+
checker_string += f"*{option.optdict.get('help')}*\n\n"
7980
if option.optdict.get("default") == "":
80-
checker_string += 'Default:\n ``""``\n\n\n'
81+
checker_string += '**Default:** ``""``\n\n\n'
8182
else:
82-
checker_string += f"Default:\n ``{option.optdict.get('default')}``\n\n\n"
83+
checker_string += f"**Default:** ``{option.optdict.get('default')}``\n\n\n"
8384

8485
# Start adding the option to the toml example
8586
if option.optdict.get("hide_from_config_file"):
@@ -138,13 +139,13 @@ def _write_options_page(options: OptionsDataDict, linter: PyLinter) -> None:
138139
".. This file is auto-generated. Make any changes to the associated\n"
139140
".. docs extension in 'doc/exts/pylint_options.py'.\n\n"
140141
".. _all-options:",
141-
get_rst_title("Standard Checkers:", "^"),
142+
get_rst_title("Standard Checkers", "^"),
142143
]
143144
found_extensions = False
144145

145146
for checker, checker_options in options.items():
146147
if not found_extensions and checker_options[0].extension:
147-
sections.append(get_rst_title("Extensions:", "^"))
148+
sections.append(get_rst_title("Extensions", "^"))
148149
found_extensions = True
149150
sections.append(_create_checker_section(checker, checker_options, linter))
150151

doc/user_guide/checkers/extensions.rst

-68
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ Broad Try Clause checker
4242
This checker is provided by ``pylint.extensions.broad_try_clause``.
4343
Verbatim name of the checker is ``broad_try_clause``.
4444

45-
Broad Try Clause checker Options
46-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47-
:max-try-statements:
48-
Maximum number of statements allowed in a try clause
49-
50-
Default: ``1``
51-
5245
Broad Try Clause checker Messages
5346
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5447
:too-many-try-statements (W0717):
@@ -69,13 +62,6 @@ Checkers that can improve code consistency.
6962
As such they don't necessarily provide a performance benefit and
7063
are often times opinionated.
7164

72-
Code Style checker Options
73-
^^^^^^^^^^^^^^^^^^^^^^^^^^
74-
:max-line-length-suggestions:
75-
Max line length for which to sill emit suggestions. Used to prevent optional
76-
suggestions which would get split by a code formatter (e.g., black). Will
77-
default to the setting for ``max-line-length``.
78-
7965
Code Style checker Messages
8066
^^^^^^^^^^^^^^^^^^^^^^^^^^^
8167
:consider-using-tuple (R6102): *Consider using an in-place tuple instead of list*
@@ -202,13 +188,6 @@ you can use the ``bad-functions`` option::
202188
$ pylint a.py --load-plugins=pylint.extensions.bad_builtin --bad-functions=apply,reduce
203189
...
204190

205-
Deprecated Builtins checker Options
206-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
207-
:bad-functions:
208-
List of builtins function names that should not be used, separated by a comma
209-
210-
Default: ``map,filter``
211-
212191
Deprecated Builtins checker Messages
213192
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
214193
:bad-builtin (W0141): *Used builtin function %s*
@@ -265,13 +244,6 @@ higher than a preestablished value, which can be controlled through the
265244
$ pylint a.py --load-plugins=pylint.extensions.mccabe --max-complexity=50
266245
$
267246

268-
Design checker Options
269-
^^^^^^^^^^^^^^^^^^^^^^
270-
:max-complexity:
271-
McCabe complexity cyclomatic threshold
272-
273-
Default: ``10``
274-
275247
Design checker Messages
276248
^^^^^^^^^^^^^^^^^^^^^^^
277249
:too-complex (R1260): *%s is too complex. The McCabe rating is %d*
@@ -550,34 +522,6 @@ docstring defining the interface, e.g. a superclass method, after "see"::
550522
Naming inconsistencies in existing parameter and their type documentations are
551523
still detected.
552524

553-
Parameter Documentation checker Options
554-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
555-
:accept-no-param-doc:
556-
Whether to accept totally missing parameter documentation in the docstring of
557-
a function that has parameters.
558-
559-
Default: ``yes``
560-
:accept-no-raise-doc:
561-
Whether to accept totally missing raises documentation in the docstring of a
562-
function that raises an exception.
563-
564-
Default: ``yes``
565-
:accept-no-return-doc:
566-
Whether to accept totally missing return documentation in the docstring of a
567-
function that returns a statement.
568-
569-
Default: ``yes``
570-
:accept-no-yields-doc:
571-
Whether to accept totally missing yields documentation in the docstring of a
572-
generator.
573-
574-
Default: ``yes``
575-
:default-docstring-type:
576-
If the docstring type cannot be guessed the specified docstring type will be
577-
used.
578-
579-
Default: ``default``
580-
581525
Parameter Documentation checker Messages
582526
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
583527
:differing-param-doc (W9017): *"%s" differing in parameter documentation*
@@ -667,18 +611,6 @@ Typing checker Documentation
667611
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
668612
Find issue specifically related to type annotations.
669613

670-
Typing checker Options
671-
^^^^^^^^^^^^^^^^^^^^^^
672-
:runtime-typing:
673-
Set to ``no`` if the app / library does **NOT** need to support runtime
674-
introspection of type annotations. If you use type annotations
675-
**exclusively** for type checking of an application, you're probably fine.
676-
For libraries, evaluate if some users what to access the type hints at
677-
runtime first, e.g., through ``typing.get_type_hints``. Applies to Python
678-
versions 3.7 - 3.9
679-
680-
Default: ``yes``
681-
682614
Typing checker Messages
683615
^^^^^^^^^^^^^^^^^^^^^^^
684616
:broken-noreturn (E6004): *'NoReturn' inside compound types is broken in 3.7.0 / 3.7.1*

0 commit comments

Comments
 (0)