Skip to content

Commit

Permalink
[doc] Add the possible values for options as a comment
Browse files Browse the repository at this point in the history
In the generated toml documentation.
  • Loading branch information
Pierre-Sassoulas committed Aug 13, 2023
1 parent 0791f17 commit b02a5d7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/exts/pylint_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ def _create_checker_section(
checker_table.add(tomlkit.nl())
continue

# Display possible choices
choices = option.optdict.get("choices", "")
if choices:
checker_table.add(tomlkit.comment(f"Possible choices: {choices}"))

# Tomlkit doesn't support regular expressions
if isinstance(value, re.Pattern):
value = value.pattern
Expand Down
15 changes: 15 additions & 0 deletions doc/user_guide/configuration/all-options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,12 @@ Standard Checkers
.. code-block:: toml
[tool.pylint.basic]
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
argument-naming-style = "snake_case"
# argument-rgx =
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
attr-naming-style = "snake_case"
# attr-rgx =
Expand All @@ -550,24 +552,29 @@ Standard Checkers
bad-names-rgxs = []
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
class-attribute-naming-style = "any"
# class-attribute-rgx =
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
class-const-naming-style = "UPPER_CASE"
# class-const-rgx =
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
class-naming-style = "PascalCase"
# class-rgx =
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
const-naming-style = "UPPER_CASE"
# const-rgx =
docstring-min-length = -1
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
function-naming-style = "snake_case"
# function-rgx =
Expand All @@ -578,14 +585,17 @@ Standard Checkers
include-naming-hint = false
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
inlinevar-naming-style = "any"
# inlinevar-rgx =
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
method-naming-style = "snake_case"
# method-rgx =
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
module-naming-style = "snake_case"
# module-rgx =
Expand All @@ -600,6 +610,7 @@ Standard Checkers
# typevar-rgx =
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
variable-naming-style = "snake_case"
# variable-rgx =
Expand Down Expand Up @@ -919,6 +930,7 @@ Standard Checkers
.. code-block:: toml
[tool.pylint.format]
# Possible choices: ['', 'LF', 'CRLF']
expected-line-ending-format = ""
ignore-long-lines = "^\\s*(# )?<?https?://\\S+>?$"
Expand Down Expand Up @@ -1083,6 +1095,7 @@ Standard Checkers
.. code-block:: toml
[tool.pylint.logging]
# Possible choices: ['old', 'new']
logging-format-style = "old"
logging-modules = ["logging"]
Expand Down Expand Up @@ -1331,6 +1344,7 @@ Standard Checkers
[tool.pylint.spelling]
max-spelling-suggestions = 4
# Possible choices: ['', 'en', 'en_AU', 'en_CA', 'en_GB', 'en_US']
spelling-dict = ""
spelling-ignore-comment-directives = "fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:"
Expand Down Expand Up @@ -1829,6 +1843,7 @@ Extensions
accept-no-yields-doc = true
# Possible choices: ['sphinx', 'epytext', 'google', 'numpy', 'default']
default-docstring-type = "default"
Expand Down

0 comments on commit b02a5d7

Please sign in to comment.