File tree Expand file tree Collapse file tree 3 files changed +35
-6
lines changed Expand file tree Collapse file tree 3 files changed +35
-6
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ RST216 Multiple roles in interpreted text (both prefix and suffix present; only
109
109
RST217 Mismatch: both interpreted text role suffix and reference suffix.
110
110
RST218 Literal block expected; none found.
111
111
RST219 Inline substitution_reference start-string without end-string.
112
+ RST220
112
113
RST299 Previously unseen warning, not yet assigned a unique code.
113
114
====== =======================================================================
114
115
@@ -245,7 +246,8 @@ Version History
245
246
======= ========== ===========================================================
246
247
Version Released Changes
247
248
------- ---------- -----------------------------------------------------------
248
- v0.3.1 *Pending * - Requires Python 3.8 or later (no code changes).
249
+ v0.3.1 *Pending * - Adds ``RST220 `` for redefined anonymous links.
250
+ - Requires Python 3.8 or later (no code changes).
249
251
v0.3.0 2022-11-16 - Replaced ``setup.py `` with ``pyproject.toml ``.
250
252
v0.2.7 2022-07-15 - Fix where function signature occurred in docstring body.
251
253
v0.2.6 2022-06-07 - Configuration option to define additional substitutions
Original file line number Diff line number Diff line change 63
63
"Mismatch: both interpreted text role suffix and reference suffix." : 17 ,
64
64
"Literal block expected; none found." : 18 ,
65
65
"Inline substitution_reference start-string without end-string." : 19 ,
66
+ 'Duplicate explicit target name: "*".' : 20 ,
66
67
}
67
68
68
69
# Level 3 - error
@@ -224,11 +225,12 @@ def run(self):
224
225
- ast .get_docstring (node , clean = False ).count ("\n " )
225
226
- 1
226
227
)
227
- assert (
228
- node .body [0 ].lineno >= 1 and start >= 0
229
- ), "Bad start line, node line number %i for: %s\n " % (
230
- node .body [0 ].lineno ,
231
- docstring ,
228
+ assert node .body [0 ].lineno >= 1 and start >= 0 , (
229
+ "Bad start line, node line number %i for: %s\n "
230
+ % (
231
+ node .body [0 ].lineno ,
232
+ docstring ,
233
+ )
232
234
)
233
235
for rst_error in rst_errors :
234
236
# TODO - make this a configuration option?
Original file line number Diff line number Diff line change
1
+ """Print 'Hello world' to the terminal.
2
+
3
+ It is common in RST to use unnamed or anonymous links in text (like
4
+ `here <https://example.com/t-and-c/>`__ and `here
5
+ <https://example.org/co-op-rules.html>`__), but they should have two trailing
6
+ underscores!
7
+
8
+ You *can* use a `single trailing underscore <https://example.com/links.html>`_
9
+ but it is treated as an implicitly named link. You can use the exact same link
10
+ text and URL again too (`single trailing underscore
11
+ <https://example.com/links.html>`_).
12
+
13
+ However, the missing second underscore becomes a problem if the same link text
14
+ is used again for another implicitly named link weth a different URL (e.g.
15
+ missing `single trailing underscore <https://example.com/bad.html>`_ *again*).
16
+
17
+ What happens here?
18
+
19
+ $ flake8 --select RST RST220/dup_explicit_target.py
20
+ RST220/dup_explicit_target.py:15:1: RST220 Duplicate explicit target name: "single trailing underscore".
21
+
22
+ This file triggers an error when the implicitly named link is redefined.
23
+ """
24
+
25
+ print ("Hello world" )
You can’t perform that action at this time.
0 commit comments