v0.1.0-pre.015
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# file: scripts/audit_khadhroony_workspace_rules.py
|
||||
# version: 8
|
||||
# version: 9
|
||||
|
||||
"""Audit mechanically verifiable rules specific to khadhroony-bot3."""
|
||||
|
||||
@@ -438,13 +438,13 @@ def audit_reserved_executor_scaffolds(root: pathlib.Path) -> list[Violation]:
|
||||
"reserved executor must build only an explicit zero-instruction plan",
|
||||
)
|
||||
)
|
||||
if reserved_count != 104:
|
||||
if reserved_count != 103:
|
||||
violations.append(
|
||||
Violation(
|
||||
"KH_EX007",
|
||||
"kb-lib/src/executor",
|
||||
1,
|
||||
f"expected 104 reserved executor boundaries, found {reserved_count}",
|
||||
f"expected 103 reserved executor boundaries, found {reserved_count}",
|
||||
)
|
||||
)
|
||||
return violations
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
# file: scripts/audit_rust_general_rules.py
|
||||
# version: 7
|
||||
# version: 8
|
||||
|
||||
"""Audit mechanically verifiable Rust rules shared by all Rust projects."""
|
||||
|
||||
@@ -116,6 +116,10 @@ def audit_file(root: pathlib.Path, path: pathlib.Path) -> list[Violation]:
|
||||
previous_export_visibility: str | None = None
|
||||
previous_export_key: tuple[object, ...] | None = None
|
||||
blank_since_export = False
|
||||
crate_visibility_seen = False
|
||||
enforce_visibility_order = relative == "kb-lib/src/lib.rs" or relative.startswith(
|
||||
"kb-lib/src/executor"
|
||||
)
|
||||
for index, line in enumerate(lines, 1):
|
||||
if not line.strip():
|
||||
if previous_export_line is not None:
|
||||
@@ -125,6 +129,32 @@ def audit_file(root: pathlib.Path, path: pathlib.Path) -> list[Violation]:
|
||||
continue
|
||||
if line.startswith("pub use ") or line.startswith("pub(crate) use "):
|
||||
visibility = "pub(crate)" if line.startswith("pub(crate) use ") else "pub"
|
||||
if enforce_visibility_order and visibility == "pub" and crate_visibility_seen:
|
||||
violations.append(
|
||||
Violation(
|
||||
"RUST024",
|
||||
relative,
|
||||
index,
|
||||
"`pub use` block must precede the `pub(crate) use` block",
|
||||
)
|
||||
)
|
||||
if visibility == "pub(crate)":
|
||||
crate_visibility_seen = True
|
||||
if (
|
||||
enforce_visibility_order
|
||||
and
|
||||
previous_export_line is not None
|
||||
and previous_export_visibility != visibility
|
||||
and not blank_since_export
|
||||
):
|
||||
violations.append(
|
||||
Violation(
|
||||
"RUST025",
|
||||
relative,
|
||||
index,
|
||||
"re-export blocks with different visibility require one empty line",
|
||||
)
|
||||
)
|
||||
if (
|
||||
previous_export_line is not None
|
||||
and previous_export_visibility == visibility
|
||||
|
||||
Reference in New Issue
Block a user