Skip to content

Commit 8cf83d4

Browse files
committed
RST401 now RST309 (downgraded in docutils v0.22)
1 parent 881077f commit 8cf83d4

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ RST305 Undefined substitution referenced: "XXX".
126126
RST306 Unknown target name: "XXX".
127127
RST307 Error in "XXX" directive:
128128
RST308 Duplicate target name, cannot be used as a unique reference: "XXX".
129+
RST309 Unexpected section title. *(replaced RST401 in docutils v0.22)*
129130
RST399 Previously unseen major error, not yet assigned a unique code.
130131
====== =======================================================================
131132

@@ -134,7 +135,7 @@ Severe or critical error codes:
134135
====== =======================================================================
135136
Code Description
136137
------ -----------------------------------------------------------------------
137-
RST401 Unexpected section title.
138+
RST401 Unexpected section title. *(downgraded to error, see RST309)*
138139
RST499 Previously unseen severe error, not yet assigned a unique code.
139140
====== =======================================================================
140141

@@ -249,6 +250,7 @@ Version Released Changes
249250
------- ---------- -----------------------------------------------------------
250251
v0.4.0 *Pending* - Tested with docutils v0.22.2
251252
- Adds `RST308` for duplicated target names.
253+
- Adds `RST309` replacing `RST401` (downgraded severity).
252254
- Requires Python 3.9 or later.
253255
v0.3.1 2025-04-29 - Adds ``RST220`` for redefined anonymous links.
254256
- Requires Python 3.8 or later (no code changes).

flake8_rst_docstrings.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,15 @@
8282
'Error in "*" directive:': 7,
8383
# e.g. Duplicate target name, cannot be used as a unique reference: "python".
8484
'Duplicate target name, cannot be used as a unique reference: "*".': 8,
85+
# This was RST401 prior to docutils v0.22:
86+
"Unexpected section title.": 9,
8587
}
8688

8789
# Level 4 - severe
88-
code_mapping_severe = {"Unexpected section title.": 1}
90+
code_mapping_severe = {
91+
# See RST308 as of docutils v0.22:
92+
"Unexpected section title.": 1,
93+
}
8994

9095
code_mappings_by_level = {
9196
1: code_mapping_info,
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
33
This should fail validation:
44
5-
$ flake8 --select RST RST401/sub_title.py
6-
RST401/sub_title.py:20:1: RST401 Unexpected section title.
5+
$ flake8 --select RST RST309/sub_title.py
6+
RST309/sub_title.py:20:1: RST309 Unexpected section title.
77
88
See below.
99
"""

0 commit comments

Comments
 (0)