0.1.0-0-pre.4
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# file: scripts/audit_project_workspace_rules.py
|
||||
# version: 2
|
||||
# version: 3
|
||||
|
||||
"""Audit mechanically verifiable games.sasedev workspace boundaries."""
|
||||
|
||||
@@ -44,6 +44,25 @@ def main() -> int:
|
||||
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")
|
||||
for source_path in sorted((root / "crates").rglob("src/**/*.rs")):
|
||||
relative = source_path.relative_to(root).as_posix()
|
||||
text = source_path.read_text(encoding="utf-8")
|
||||
if "#[test]" in text:
|
||||
errors.append(f"RUST-TEST-001: test body forbidden under src/: {relative}")
|
||||
if "#[cfg(test)]" in text:
|
||||
external_test_module = re.search(
|
||||
r'#\[cfg\(test\)\]\s*#\[path\s*=\s*"[^"]*unit_tests/[^"]+"\]\s*mod\s+tests\s*;',
|
||||
text,
|
||||
re.MULTILINE,
|
||||
)
|
||||
if external_test_module is None:
|
||||
errors.append(f"RUST-TEST-001: cfg(test) under src/ must reference an external unit_tests file: {relative}")
|
||||
for test_dir in sorted((root / "crates").rglob("src/**/unit_tests")):
|
||||
if test_dir.is_dir():
|
||||
errors.append(f"RUST-TEST-002: unit_tests directory forbidden under src/: {test_dir.relative_to(root).as_posix()}")
|
||||
for test_dir in sorted((root / "crates").rglob("src/**/tests")):
|
||||
if test_dir.is_dir():
|
||||
errors.append(f"RUST-TEST-003: integration tests directory forbidden under src/: {test_dir.relative_to(root).as_posix()}")
|
||||
forbidden_assets = [path for path in (root / "crates").rglob("assets") if path.is_dir()]
|
||||
for path in forbidden_assets:
|
||||
errors.append(f"GAME-ASSET-001: assets directory forbidden inside crates: {path.relative_to(root).as_posix()}")
|
||||
|
||||
Reference in New Issue
Block a user