|
| 1 | +repos: |
| 2 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 3 | + rev: v4.5.0 # Use the ref you want to point at |
| 4 | + hooks: |
| 5 | + - id: check-added-large-files |
| 6 | + - id: check-case-conflict |
| 7 | + - id: check-executables-have-shebangs |
| 8 | + - id: check-merge-conflict |
| 9 | + - id: check-toml |
| 10 | + - id: check-vcs-permalinks |
| 11 | + - id: check-yaml |
| 12 | + - id: detect-private-key |
| 13 | + - id: end-of-file-fixer |
| 14 | + exclude: | |
| 15 | + (?x)^( |
| 16 | + specification/schema/.*| |
| 17 | + .*\.snap| |
| 18 | + .*\.snap\.new| |
| 19 | + .*\.ambr| |
| 20 | + .release-please-manifest.json| |
| 21 | + .*/snapshots/.* |
| 22 | + )$ |
| 23 | + - id: trailing-whitespace |
| 24 | + exclude: | |
| 25 | + (?x)^( |
| 26 | + specification/schema/.*| |
| 27 | + .*\.snap| |
| 28 | + .*\.ambr| |
| 29 | + .*\.snap\.new| |
| 30 | + .*/snapshots/.* |
| 31 | + )$ |
| 32 | + - id: fix-byte-order-marker |
| 33 | + - id: mixed-line-ending |
| 34 | + # Python-specific |
| 35 | + - id: check-ast |
| 36 | + - id: check-docstring-first |
| 37 | + - id: debug-statements |
| 38 | + |
| 39 | + - repo: local |
| 40 | + hooks: |
| 41 | + - id: ruff-format |
| 42 | + name: ruff format |
| 43 | + description: Format python code with `ruff`. |
| 44 | + entry: uv run ruff format |
| 45 | + language: system |
| 46 | + files: \.py$ |
| 47 | + pass_filenames: false |
| 48 | + - id: ruff-check |
| 49 | + name: ruff |
| 50 | + description: Check python code with `ruff`. |
| 51 | + entry: uv run ruff check --fix --exit-non-zero-on-fix |
| 52 | + language: system |
| 53 | + files: \.py$ |
| 54 | + pass_filenames: false |
| 55 | + - id: mypy-check |
| 56 | + name: mypy |
| 57 | + description: Check python code with `mypy`. |
| 58 | + entry: uv run mypy . |
| 59 | + language: system |
| 60 | + files: \.py$ |
| 61 | + pass_filenames: false |
| 62 | + - id: cargo-fmt |
| 63 | + name: cargo format |
| 64 | + description: Format rust code with `cargo fmt`. |
| 65 | + entry: cargo fmt --all -- --check |
| 66 | + language: system |
| 67 | + files: \.rs$ |
| 68 | + pass_filenames: false |
| 69 | + - id: cargo-check |
| 70 | + name: cargo check |
| 71 | + description: Check rust code with `cargo check`. |
| 72 | + entry: cargo check --all --all-features --workspace |
| 73 | + language: system |
| 74 | + files: \.rs$ |
| 75 | + pass_filenames: false |
| 76 | + - id: cargo-test |
| 77 | + name: cargo test |
| 78 | + description: |
| 79 | + Run tests with `cargo test`. |
| 80 | + # guppy tests require python/guppylang so use uv to run cargo test |
| 81 | + entry: uv run cargo test |
| 82 | + language: system |
| 83 | + files: \.rs$ |
| 84 | + pass_filenames: false |
| 85 | + - id: cargo-clippy |
| 86 | + name: cargo clippy |
| 87 | + description: Run clippy lints with `cargo clippy`. |
| 88 | + entry: cargo clippy --all-targets --all-features --workspace -- -D warnings |
| 89 | + language: system |
| 90 | + files: \.rs$ |
| 91 | + pass_filenames: false |
| 92 | + - id: cargo-doc |
| 93 | + name: cargo doc |
| 94 | + description: Generate documentation with `cargo doc`. |
| 95 | + entry: sh -c "RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features --workspace" |
| 96 | + language: system |
| 97 | + files: \.rs$ |
| 98 | + pass_filenames: false |
0 commit comments