From 9fe553461edfe508c94d042e1aeac42fbfeeefcc Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Tue, 1 Sep 2026 10:34:18 +0200 Subject: [PATCH] chore: isolate Rust implementation directory --- .gitignore | 1 + CONTRIBUTING.md | 5 +++++ rust/README.md | 8 ++++++++ tests/test_repository_layout.py | 21 +++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 rust/README.md create mode 100644 tests/test_repository_layout.py diff --git a/.gitignore b/.gitignore index 17b6b7d..1f30d2f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ __pycache__/ *.egg-info/ build/ dist/ +target/ .pytest_cache/ .ruff_cache/ rulezet-validation.toml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dfae841..bfed57f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,8 +30,13 @@ src/rulezet_validation/ sync.py orchestration cli.py argparse wiring only, no logic baseline/ manifest + the bundled probes +rust/ all Rust crates and Rust implementation ``` +Rust source and Cargo manifests belong under the top-level `rust/` directory. +The repository layout test enforces this boundary so Rust tooling does not become +interspersed with the Python package. + ## Things that will get a patch rejected **Anything other than a baseline hit moving a rule into quarantine.** The diff --git a/rust/README.md b/rust/README.md new file mode 100644 index 0000000..73d73ec --- /dev/null +++ b/rust/README.md @@ -0,0 +1,8 @@ +# Rust implementation + +All Rust crates, Cargo manifests, and Rust source code for this project live in +this directory. Keeping the Rust implementation here gives Cargo an isolated +workspace while leaving the Python package under `src/rulezet_validation/`. + +New Rust crates should be created as children of this directory. Do not place +`Cargo.toml`, `Cargo.lock`, or `*.rs` files elsewhere in the repository. diff --git a/tests/test_repository_layout.py b/tests/test_repository_layout.py new file mode 100644 index 0000000..1175807 --- /dev/null +++ b/tests/test_repository_layout.py @@ -0,0 +1,21 @@ +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +RUST_ROOT = ROOT / "rust" +RUST_FILES = {"Cargo.toml", "Cargo.lock"} + + +def test_rust_implementation_is_contained_in_rust_directory(): + misplaced = [] + + for path in ROOT.rglob("*"): + if any(part in {".git", ".venv", "target"} for part in path.parts): + continue + if path.is_file() and (path.suffix == ".rs" or path.name in RUST_FILES): + if not path.is_relative_to(RUST_ROOT): + misplaced.append(path.relative_to(ROOT).as_posix()) + + assert misplaced == [], ( + "Rust source and Cargo files must live under rust/: " + + ", ".join(misplaced) + )