Add coverage-html just command and clean up pipeline.rs exclusion
Use unreachable! instead of panic! in let-else to avoid LLVM coverage
artifact on closing brace. Remove cov-excl-start/stop from pipeline.rs.
Assisted-by: GLM-5.1 via pi
diff --git a/justfile b/justfile
index 9fb852a..645e289 100644
--- a/justfile
+++ b/justfile
@@ -46,6 +46,28 @@ coverage:
exit 1
fi
+coverage-html:
+ #!/usr/bin/env bash
+ set -euo pipefail
+ export RUSTFLAGS="-Cinstrument-coverage"
+ export CARGO_TARGET_DIR="target/coverage"
+ export LLVM_PROFILE_FILE="target/coverage/profraw/%p-%m.profraw"
+ rm -rf target/coverage
+ cargo test --workspace -q
+ rm -rf target/coverage/html
+ grcov target/coverage/profraw \
+ --binary-path ./target/coverage/debug/ \
+ -s . \
+ -t html \
+ --ignore-not-existing \
+ --keep-only 'src/**' \
+ --ignore 'src/bin/**' \
+ --excl-line 'cov-excl-line|unreachable!|tracing::' \
+ --excl-start 'cov-excl-start' \
+ --excl-stop 'cov-excl-stop' \
+ -o target/coverage/html
+ echo "HTML report at target/coverage/html/index.html"
+
mutants:
#!/usr/bin/env bash
set -uo pipefail
diff --git a/src/ci/pipeline.rs b/src/ci/pipeline.rs
index e7b798b..6887f26 100644
--- a/src/ci/pipeline.rs
+++ b/src/ci/pipeline.rs
@@ -674,7 +674,7 @@ mod tests {
(ci.job :orphan [:does-not-exist] (fn [_] nil))"#,
"ci.fnl",
);
- let Err(e) = result else { panic!("expected validation error") }; // cov-excl-start
+ let Err(e) = result else { unreachable!() };
let msg = e.to_string();
assert!(
msg.contains("CI validation failed"),
@@ -682,4 +682,3 @@ mod tests {
);
}
}
-// cov-excl-stop