| 1 |
--- |
| 2 |
inclusion: always |
| 3 |
--- |
| 4 |
|
| 5 |
# Code Quality Requirements |
| 6 |
|
| 7 |
## Pre-Completion Checks |
| 8 |
|
| 9 |
Before marking any task as completed, you MUST run the following commands and ensure they pass without errors or warnings: |
| 10 |
|
| 11 |
### 1. Code Formatting |
| 12 |
```bash |
| 13 |
cargo fmt --check |
| 14 |
``` |
| 15 |
If this fails, run `cargo fmt` to fix formatting issues, then verify with `--check` again. |
| 16 |
|
| 17 |
### 2. Linting |
| 18 |
```bash |
| 19 |
cargo clippy -- -D warnings |
| 20 |
``` |
| 21 |
All clippy warnings must be resolved. This ensures code follows Rust best practices and catches potential issues. |
| 22 |
|
| 23 |
### 3. Testing |
| 24 |
```bash |
| 25 |
cargo test |
| 26 |
``` |
| 27 |
All tests must pass to ensure no regressions were introduced. |
| 28 |
|
| 29 |
## Why These Requirements Matter |
| 30 |
|
| 31 |
- **cargo fmt**: Ensures consistent code formatting across the entire codebase, making it easier to read and maintain |
| 32 |
- **cargo clippy**: Catches common mistakes, suggests idiomatic Rust patterns, and helps prevent bugs before they reach production |
| 33 |
- **cargo test**: Validates that all functionality works as expected and no existing features were broken |
| 34 |
|
| 35 |
## Failure Handling |
| 36 |
|
| 37 |
If any of these commands fail: |
| 38 |
1. Fix the issues identified |
| 39 |
2. Re-run the commands to verify fixes |
| 40 |
3. Only then mark the task as completed |
| 41 |
|
| 42 |
These checks are non-negotiable for maintaining code quality and consistency. |