Skip to content

Commit

Permalink
docs: Coverage check section in DEVELOPMENT.md (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
aborgna-q authored Nov 7, 2023
1 parent b358c02 commit 1f2b0b6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
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

0 comments on commit 1f2b0b6

Please sign in to comment.