diff --git a/.gitignore b/.gitignore index fb20ffa..26cf977 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ /target + +# Coverage artifacts (cargo-llvm-cov) +/lcov.info + *.swp *.swo *~ diff --git a/CLAUDE.md b/CLAUDE.md index 690894d..4a6668e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,6 +15,7 @@ This project uses a `Makefile` as the **single source of truth** for build, form - `make build` — `cargo build --all-targets` - `make check` — `fmt-check` + `lint` + `test` (run this before declaring work done or pushing) - `make all` — `fmt` + `check` + `build` +- `make coverage` — local test-coverage summary via `cargo-llvm-cov` (also `coverage-html` / `coverage-lcov`; on-demand, not a CI gate, not part of `make check`) ### Required workflow before finishing any code change diff --git a/Makefile b/Makefile index 991f5b3..de4a84c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: help fmt fmt-check lint test build build-release check all +.PHONY: help fmt fmt-check lint test build build-release check all coverage coverage-html coverage-lcov CARGO ?= cargo @@ -12,6 +12,9 @@ help: @echo " build-release - cargo build --release" @echo " check - fmt-check + lint + test (run before pushing)" @echo " all - fmt + check + build" + @echo " coverage - test coverage summary in the terminal (cargo-llvm-cov)" + @echo " coverage-html - generate an HTML coverage report under target/llvm-cov/html" + @echo " coverage-lcov - emit lcov.info for external tooling" fmt: $(CARGO) fmt --all @@ -34,3 +37,12 @@ build-release: check: fmt-check lint test all: fmt check build + +coverage: + $(CARGO) llvm-cov --all-targets + +coverage-html: + $(CARGO) llvm-cov --all-targets --html + +coverage-lcov: + $(CARGO) llvm-cov --all-targets --lcov --output-path lcov.info