-
This file (
CONTRIBUTING.md) — Authoritative for code quality, commit workflow, formatting, and alignment withmake pre-commitand CI. When instructions conflict, prefer this file plusMakefileand.github/workflows/ci.yml. -
docs/DEVELOPMENT.md— Local environment setup (Kubernetes, kind, optional tools), IDE hints, and longer workflows. It does not redefine the quality gates above; runmake pre-commitas the single local bar before pushing. -
docs/DEVELOPMENT-NOTES.md— Historical design notes and analysis sessions (not a normative spec). For current behavior, use the source tree,CHANGELOG.md, andCLAUDE.md.
MANDATORY: All code must be properly formatted before committing. This project enforces strict formatting standards to maintain code consistency and readability.
Before every commit, you MUST pass the same checks as make pre-commit (see below). In practice, the steps are:
-
Format your code (or rely on
make fmt-checkto fail if not formatted):cargo fmt --all
-
Verify formatting:
cargo fmt --all --check
-
Pass clippy checks:
cargo clippy --all-features -- -D warnings
-
Run tests:
cargo test --all -
Console (frontend) — from repo root:
cd console-web && npm run lint cd console-web && npx prettier --check "**/*.{ts,tsx,js,jsx,json,css,md}"
Targets are defined in Makefile. Use these from the repository root:
# Format all Rust code
make fmt
# Check Rust formatting (no writes)
make fmt-check
# Clippy (Rust)
make clippy
# Rust tests
make test
# Frontend: ESLint + Prettier check (requires npm install in console-web/)
make console-lint
make console-fmt-check
# Full gate before push (Rust + console-web): same as project / AGENTS.md rules
make pre-commitOptional quick compile (not a separate make target):
cargo check --all-targetsThe repository does not ship a make setup-hooks target. To run checks automatically on git commit, add your own .git/hooks/pre-commit that invokes make pre-commit (or the individual commands above).
The project uses the following rustfmt configuration (defined in rustfmt.toml):
max_width = 130
fn_call_width = 90
single_line_let_else_max_width = 100If your code doesn't meet the formatting requirements, CI or local checks will fail with clear messages.
Example output when formatting fails:
❌ Code formatting check failed!
💡 Please run 'cargo fmt --all' to format your code before committing.
🔧 Quick fix:
cargo fmt --all
git add .
git commit
- Make your changes
- Format your code:
make fmtorcargo fmt --all - Run pre-commit checks:
make pre-commit - Commit your changes:
git commit -m "your message" - Push to your branch:
git push
Install the rust-analyzer extension and add to your settings.json:
{
"rust-analyzer.rustfmt.extraArgs": ["--config-path", "./rustfmt.toml"],
"editor.formatOnSave": true,
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
}Configure your IDE to:
- Use the project's
rustfmt.tomlconfiguration - Format on save
- Run clippy checks
- Never bypass formatting checks - they are there for a reason
- CI and
make pre-commitshould stay aligned; seeMakefileand.github/workflows/ci.yml - Pull requests may be rejected if checks fail
- Consistent formatting improves code readability and reduces merge conflicts
# Format all code
cargo fmt --all
# Check specific issues
cargo fmt --all --check --verbose# See detailed clippy output
cargo clippy --all-targets --all-features -- -D warnings
# Fix automatically fixable issues
cargo clippy --fix --all-targets --all-featuresFollowing these guidelines ensures high code quality and smooth collaboration across the RustFS project! 🚀