home / skills / redisearch / redisearch / check-rust-coverage
This skill identifies uncovered Rust test lines by executing cargo llvm-cov and reports per-file gaps to guide targeted testing.
npx playbooks add skill redisearch/redisearch --skill check-rust-coverageReview the files below or copy the command above to add this skill to your agents.
---
name: check-rust-coverage
description: Check which Rust lines are not covered by Rust tests.
---
# Check Rust Coverage
Determine which Rust lines are not covered by Rust tests.
## Arguments
- `<path>`: Path to a Rust crate.
- `<path 1> <path 2>`: Multiple crate paths.
If a path doesn't include `src/`, assume it to be in the `src/redisearch_rs` directory. E.g. `numeric_range_tree` becomes `src/redisearch_rs/numeric_range_tree`.
If a path points to a directory, consider all Rust crates in that directory.
## Instructions
Run
```bash
cargo llvm-cov test --manifest-path <crate_directory>/Cargo.toml --quiet --json 2>/dev/null | jq -r '"Uncovered Lines:",
(.data[0].files[] |
select(.summary.lines.percent < 100) |
.filename as $f |
[.segments[] | select(.[2] == 0 and .[4] == true) | .[0]] |
unique |
if length > 0 then "\($f): \(join(", "))" else empty end
)'
```
to get the list of uncovered lines for each file in the target crate.
This skill finds which Rust source lines are not exercised by your Rust tests. It targets crates or folders and returns per-file lists of uncovered line numbers so you can prioritize test writing and improve coverage. It is designed for Rust projects embedded in larger C-based codebases or modules.
It runs cargo llvm-cov test for the specified crate manifest and parses the JSON report, filtering files whose line coverage is below 100%. For each such file it extracts segment start positions where execution count is zero and reports unique line numbers for uncovered segments. It supports single or multiple crate paths and a path-mapping convention for src/redisearch_rs subpaths.
What prerequisites are required to run this check?
Install cargo-llvm-cov and jq. The command relies on cargo llvm-cov producing JSON and jq to extract uncovered line numbers.
How are paths resolved when I pass a directory or short name?
If the argument lacks src/ it is treated as src/redisearch_rs/<name>. If you pass a directory, the tool inspects all Rust crates it finds in that directory and uses each crate's Cargo.toml manifest.