Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Coverage check section in DEVELOPMENT.md #648

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ proptest-regressions/
devenv.local.nix

# managed by devenv
.pre-commit-config.yaml
.pre-commit-config.yaml

# Coverage report
lcov.info
14 changes: 14 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 20 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
@@ -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