From 63a39fb9665eaf85852d92edec3ade4668a510af Mon Sep 17 00:00:00 2001 From: Jean Abou Samra Date: Wed, 23 Feb 2022 19:26:53 +0100 Subject: [PATCH] Add check for missing space after directive :: For example: .. versionadded::0.1 This is taken as a comment, thus no warning from docutils/Sphinx. This doesn't yield any false positives in CPython. Closes #7 --- sphinxlint.py | 6 ++++++ tests/fixtures/xfail/directive-missing-space.rst | 4 ++++ tests/fixtures/xpass/directive-no-arguments.rst | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 tests/fixtures/xfail/directive-missing-space.rst create mode 100644 tests/fixtures/xpass/directive-no-arguments.rst diff --git a/sphinxlint.py b/sphinxlint.py index 21a976b22..d796faf36 100755 --- a/sphinxlint.py +++ b/sphinxlint.py @@ -119,6 +119,10 @@ # .. versionchanged:: 3.6 three_dot_directive_re = re.compile(r"\.\.\. %s::" % all_directives) +# Find directive missing space after double colon, like: +# .. versionchanged::3.6 +missing_space_directive_re = re.compile(r"(?