# Development ## Prerequisites - Rust and Cargo - `just` for project recipes - `mdbook` for documentation work ## Workspace This Rust workspace has two crates: - `crates/core`: library code for tokenization, loading, clone detection, complexity and LOC analysis, coverage parsing, highlighting, and reporting. - `crates/cli`: the `mccabre` command-line interface built with `clap`; command handlers live in `crates/cli/src/commands/`. ## Common Commands ```bash cargo build --workspace cargo test --workspace cargo fmt --all cargo clippy --workspace --all-targets ``` The justfile wraps the common local workflow: ```bash just fmt just test just check just docs-build just docs-test ``` Run the CLI locally with Cargo: ```bash cargo run -p mccabre -- loc crates/core cargo run -p mccabre -- coverage report --from lcov.info ``` ## Coverage Mccabre uses [`cargo-llvm-cov`](https://github.com/taiki-e/cargo-llvm-cov) for Rust test coverage. Install the Cargo subcommand: ```bash cargo +stable install cargo-llvm-cov --locked ``` Installing from source currently requires rustc 1.87 or later. On macOS or Linux with Homebrew, `brew install cargo-llvm-cov` is also available. Then run coverage through `just`: ```bash # Print coverage in the terminal. just coverage # Write lcov.info for mccabre coverage commands. just coverage-lcov # Write an HTML report to coverage_html/. just coverage-html ``` Coverage artifacts are ignored by git. ## Documentation Keep documentation in `docs/` up to date when behavior changes. ```bash just docs-build just docs-test ``` Serve the mdBook locally while editing: ```bash just docs ```