Skip to content

Commit 856ee58

Browse files
committed
Define configuration options
1 parent fa96014 commit 856ee58

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

flake8_rst_docstrings.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,32 @@ def __init__(self, tree, filename="(none)"):
976976
self.source = None
977977
self.err = err
978978

979+
@classmethod
980+
def add_options(cls, parser):
981+
"""Add RST directives and roles options."""
982+
parser.add_option(
983+
"--rst-directives",
984+
metavar="LIST",
985+
default="",
986+
parse_from_config=True,
987+
comma_separated_list=True,
988+
help="Comma-separated list of additional RST directives.",
989+
)
990+
parser.add_option(
991+
"--rst-roles",
992+
metavar="LIST",
993+
default="",
994+
parse_from_config=True,
995+
comma_separated_list=True,
996+
help="Comma-separated list of additional RST roles.",
997+
)
998+
999+
@classmethod
1000+
def parse_options(cls, options):
1001+
"""Adding black-config option."""
1002+
cls.extra_directives = options.rst_directives
1003+
cls.extra_roles = options.rst_roles
1004+
9791005
def run(self):
9801006
"""Use docutils to check docstrings are valid RST."""
9811007
# Is there any reason not to call load_source here?

tests/run_tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ echo "flake8 --select RST test_cases/"
2626
flake8 --select RST test_cases/
2727
echo "Good, no RST style violations reported, as expected."
2828

29+
echo "========="
30+
echo "Help text"
31+
echo "========="
32+
flake8 -h | grep -i RST
33+
echo "Good, RST options appear in the help text"
34+
2935
echo "============"
3036
echo "Tests passed"
3137
echo "============"

0 commit comments

Comments
 (0)