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 #221

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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ devenv.local.nix

# direnv
.direnv
.pre-commit-config.yaml
.pre-commit-config.yaml

# Coverage reports
.coverage
coverage.xml
lcov.info
18 changes: 18 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,24 @@ 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/tket2/commits?branch=All%20branches).

To run the rust 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).

Similarly, to run the python coverage checks locally, install `pytest-cov` and run:
```bash
pytest --cov=./ --cov-report=xml
```

## 🌐 Contributing to tket2

We welcome contributions to tket2! Please open [an issue](https://github.com/CQCL/tket2/issues/new) or [pull request](https://github.com/CQCL/tket2/compare) if you have any questions or suggestions.
Expand Down
10 changes: 9 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ check:
# Format the code
format:
cargo fmt
ruff format .
ruff format .

# Generate a test coverage report
coverage:
cargo llvm-cov --lcov > lcov.info

# Generate a python test coverage report
pycoverage: pydevelop
pytest --cov=./ --cov-report=html
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ python = ">=3.10"
maturin = "^1.3.0"
pytket = "*"
pytest = "^7.1.2"
pytest-cov = "^4.1.0"
ruff = "^0.1.3"

[build-system]
Expand Down