Files
james.maesandClaude Opus 5.5 d6fedc762b feat(coding): adopt Kingsrook coding standard with IDE and CLI configs
Cross-language coding standard (K22-CODE-01..26) adopted from Kingsrook's QQQ
CODE_STYLE.md, with profiles for C#/.NET, Java, TypeScript, Python, Rust, Go,
Swift, Shell/PowerShell, and Terraform, and the files each IDE and tool imports:
IntelliJ scheme, copyright profile and live templates, Checkstyle, Eclipse
formatter, .editorconfig, Directory.Build.props, ESLint Stylistic, ruff,
rustfmt/clippy/cargo-deny, golangci-lint, swift-format/SwiftLint, ShellCheck,
PSScriptAnalyzer, TFLint, sqlfluff, VS Code. Kingsrook files keep their
Apache-2.0 notice (NOTICE).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: James Maes <james@kof22.com>
2026-10-09 07:53:21 -05:00

2.9 KiB

Rust profile

The Kingsrook coding standard applied to Rust. Requirement IDs are K22-CODE-RS-NN. Configuration: configs/rust/.

Tooling

Concern Tool Version policy
Toolchain stable Rust via rust-toolchain.toml pinned stable version; MSRV declared in Cargo.toml (rust-version)
Formatter rustfmt with rustfmt.toml stable options only
Linter clippy (-D warnings, pedantic as warnings) toolchain version
Supply chain cargo-deny (advisories, licenses, bans, sources) latest stable
Tests cargo test (cargo nextest optional)
Coverage cargo llvm-cov latest stable

Requirements

K22-CODE-RS-01 (MUST) cargo fmt --check passes with the KofTwentyTwo rustfmt.toml: 3-space indentation (tab_spaces = 3, a stable option), Unix line endings, max_width = 200. Verified by: cargo fmt --check in CI.

K22-CODE-RS-02 (MUST) Deviation: braces stay on the same line (rustfmt's default). brace_style = "AlwaysNextLine" and blank-line limits exist only on the nightly toolchain, and KofTwentyTwo does not build release code with nightly. K22-CODE-04 and K22-CODE-06 (blank-line counts) therefore follow rustfmt; every non-layout Kingsrook rule still applies.

K22-CODE-RS-03 (MUST) Header comments (K22-CODE-09) are /// doc comments on every item and //! on every module, because rustdoc and missing_docs read only those. Inside function bodies, explanatory comments use the flower-box shape. Verified by: missing_docs lint (warn → error under -D warnings).

K22-CODE-RS-04 (MUST) cargo clippy --all-targets --all-features -- -D warnings passes with the lint table in Cargo.lints.toml and thresholds in clippy.toml: unsafe_code forbidden, unwrap/ expect flagged outside tests, println!/eprintln!/dbg! disallowed (use tracing with structured fields). Verified by: clippy in CI.

K22-CODE-RS-05 (MUST) cargo deny check passes with deny.toml: no known advisories or yanked crates, only permissive licenses, no wildcard versions, crates only from crates.io. Cargo.lock is committed for binaries and libraries alike. Verified by: cargo-deny in CI. Maps to: OSPS-QA-02.01, OSPS-VM-05.03.

K22-CODE-RS-06 (MUST) Errors are typed (thiserror for libraries, anyhow or eyre at application edges) and carry context; panics are for broken invariants only. Verified by: clippy unwrap_used, expect_used; review.

Commands

Where Command
Local fix cargo fmt && cargo clippy --fix --allow-dirty
CI cargo fmt --check, cargo clippy --all-targets --all-features --locked -- -D warnings, cargo test --locked, cargo deny check