|
| 1 | +This repository contains a Rust-based, security-focused sandboxing library OS. To maintain high code quality and consistency, please adhere to the following guidelines when contributing. |
| 2 | + |
| 3 | +## Code Standards |
| 4 | + |
| 5 | +### Required Before Each Commit |
| 6 | +- Run `cargo fmt` to format all Rust files using `rustfmt`. |
| 7 | + - This ensures consistent code style across the codebase. |
| 8 | + |
| 9 | +### Development Workflow |
| 10 | +The recommended sequence during development is: |
| 11 | +1. **Format**: `cargo fmt` |
| 12 | +2. **Build**: `cargo build` |
| 13 | +3. **Lint**: `cargo clippy --all-targets --all-features` |
| 14 | +4. **Test**: `cargo nextest run` |
| 15 | + |
| 16 | +- Full CI checks are defined in `.github/workflows/ci.yml`. |
| 17 | + |
| 18 | +## Key Guidelines |
| 19 | + |
| 20 | +1. Follow Rust best practices and idiomatic patterns. |
| 21 | +2. Preserve the existing code structure and organization. |
| 22 | +3. Minimize use of `unsafe` code. Every `unsafe` block **must** include a clear safety comment explaining why it's sound. Always prefer safe abstractions and code where possible. |
| 23 | +4. Write unit tests for new functionality, especially if it affects public interfaces. |
| 24 | + - Extremely simple changes do not require explicit unit tests. |
| 25 | +5. Document all public APIs and non-trivial implementation details. |
| 26 | +6. Avoid introducing new dependencies unless strictly necessary. If a dependency is added: |
| 27 | + - It must be justified. |
| 28 | + - Prefer `default-features = false` in `Cargo.toml`. |
| 29 | +7. Favor `no_std` compatibility wherever feasible. |
| 30 | + - Some crates in the workspace may use `std`, but this should be deliberate and justified. |
0 commit comments