Skip to content

Commit dbaf98f

Browse files
[doc] Add the possible values for option as a comment
1 parent c4dda40 commit dbaf98f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

doc/exts/pylint_options.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class OptionsData(NamedTuple):
4343
# At least default need to be defined
4444
"py-version": {"default": "sys.version_info[:2]"},
4545
"spelling-dict": {
46-
"choices": "enchant.Broker().list_dicts()",
46+
"choices": "Values from 'enchant.Broker().list_dicts()' depending on local enchant installation",
4747
"default": "",
4848
"help": "Spelling dictionary name. Available dictionaries depends on your local enchant installation",
4949
},
@@ -120,6 +120,11 @@ def _create_checker_section(
120120
checker_table.add(tomlkit.nl())
121121
continue
122122

123+
# Display possible choices
124+
choices = option.optdict.get("choices", "")
125+
if choices:
126+
checker_table.add(tomlkit.comment(f"Possible choices: {choices}"))
127+
123128
# Tomlkit doesn't support regular expressions
124129
if isinstance(value, re.Pattern):
125130
value = value.pattern

doc/user_guide/configuration/all-options.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,10 +538,12 @@ Standard Checkers
538538
.. code-block:: toml
539539
540540
[tool.pylint.basic]
541+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
541542
argument-naming-style = "snake_case"
542543
543544
# argument-rgx =
544545
546+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
545547
attr-naming-style = "snake_case"
546548
547549
# attr-rgx =
@@ -550,24 +552,29 @@ Standard Checkers
550552
551553
bad-names-rgxs = []
552554
555+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
553556
class-attribute-naming-style = "any"
554557
555558
# class-attribute-rgx =
556559
560+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
557561
class-const-naming-style = "UPPER_CASE"
558562
559563
# class-const-rgx =
560564
565+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
561566
class-naming-style = "PascalCase"
562567
563568
# class-rgx =
564569
570+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
565571
const-naming-style = "UPPER_CASE"
566572
567573
# const-rgx =
568574
569575
docstring-min-length = -1
570576
577+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
571578
function-naming-style = "snake_case"
572579
573580
# function-rgx =
@@ -578,14 +585,17 @@ Standard Checkers
578585
579586
include-naming-hint = false
580587
588+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
581589
inlinevar-naming-style = "any"
582590
583591
# inlinevar-rgx =
584592
593+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
585594
method-naming-style = "snake_case"
586595
587596
# method-rgx =
588597
598+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
589599
module-naming-style = "snake_case"
590600
591601
# module-rgx =
@@ -600,6 +610,7 @@ Standard Checkers
600610
601611
# typevar-rgx =
602612
613+
# Possible choices: ['snake_case', 'camelCase', 'PascalCase', 'UPPER_CASE', 'any']
603614
variable-naming-style = "snake_case"
604615
605616
# variable-rgx =
@@ -919,6 +930,7 @@ Standard Checkers
919930
.. code-block:: toml
920931
921932
[tool.pylint.format]
933+
# Possible choices: ['', 'LF', 'CRLF']
922934
expected-line-ending-format = ""
923935
924936
ignore-long-lines = "^\\s*(# )?<?https?://\\S+>?$"
@@ -1083,6 +1095,7 @@ Standard Checkers
10831095
.. code-block:: toml
10841096
10851097
[tool.pylint.logging]
1098+
# Possible choices: ['old', 'new']
10861099
logging-format-style = "old"
10871100
10881101
logging-modules = ["logging"]
@@ -1331,6 +1344,7 @@ Standard Checkers
13311344
[tool.pylint.spelling]
13321345
max-spelling-suggestions = 4
13331346
1347+
# Possible choices: Values from 'enchant.Broker().list_dicts()' depending on local enchant installation
13341348
spelling-dict = ""
13351349
13361350
spelling-ignore-comment-directives = "fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:"
@@ -1829,6 +1843,7 @@ Extensions
18291843
18301844
accept-no-yields-doc = true
18311845
1846+
# Possible choices: ['sphinx', 'epytext', 'google', 'numpy', 'default']
18321847
default-docstring-type = "default"
18331848
18341849

0 commit comments

Comments
 (0)