Skip to content

Commit ee3b66a

Browse files
committed
Define RST219 Inline substitution_reference start-string without end-string.
1 parent 77efbf4 commit ee3b66a

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ RST215 Inline interpreted text or phrase reference start-string without end-stri
106106
RST216 Multiple roles in interpreted text (both prefix and suffix present; only one allowed).
107107
RST217 Mismatch: both interpreted text role suffix and reference suffix.
108108
RST218 Literal block expected; none found.
109+
RST219 Inline substitution_reference start-string without end-string.
109110
RST299 Previously unseen warning, not yet assigned a unique code.
110111
====== =======================================================================
111112

@@ -219,7 +220,7 @@ Version History
219220
======= ========== ===========================================================
220221
Version Released Changes
221222
------- ---------- -----------------------------------------------------------
222-
v0.0.13 2019-12-26 - Adds ``RST218``.
223+
v0.0.13 2019-12-26 - Adds ``RST218`` and ``RST219``.
223224
v0.0.12 2019-11-18 - Adds ``RST213`` to ``RST217``.
224225
v0.0.11 2019-08-07 - Configuration options to define additional directives and
225226
roles (e.g. from Sphinx) for ``RST303`` and ``RST304``.

flake8_rst_docstrings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ def tokenize_open(filename):
177177
"Multiple roles in interpreted text (both prefix and suffix present; only one allowed).": 16, # noqa: E501
178178
"Mismatch: both interpreted text role suffix and reference suffix.": 17,
179179
"Literal block expected; none found.": 18,
180+
"Inline substitution_reference start-string without end-string.": 19,
180181
}
181182

182183
# Level 3 - error

tests/RST219/bad_sub_ref.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
r"""Print 'Hello world' to the terminal.
2+
3+
RST supports inline substitution references,
4+
and the string |000...00> looks a bit like one
5+
so triggers an error:
6+
7+
$ flake8 --select RST RST219/bad_sub_ref.py
8+
RST219/bad_sub_ref.py:4:1: RST219 Inline substitution_reference start-string without end-string
9+
10+
One potential way to avoid this using ``|000...00>``
11+
instead (wrapping in backticks as a inline literal).
12+
13+
Better, escape the opening pipe as \|000...00>
14+
instead.
15+
"""
16+
17+
print("Hello world")

0 commit comments

Comments
 (0)