Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ __pycache__/
*.egg-info/
build/
dist/
target/
.pytest_cache/
.ruff_cache/
rulezet-validation.toml
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions rust/README.md
Original file line number Diff line number Diff line change
@@ -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.
21 changes: 21 additions & 0 deletions tests/test_repository_layout.py
Original file line number Diff line number Diff line change
@@ -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)
)
Loading