0.5.1-pre.003
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# file: scripts/audit_khadhroony_workspace_rules.py
|
||||
# version: 18
|
||||
# version: 19
|
||||
|
||||
"""Audit mechanically verifiable rules specific to khadhroony-bot3."""
|
||||
|
||||
@@ -108,7 +108,14 @@ def audit_ks_lib_tracing(root: pathlib.Path) -> list[Violation]:
|
||||
for constants in sorted((crate / "src").rglob("constants.rs")):
|
||||
text = constants.read_text(encoding="utf-8")
|
||||
component = constants.parent.relative_to(crate / "src")
|
||||
expected = "kb-lib." + ".".join(component.parts)
|
||||
component_parts = component.parts
|
||||
if component_parts and component_parts[0] in {"decoder", "executor", "materializer"}:
|
||||
suffix = ".".join(component_parts[1:])
|
||||
expected = f"ks-lib-{component_parts[0]}"
|
||||
if suffix:
|
||||
expected = f"{expected}.{suffix}"
|
||||
else:
|
||||
expected = "ks-lib." + ".".join(component_parts)
|
||||
relative = constants.relative_to(root).as_posix()
|
||||
for match in target_pattern.finditer(text):
|
||||
line = text[: match.start()].count("\n") + 1
|
||||
@@ -470,16 +477,16 @@ def audit_materializer_conventions(root: pathlib.Path) -> list[Violation]:
|
||||
)
|
||||
continue
|
||||
processor_name = processor[0]
|
||||
if not component_name.startswith("kb-lib.materializer."):
|
||||
if not component_name.startswith("ks-lib-materializer."):
|
||||
violations.append(
|
||||
Violation(
|
||||
"KH_MT010",
|
||||
relative,
|
||||
line,
|
||||
f"materializer component name `{component_name}` must start with `kb-lib.materializer.`",
|
||||
f"materializer component name `{component_name}` must start with `ks-lib-materializer.`",
|
||||
)
|
||||
)
|
||||
expected_processor = component_name.removeprefix("kb-lib.")
|
||||
expected_processor = "materializer." + component_name.removeprefix("ks-lib-materializer.")
|
||||
if processor_name != expected_processor:
|
||||
violations.append(
|
||||
Violation(
|
||||
@@ -570,7 +577,7 @@ def audit_materializer_conventions(root: pathlib.Path) -> list[Violation]:
|
||||
for target in targets:
|
||||
if (
|
||||
isinstance(target, str)
|
||||
and target.startswith("kb-lib.materializer.")
|
||||
and target.startswith("ks-lib-materializer.")
|
||||
and target not in component_values
|
||||
):
|
||||
violations.append(
|
||||
@@ -659,7 +666,7 @@ def audit_materializer_conventions(root: pathlib.Path) -> list[Violation]:
|
||||
"materializer implementation requires a sibling `constants.rs`",
|
||||
)
|
||||
)
|
||||
if re.search(r'"(?:kb-lib\.)?materializer\.[^"]+"', text):
|
||||
if re.search(r'"(?:ks-lib-)?materializer\.[^"]+"', text):
|
||||
violations.append(
|
||||
Violation(
|
||||
"KH_MT015",
|
||||
|
||||
Reference in New Issue
Block a user