We need to check and ensure that all confval directives across the documentation have a dedicated section heading directly preceding them.
Save and run this script from the repository root to find all affected locations:
import os
import re
confval_missing_heading = []
total_confval = 0
for root, dirs, files in os.walk("."):
dirs[:] = [d for d in dirs if not d.startswith('.')]
for file in sorted(files):
if file.endswith(".rst"):
filepath = os.path.join(root, file)
try:
with open(filepath, "r", encoding="utf-8") as f:
lines = f.readlines()
except Exception:
continue
for idx, line in enumerate(lines):
if re.match(r"^\s*\.\.\s+confval::", line):
total_confval += 1
has_heading = False
start_look = max(0, idx - 15)
for check_idx in range(idx - 1, start_look - 1, -1):
chk_line = lines[check_idx].strip()
# Check for reST heading underline adornments
if chk_line and len(set(chk_line)) == 1 and chk_line[0] in "=-~`'^\"*+#_":
has_heading = True
break
if re.match(r"^\s*\.\.\s+confval::", lines[check_idx]):
break
if not has_heading:
confval_missing_heading.append((filepath, idx + 1, line.strip()))
print(f"Total confval blocks found: {total_confval}")
print(f"Total missing preceding heading: {len(confval_missing_heading)}\n")
print("Affected locations:")
for path, line_no, content in confval_missing_heading:
print(f" {path}:{line_no} -> {content}")
```***
We need to check and ensure that all confval directives across the documentation have a dedicated section heading directly preceding them.
Task
Helper Script
Save and run this script from the repository root to find all affected locations: