Skip to content

Commit e709ed6

Browse files
committed
simplify more
1 parent 9692881 commit e709ed6

File tree

1 file changed

+15
-26
lines changed

1 file changed

+15
-26
lines changed

scripts/validate_xls_template.py

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ class Section:
6161
class XLSTemplateValidator:
6262
"""Validates XLS specs against the template structure."""
6363

64+
# Required top-level sections (checked by substring match in section titles)
65+
REQUIRED_SECTIONS = [
66+
"Abstract",
67+
"Rationale",
68+
"Security", # Matches "Security" or "Security Considerations"
69+
]
70+
6471
# Amendment template section patterns and their required subsections
6572
AMENDMENT_SECTION_TEMPLATES = {
6673
r"SType:": {
@@ -243,32 +250,14 @@ def _validate_section_structure(self):
243250
# Get all section titles
244251
section_titles = [s.title for s in self.sections]
245252

246-
# Check for Abstract (required, not numbered)
247-
if "Abstract" not in section_titles:
248-
self.errors.append(ValidationError(
249-
str(self.file_path), None,
250-
"Missing required section: Abstract"
251-
))
252-
253-
# Check for Security section (can be "Security" or "Security Considerations")
254-
has_security = any(
255-
"Security" in title for title in section_titles
256-
)
257-
if not has_security:
258-
self.errors.append(ValidationError(
259-
str(self.file_path), None,
260-
"Missing required section: Security or Security Considerations"
261-
))
262-
263-
# Check for Rationale section (required)
264-
has_rationale = any(
265-
"Rationale" in title for title in section_titles
266-
)
267-
if not has_rationale:
268-
self.errors.append(ValidationError(
269-
str(self.file_path), None,
270-
"Missing required section: Rationale"
271-
))
253+
# Check for each required section (using substring match)
254+
for required in self.REQUIRED_SECTIONS:
255+
has_section = any(required in title for title in section_titles)
256+
if not has_section:
257+
self.errors.append(ValidationError(
258+
str(self.file_path), None,
259+
f"Missing required section: {required}"
260+
))
272261

273262
def _validate_amendment_structure(self):
274263
"""Validate Amendment-specific template structure."""

0 commit comments

Comments
 (0)