-
-
Notifications
You must be signed in to change notification settings - Fork 32
⬆️ Update prek checks
#925
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,173 +1,164 @@ | ||
| # To run all pre-commit checks, use: | ||
| # | ||
| # pre-commit run -a | ||
| # uvx prek run -a | ||
| # | ||
| # To install pre-commit hooks that run every time you commit: | ||
| # | ||
| # pre-commit install | ||
| # uv tool install prek | ||
| # prek install | ||
| # | ||
|
|
||
| ci: | ||
| autoupdate_commit_msg: "⬆️🪝 update pre-commit hooks" | ||
| autofix_commit_msg: "🎨 pre-commit fixes" | ||
| autoupdate_schedule: quarterly | ||
| autofix_commit_msg: "🎨 pre-commit fixes" | ||
| skip: [ty-check] | ||
|
|
||
| repos: | ||
| # Standard hooks | ||
| # Priority 0: Fast validation and independent fixers | ||
|
|
||
| ## Standard hooks | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: check-added-large-files | ||
| args: ["--maxkb=2048"] | ||
| - id: check-case-conflict | ||
| - id: check-vcs-permalinks | ||
| - id: check-merge-conflict | ||
| - id: check-symlinks | ||
| - id: check-json | ||
| - id: check-toml | ||
| - id: check-yaml | ||
| - id: debug-statements | ||
| priority: 0 | ||
| - id: end-of-file-fixer | ||
| - id: mixed-line-ending | ||
| priority: 1 | ||
| - id: trailing-whitespace | ||
| priority: 1 | ||
|
|
||
| # Clean jupyter notebooks | ||
| - repo: https://github.com/srstevenson/nb-clean | ||
| rev: 4.0.1 | ||
| ## Check the pyproject.toml file | ||
| - repo: https://github.com/henryiii/validate-pyproject-schema-store | ||
| rev: 2026.01.22 | ||
| hooks: | ||
| - id: nb-clean | ||
| args: | ||
| - --remove-empty-cells | ||
| - --preserve-cell-metadata | ||
| - raw_mimetype | ||
| - -- | ||
|
|
||
| # Handling unwanted unicode characters | ||
| - repo: https://github.com/sirosen/texthooks | ||
| rev: 0.7.1 | ||
| - id: validate-pyproject | ||
| priority: 0 | ||
|
|
||
| ## Check JSON schemata | ||
| - repo: https://github.com/python-jsonschema/check-jsonschema | ||
| rev: 0.36.0 | ||
| hooks: | ||
| - id: check-github-workflows | ||
| priority: 0 | ||
| - id: check-readthedocs | ||
| priority: 0 | ||
|
|
||
| ## Catch common capitalization mistakes | ||
| - repo: local | ||
| hooks: | ||
| - id: fix-ligatures | ||
| - id: fix-smartquotes | ||
| - id: disallow-caps | ||
| name: Disallow improper capitalization | ||
| language: pygrep | ||
| entry: Nanobind|Numpy|Cmake|CCache|Github|PyTest|Mqt|Tum | ||
| exclude: .pre-commit-config.yaml | ||
| priority: 0 | ||
|
|
||
| # Check for common mistakes | ||
| - repo: https://github.com/pre-commit/pygrep-hooks | ||
| rev: v1.10.0 | ||
| ## Check for spelling | ||
| - repo: https://github.com/adhtruong/mirrors-typos | ||
| rev: v1.42.1 | ||
| hooks: | ||
| - id: rst-backticks | ||
| - id: rst-directive-colons | ||
| - id: rst-inline-touching-normal | ||
| - id: typos | ||
| priority: 0 | ||
|
|
||
| # Check for license headers | ||
| ## Check best practices for scientific Python code | ||
| - repo: https://github.com/scientific-python/cookie | ||
| rev: 2025.11.21 | ||
| hooks: | ||
| - id: sp-repo-review | ||
| additional_dependencies: ["repo-review[cli]"] | ||
| priority: 0 | ||
|
|
||
| ## Check for license headers | ||
| - repo: https://github.com/emzeat/mz-lictools | ||
| rev: v2.9.0 | ||
| hooks: | ||
| - id: license-tools | ||
| priority: 0 | ||
|
|
||
| # Ensure uv lock file is up-to-date | ||
| ## Ensure uv lock file is up-to-date | ||
| - repo: https://github.com/astral-sh/uv-pre-commit | ||
| rev: 0.9.26 | ||
| hooks: | ||
| - id: uv-lock | ||
| priority: 0 | ||
|
|
||
| # Python linting using ruff | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.14.14 | ||
| hooks: | ||
| - id: ruff-check | ||
| - id: ruff-format | ||
|
|
||
| # Also run Black on examples in the documentation | ||
| - repo: https://github.com/adamchainz/blacken-docs | ||
| rev: 1.20.0 | ||
| hooks: | ||
| - id: blacken-docs | ||
| additional_dependencies: [black==25.*] | ||
|
|
||
| ## Static type checking using ty | ||
| - repo: local | ||
| ## Tidy up BibTeX files | ||
| - repo: https://github.com/FlamingTempura/bibtex-tidy | ||
| rev: v1.14.0 | ||
| hooks: | ||
| - id: ty-check | ||
| name: ty check | ||
| entry: uvx python -c "import subprocess; import sys; r = subprocess.run(['uv', 'sync', '--no-install-project', '--inexact']); sys.exit(r.returncode or subprocess.run(['uv', 'run', '--no-sync', 'ty', 'check']).returncode)" | ||
| language: unsupported | ||
| require_serial: true | ||
| types_or: [python, pyi, jupyter] | ||
| exclude: ^(docs/|eval/) | ||
| - id: bibtex-tidy | ||
| args: | ||
| [ | ||
| "--align=20", | ||
| "--curly", | ||
| "--months", | ||
| "--blank-lines", | ||
| "--sort", | ||
| "--strip-enclosing-braces", | ||
| "--sort-fields", | ||
| "--trailing-commas", | ||
| "--remove-empty-fields", | ||
| ] | ||
| priority: 0 | ||
|
|
||
| # Check for spelling | ||
| - repo: https://github.com/adhtruong/mirrors-typos | ||
| rev: v1.42.1 | ||
| hooks: | ||
| - id: typos | ||
| # Priority 1: Second-pass fixers | ||
|
|
||
| # Clang-format the C++ part of the code base automatically | ||
| ## Clang-format the C++ part of the code base automatically | ||
| - repo: https://github.com/pre-commit/mirrors-clang-format | ||
| rev: v21.1.8 | ||
| hooks: | ||
| - id: clang-format | ||
| types_or: [c++, c, cuda] | ||
| priority: 1 | ||
|
|
||
| # CMake format and lint the CMakeLists.txt files | ||
| ## CMake format and lint the CMakeLists.txt files | ||
| - repo: https://github.com/cheshirekow/cmake-format-precommit | ||
| rev: v0.6.13 | ||
| hooks: | ||
| - id: cmake-format | ||
| additional_dependencies: [pyyaml] | ||
| types: [file] | ||
| files: (\.cmake|CMakeLists.txt)(.in)?$ | ||
| priority: 1 | ||
|
|
||
| # Format configuration files with prettier | ||
| ## Format configuration files with prettier | ||
| - repo: https://github.com/rbubley/mirrors-prettier | ||
| rev: v3.8.1 | ||
| hooks: | ||
| - id: prettier | ||
| types_or: [yaml, markdown, html, css, scss, javascript, json] | ||
| priority: 1 | ||
|
|
||
| # Catch common capitalization mistakes | ||
| - repo: local | ||
| hooks: | ||
| - id: disallow-caps | ||
| name: Disallow improper capitalization | ||
| language: pygrep | ||
| entry: Nanobind|Numpy|Cmake|CCache|Github|PyTest|Mqt|Tum | ||
| exclude: .pre-commit-config.yaml | ||
|
|
||
| # Check best practices for scientific Python code | ||
| - repo: https://github.com/scientific-python/cookie | ||
| rev: 2025.11.21 | ||
| ## Python linting using ruff | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.14.14 | ||
| hooks: | ||
| - id: sp-repo-review | ||
| additional_dependencies: ["repo-review[cli]"] | ||
| - id: ruff-format | ||
| priority: 1 | ||
| - id: ruff-check | ||
| require_serial: true | ||
| priority: 2 | ||
|
|
||
| # Check JSON schemata | ||
| - repo: https://github.com/python-jsonschema/check-jsonschema | ||
| rev: 0.36.0 | ||
| hooks: | ||
| - id: check-dependabot | ||
| - id: check-github-workflows | ||
| - id: check-readthedocs | ||
| # Priority 2+: Final checks and fixers | ||
|
|
||
| # Check the pyproject.toml file | ||
| - repo: https://github.com/henryiii/validate-pyproject-schema-store | ||
| rev: 2026.01.22 | ||
| ## Also run Black on examples in the documentation (needs to run after ruff format) | ||
| - repo: https://github.com/adamchainz/blacken-docs | ||
| rev: 1.20.0 | ||
| hooks: | ||
| - id: validate-pyproject | ||
| - id: blacken-docs | ||
| language: python | ||
| additional_dependencies: [black==26.*] | ||
| priority: 2 | ||
|
|
||
| # Tidy up BibTeX files | ||
| - repo: https://github.com/FlamingTempura/bibtex-tidy | ||
| rev: v1.14.0 | ||
| ## Static type checking using ty (needs to run after lockfile update/ruff format, and ruff lint) | ||
| - repo: local | ||
| hooks: | ||
| - id: bibtex-tidy | ||
| args: | ||
| [ | ||
| "--align=20", | ||
| "--curly", | ||
| "--months", | ||
| "--blank-lines", | ||
| "--sort", | ||
| "--strip-enclosing-braces", | ||
| "--sort-fields", | ||
| "--trailing-commas", | ||
| "--remove-empty-fields", | ||
| ] | ||
| - id: ty-check | ||
| name: ty check | ||
| entry: uvx python -c "import subprocess; import sys; r = subprocess.run(['uv', 'sync', '--no-install-project', '--inexact']); sys.exit(r.returncode or subprocess.run(['uv', 'run', '--no-sync', 'ty', 'check']).returncode)" | ||
| language: unsupported | ||
| require_serial: true | ||
| types_or: [python, pyi, jupyter] | ||
| exclude: ^(docs/|eval/) | ||
| priority: 3 | ||
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.