Skip to content

Commit 881077f

Browse files
committed
Define RST308
1 parent 60bb674 commit 881077f

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ RST304 Unknown interpreted text role "XXX".
125125
RST305 Undefined substitution referenced: "XXX".
126126
RST306 Unknown target name: "XXX".
127127
RST307 Error in "XXX" directive:
128+
RST308 Duplicate target name, cannot be used as a unique reference: "XXX".
128129
RST399 Previously unseen major error, not yet assigned a unique code.
129130
====== =======================================================================
130131

@@ -246,7 +247,9 @@ Version History
246247
======= ========== ===========================================================
247248
Version Released Changes
248249
------- ---------- -----------------------------------------------------------
249-
v0.4.0 *Pending* - Requires Python 3.9 or later.
250+
v0.4.0 *Pending* - Tested with docutils v0.22.2
251+
- Adds `RST308` for duplicated target names.
252+
- Requires Python 3.9 or later.
250253
v0.3.1 2025-04-29 - Adds ``RST220`` for redefined anonymous links.
251254
- Requires Python 3.8 or later (no code changes).
252255
v0.3.0 2022-11-16 - Replaced ``setup.py`` with ``pyproject.toml``.

flake8_rst_docstrings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
'Unknown target name: "*".': 6,
8181
# e.g. Error in "code" directive:
8282
'Error in "*" directive:': 7,
83+
# e.g. Duplicate target name, cannot be used as a unique reference: "python".
84+
'Duplicate target name, cannot be used as a unique reference: "*".': 8,
8385
}
8486

8587
# Level 4 - severe

tests/RST220/dup_explicit_target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
What happens here?
77
88
$ flake8 --select RST RST220/dup_explicit_target.py
9-
RST220/dup_explicit_target.py:3:1: RST399 Duplicate target name, cannot be used as a unique reference: "python".
9+
RST220/dup_explicit_target.py:3:1: RST308 Duplicate target name, cannot be used as a unique reference: "python".
1010
RST220/dup_explicit_target.py:15:1: RST220 Duplicate explicit target name: "python".
1111
1212
This file triggers an error as there are repeated conflicting definitions:

0 commit comments

Comments
 (0)