Skip to main content

Crate cargo_korox

Crate cargo_korox 

Source
Expand description

§cargo-korox

A lightweight, Rust-native developer quality toolkit for cleaner, safer, and more maintainable Rust code. Runs locally with no cloud, no AI required.

§Overview

cargo-korox unifies project-level diagnostics into one developer-oriented command:

cargo install cargo-korox
cargo korox check

Instead of running multiple commands:

cargo check
cargo clippy
cargo fmt --check

§Features

  • Local-first — Your code never leaves your machine
  • Zero dependencies — Native Rust binary, no Python/Node/Docker/GPU
  • Rust-native — Understands ownership, borrowing, lifetimes, async, Tokio, unsafe
  • Actionable diagnostics — Explains what, why, where, and how to fix
  • AI optional — Core works without LLMs; AI layer is opt-in
  • CI/CD ready — --strict for CI, --json for editors/automation
  • Git-aware — --changed scans only modified files

§Rules

RuleSeverityDescription
unnecessary-cloneWarningDetects avoidable .clone() calls
suspicious-unwrapWarningDetects .unwrap()/.expect() that can panic
unused-variableSuggestionDetects unused let bindings
unnecessary-allocationWarningDetects Vec::new()/String::new() filled in loops
inefficient-loopWarningDetects indexing, cloning in loops
error-handlingError/WarningDetects panic!, todo!, unreachable!, .expect()
unnecessary-conversionSuggestionDetects to_owned() on literals, as casts
collection-in-loopWarningDetects Vec/HashMap/String created inside loops
inefficient-string-concatWarningDetects multiple + concatenations
redundant-cloneWarningDetects double clone, clone + to_string

§Configuration

Create korox.toml in your project root:

[tool.korox]
strict = false

[tool.korox.rules]
unnecessary_clone = "warn"
suspicious_unwrap = "warn"
unused_variable = "suggestion"

Severity levels: deny • warn • suggestion • allow

§Usage as Library

You can also use cargo-korox as a library in your own tools:

use cargo_korox::{run_check, Diagnostic};
use std::path::PathBuf;

let diagnostics = run_check(&PathBuf::from("."), false, false, false)?;
for diag in diagnostics {
    println!("{}:{} {}", diag.file, diag.line, diag.message);
}

§License

Licensed under either of:

Re-exports§

pub use commands::run_check;
pub use diagnostics::Diagnostic;
pub use rules::Rule;
pub use rules::RuleContext;
pub use scanner::scan_project;

Modules§

cli
commands
config
diagnostics
rules
scanner