code complexity & repetition analysis tool
mccabre DEVELOPMENT.md
1.6 kB · 85 lines
Markdown
at main

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 #

cargo build --workspace
cargo test --workspace
cargo fmt --all
cargo clippy --workspace --all-targets

The justfile wraps the common local workflow:

just fmt
just test
just check
just docs-build
just docs-test

Run the CLI locally with Cargo:

cargo run -p mccabre -- loc crates/core
cargo run -p mccabre -- coverage report --from lcov.info

Coverage #

Mccabre uses cargo-llvm-cov for Rust test coverage.

Install the Cargo subcommand:

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:

# 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.

just docs-build
just docs-test

Serve the mdBook locally while editing:

just docs