From 799c81ae6ec30d3f994eb70ab6a63b07cba6f12f Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Tue, 7 Nov 2023 10:50:51 +0000 Subject: [PATCH] docs: Coverage check sectio in DEVELOPMENT.md --- .gitignore | 5 ++++- DEVELOPMENT.md | 14 ++++++++++++++ justfile | 22 ++++++++++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a41fdf909..1b0b35659 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,7 @@ proptest-regressions/ devenv.local.nix # managed by devenv -.pre-commit-config.yaml \ No newline at end of file +.pre-commit-config.yaml + +# Coverage report +lcov.info \ No newline at end of file diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 47600836f..110a4cf6e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -79,6 +79,20 @@ We also check for clippy warnings, which are a set of linting rules for rust. To cargo clippy --all-targets ``` +## 📈 Code Coverage + +We run coverage checks on the CI. Once you submit a PR, you can review the +line-by-line coverage report on +[codecov](https://app.codecov.io/gh/CQCL/hugr/commits?branch=All%20branches). + +To run the coverage checks locally, install `cargo-llvm-cov`, generate the report with: +```bash +cargo llvm-cov --lcov > lcov.info +``` + +and open it with your favourite coverage viewer. In VSCode, you can use +[`coverage-gutters`](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters). + ## 🌐 Contributing to HUGR We welcome contributions to HUGR! Please open [an issue](https://github.com/CQCL/hugr/issues/new) or [pull request](https://github.com/CQCL/hugr/compare) if you have any questions or suggestions. diff --git a/justfile b/justfile index c3155f8c8..29db0299f 100644 --- a/justfile +++ b/justfile @@ -1,5 +1,23 @@ +# List the available commands +help: + @just --list --justfile {{justfile()}} + +# Run all the rust tests test: - cargo test + cargo test --all-features +# Auto-fix all clippy warnings fix: - cargo clippy --fix --allow-staged + cargo clippy --all-targets --all-features --workspace --fix --allow-staged + +# Run the pre-commit checks +check: + ./.github/pre-commit + +# Format the code +format: + cargo fmt + +# Generate a test coverage report +coverage: + cargo llvm-cov --lcov > lcov.info \ No newline at end of file