-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Use pre-commit, update justfile and fix lints (#329)
Changes are a bit messy since enabling pre-commit required fixing some lints. The main changes are: - `justfile`: Brought in the simpler recipes from hugr - `.pre-commit-config.yaml`: Configured all the checks (Except for mypy, since we are missing typing info on the bindings). Closes #318 (although I'll also update the ci checks workflow at some point)
- Loading branch information
Showing
27 changed files
with
673 additions
and
362 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" | ||
|
||
use devenv | ||
use devenv |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ name: Continuous integration | |
on: | ||
push: | ||
branches: | ||
- main | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 # Use the ref you want to point at | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-vcs-permalinks | ||
- id: check-yaml | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
exclude: | | ||
(?x)^( | ||
test_files/.*| | ||
.*.snap| | ||
.*.snap.new| | ||
.release-please-manifest.json | ||
)$ | ||
- id: trailing-whitespace | ||
exclude: | | ||
(?x)^( | ||
test_files/.*| | ||
.*.snap| | ||
.*.snap.new | ||
)$ | ||
- id: fix-byte-order-marker | ||
- id: mixed-line-ending | ||
# Python-specific | ||
- id: check-ast | ||
- id: check-docstring-first | ||
- id: debug-statements | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.3.0 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
- id: ruff-format | ||
|
||
# The bindings for `tket2-py` do not define their types, so we need to ignore mypy for them. | ||
# This should be re-enabled once we add .pyi files. | ||
# | ||
#- repo: https://github.com/pre-commit/mirrors-mypy | ||
# rev: v1.9.0 | ||
# hooks: | ||
# - id: mypy | ||
# additional_dependencies: [pydantic] | ||
|
||
- repo: local | ||
hooks: | ||
- id: cargo-fmt | ||
name: cargo format | ||
description: Format rust code with `cargo fmt`. | ||
entry: poetry run -- cargo fmt --all -- --check | ||
language: system | ||
files: \.rs$ | ||
pass_filenames: false | ||
- id: cargo-check | ||
name: cargo check | ||
description: Check rust code with `cargo check`. | ||
entry: poetry run -- cargo check --all --all-features --workspace | ||
language: system | ||
files: \.rs$ | ||
pass_filenames: false | ||
- id: cargo-test | ||
name: cargo test | ||
description: Run tests with `cargo test`. | ||
entry: poetry run -- cargo test --all-features --workspace | ||
language: system | ||
files: \.rs$ | ||
pass_filenames: false | ||
- id: cargo-clippy | ||
name: cargo clippy | ||
description: Run clippy lints with `cargo clippy`. | ||
entry: poetry run -- cargo clippy --all-features --all-targets --workspace -- -D warnings | ||
language: system | ||
files: \.rs$ | ||
pass_filenames: false | ||
- id: cargo-doc | ||
name: cargo doc | ||
description: Generate documentation with `cargo doc`. | ||
entry: poetry run -- cargo doc --no-deps --all-features --workspace | ||
language: system | ||
files: \.rs$ | ||
pass_filenames: false | ||
- id: py-test | ||
name: pytest | ||
description: Run python tests | ||
entry: poetry run -- sh -c "maturin develop && pytest --cov=./ --cov-report=html" | ||
language: system | ||
files: \.py$ | ||
pass_filenames: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.