0.3.4-alpha.1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# file: scripts/audit_project_workspace_rules.py
|
||||
# version: 7
|
||||
# version: 8
|
||||
|
||||
"""Audit mechanically verifiable games.sasedev workspace boundaries."""
|
||||
|
||||
@@ -12,7 +12,15 @@ import re
|
||||
import sys
|
||||
import tomllib
|
||||
|
||||
SEMVER = re.compile(r"^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-(?:0-pre|1-alpha|2-beta|3-rc)\.[1-9][0-9]*(?:\.fix\.[1-9][0-9]*)?)?$", re.ASCII)
|
||||
CURRENT_SEMVER = re.compile(
|
||||
r"^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-(?:alpha|beta|rc)\.[1-9][0-9]*(?:\.fix\.[1-9][0-9]*)?)?$",
|
||||
re.ASCII,
|
||||
)
|
||||
LEGACY_MILESTONE_SEMVER = re.compile(
|
||||
r"^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)-(?:0-pre|1-alpha|2-beta|3-rc)\.[1-9][0-9]*(?:\.fix\.[1-9][0-9]*)?$",
|
||||
re.ASCII,
|
||||
)
|
||||
LEGACY_HISTORY_BASE_VERSIONS = frozenset({"0.1.0", "0.2.0", "0.3.0", "0.3.1", "0.3.3"})
|
||||
|
||||
|
||||
def is_generated_path(path: pathlib.Path, root: pathlib.Path) -> bool:
|
||||
@@ -32,7 +40,7 @@ def main() -> int:
|
||||
errors: list[str] = []
|
||||
manifest = tomllib.loads((root / "Cargo.toml").read_text(encoding="utf-8"))
|
||||
workspace_version = manifest.get("workspace", {}).get("package", {}).get("version")
|
||||
if not isinstance(workspace_version, str) or SEMVER.fullmatch(workspace_version) is None:
|
||||
if not isinstance(workspace_version, str) or CURRENT_SEMVER.fullmatch(workspace_version) is None:
|
||||
errors.append("VERSION-001: workspace.package.version does not follow the canonical games.sasedev SemVer scheme")
|
||||
members = manifest.get("workspace", {}).get("members", [])
|
||||
for member in members:
|
||||
@@ -47,7 +55,7 @@ def main() -> int:
|
||||
if version.get("workspace") is not True:
|
||||
errors.append(f"GAME-WS-004: {relative}: table version must use workspace = true")
|
||||
elif isinstance(version, str):
|
||||
if SEMVER.fullmatch(version) is None:
|
||||
if CURRENT_SEMVER.fullmatch(version) is None:
|
||||
errors.append(f"GAME-WS-005: {relative}: explicit crate version does not follow the canonical games.sasedev SemVer scheme")
|
||||
else:
|
||||
errors.append(f"GAME-WS-004: {relative}: crate must inherit or explicitly own a version")
|
||||
@@ -84,7 +92,9 @@ def main() -> int:
|
||||
errors.append(f"DOC-010: invalid history base version directory: {history_path.relative_to(root).as_posix()}")
|
||||
label = filename[:-3]
|
||||
candidate = f"{base_version}-{label}"
|
||||
if SEMVER.fullmatch(candidate) is None:
|
||||
is_current = CURRENT_SEMVER.fullmatch(candidate) is not None
|
||||
is_legacy = base_version in LEGACY_HISTORY_BASE_VERSIONS and LEGACY_MILESTONE_SEMVER.fullmatch(candidate) is not None
|
||||
if not is_current and not is_legacy:
|
||||
errors.append(f"DOC-010: invalid history milestone filename: {history_path.relative_to(root).as_posix()}")
|
||||
|
||||
docs_root = root / "docs"
|
||||
|
||||
Reference in New Issue
Block a user