Efficient helper to list file based dependencies in git repos, focused on rust, python, typescript, and a specific style of bash.
  • Rust 98.4%
  • Shell 1.6%
Find a file
microchipster fb29462ca5 chore: update IGNORE_REGEX in mk/test to include more lines
Co-authored-by: aider (openrouter/openai/gpt-5-mini) <aider@aider.chat>
2025-11-13 20:37:07 -08:00
.cargo feat: enable nightly llvm-cov aliases, update README, add mk/test script 2025-11-11 12:30:26 -08:00
mk chore: update IGNORE_REGEX in mk/test to include more lines 2025-11-13 20:37:07 -08:00
src refactor: update rel_path to canonicalize before strip_prefix fallback 2025-11-13 18:45:28 -08:00
tests docs: add test-coverage guidance in app.rs 2025-11-13 16:41:57 -08:00
.gitignore ignore 2025-11-12 17:31:30 -08:00
Cargo.lock commits 2025-11-11 12:02:30 -08:00
Cargo.toml test: add comprehensive unit and integration tests for core helpers 2025-11-11 00:48:22 -08:00
README.md docs: document recommended mk/extract_uncovered.py in README 2025-11-12 22:52:06 -08:00

Coverage

This repository provides a canonical local workflow for collecting code coverage using the llvm-based tool cargo-llvm-cov. We avoid CI-specific workflows here — run these commands locally or on your preferred self-hosted/Codeberg runner.

Requirements

  • Rust stable toolchain.
  • rust-src and llvm-tools-preview components.
  • cargo-llvm-cov (installable via cargo).

Install prerequisites

# ensure rustup is installed and add the nightly toolchain + components
rustup toolchain install nightly
rustup component add --toolchain nightly rust-src llvm-tools-preview

# install the coverage helper (you can skip if already installed)
cargo install cargo-llvm-cov --locked

Available commands (aliases) The repository includes cargo aliases in .cargo/config.toml:

  • cargo coverage — produce a text coverage summary (target/coverage/)
  • cargo coverage-html — generate an HTML report and open it (target/coverage/)
  • cargo coverage-lcov — produce lcov info (target/coverage/)

You can also run cargo-llvm-cov directly if you prefer (these are equivalent to the aliases):

# Text summary (nightly is required for branch coverage)
cargo +nightly llvm-cov --workspace --tests --branch --output-path=target/coverage --ignore-filename-regex="^/rustc/"

# HTML report
cargo +nightly llvm-cov --workspace --tests --branch --output-path=target/coverage --ignore-filename-regex="^/rustc/" --open

# lcov
cargo +nightly llvm-cov --workspace --tests --branch --output-path=target/coverage --ignore-filename-regex="^/rustc/" --lcov
  • Branch coverage (the --branch option) requires a nightly toolchain; the examples above run llvm-cov under nightly via cargo +nightly ....
  • A convenience script is provided at ./mk/test which will install the required nightly components (if missing), install cargo-llvm-cov (if missing), and run the coverage commands for you.

Notes

  • cargo --list will show the aliases defined in .cargo/config.toml.
  • cargo llvm-cov requires the rust-src and llvm-tools-preview components; installing them via rustup component add is usually sufficient.
  • These commands are local-first and independent of any particular hosted CI provider; they can be run on Codeberg CI, self-hosted runners, or developer machines.

Recommended additional files to include

  • mk/extract_uncovered.py: The ./mk/test script invokes mk/extract_uncovered.py to process lcov info into a human-friendly uncovered-lines report. If you plan to run ./mk/test, ensure mk/extract_uncovered.py is present and executable. If you'd like, paste mk/extract_uncovered.py here and I can review it or provide a minimal implementation.
  • mk/extract_uncovered.py is often a small Python script that reads an lcov/info file and writes a concise summary; adding it will make the mk/test flow fully self-contained.

If you want suggestions for other files to add (CI config, more helper scripts, or example fixtures for the integration tests), tell me which CI or tooling you plan to use and I will recommend minimal files.