From f2cc9b865a148e20245cdce44f5ecc6383d8b0a0 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Tue, 7 Nov 2023 11:59:43 +0000 Subject: [PATCH] docs: Coverage check section in DEVELOPMENT.md --- .gitignore | 5 ++++- DEVELOPMENT.md | 14 ++++++++++++++ justfile | 23 +++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 justfile diff --git a/.gitignore b/.gitignore index b354aec..785bd29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ Cargo.lock -target/ \ No newline at end of file +target/ + +# Coverage reports +lcov.info \ No newline at end of file diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 2eac55b..23c5057 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -58,6 +58,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/portgraph/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 portgraph We welcome contributions to portgraph! Please open [an issue](https://github.com/CQCL/portgraph/issues/new) or [pull request](https://github.com/CQCL/portgraph/compare) if you have any questions or suggestions. diff --git a/justfile b/justfile new file mode 100644 index 0000000..bc395e9 --- /dev/null +++ b/justfile @@ -0,0 +1,23 @@ +# List the available commands +help: + @just --list --justfile {{justfile()}} + +# Run all the rust tests +test: + cargo test --all-features + +# Auto-fix all clippy warnings +fix: + 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