Skip to content

Commit 6d24f54

Browse files
authored
Include replaces field into chk_adrs.py (#1034)
* Include replaces field into chk_adrs.py * Fix missing replaces field in front matter * Treat replaces field as list * Make warning output more consistent with errors Signed-off-by: Matthias Büchse <[email protected]>
1 parent 6d18129 commit 6d24f54

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Standards/scs-0210-v2-k8s-version-policy.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ type: Standard
44
stabilized_at: 2024-02-08
55
status: Stable
66
track: KaaS
7+
replaces: scs-0210-v1-k8s-new-version-policy.md
78
---
89

910
## Introduction

Tests/chk_adrs.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@ def check_front_matter(self, fn, front, filenames):
131131
]
132132
if errors:
133133
self.emit(f"in {fn}: syntax errors with key(s) {', '.join(errors)}")
134+
# special check for replaces field if major version > 1
135+
if fn[9:12] not in ("vN-", "v1-"):
136+
replaces = front.get("replaces")
137+
if replaces is None:
138+
self.emit(f"in {fn}: missing replaces field")
139+
else:
140+
if isinstance(replaces, str):
141+
print(f"WARNING: in {fn}: replaces field not a list", file=sys.stderr)
142+
replaces = [replaces]
143+
missing = [fn for fn in replaces if fn not in filenames]
144+
if missing:
145+
self.emit(f"in {fn}: original version(s) {','.join(missing)} not found")
134146
# now do cross-field checks
135147
status = front.get("status")
136148
if "replaced_by" in front and status not in ("Deprecated", "Rejected"):

0 commit comments

Comments
 (0)