|
| 1 | +# To use: |
| 2 | +# |
| 3 | +# pre-commit run -a |
| 4 | +# |
| 5 | +# Or: |
| 6 | +# |
| 7 | +# pre-commit install # (runs every time you commit in git) |
| 8 | +# |
| 9 | +# To update this file: |
| 10 | +# |
| 11 | +# pre-commit autoupdate |
| 12 | +# |
| 13 | +# See https://github.com/pre-commit/pre-commit |
| 14 | + |
| 15 | +ci: |
| 16 | + autoupdate_commit_msg: "chore: update pre-commit hooks" |
| 17 | + autofix_commit_msg: "style: pre-commit fixes" |
| 18 | + |
| 19 | +repos: |
| 20 | +# Standard hooks |
| 21 | +- repo: https://github.com/pre-commit/pre-commit-hooks |
| 22 | + rev: v4.4.0 |
| 23 | + hooks: |
| 24 | + - id: check-added-large-files |
| 25 | + - id: check-case-conflict |
| 26 | + - id: check-merge-conflict |
| 27 | + - id: check-symlinks |
| 28 | + - id: check-yaml |
| 29 | + exclude: ^conda\.recipe/meta\.yaml$ |
| 30 | + - id: debug-statements |
| 31 | + - id: end-of-file-fixer |
| 32 | + - id: mixed-line-ending |
| 33 | + - id: requirements-txt-fixer |
| 34 | + - id: trailing-whitespace |
| 35 | + |
| 36 | +# Black, the code formatter, natively supports pre-commit |
| 37 | +- repo: https://github.com/psf/black |
| 38 | + rev: 23.1.0 |
| 39 | + hooks: |
| 40 | + - id: black |
| 41 | + exclude: ^(docs) |
| 42 | + |
| 43 | +- repo: https://github.com/charliermarsh/ruff-pre-commit |
| 44 | + rev: "v0.0.252" |
| 45 | + hooks: |
| 46 | + - id: ruff |
| 47 | + args: ["--fix", "--show-fixes"] |
| 48 | + |
| 49 | +# Checking static types |
| 50 | +- repo: https://github.com/pre-commit/mirrors-mypy |
| 51 | + rev: "v1.0.1" |
| 52 | + hooks: |
| 53 | + - id: mypy |
| 54 | + files: "setup.py" |
| 55 | + args: [] |
| 56 | + additional_dependencies: [types-setuptools] |
| 57 | + |
| 58 | +# Changes tabs to spaces |
| 59 | +- repo: https://github.com/Lucas-C/pre-commit-hooks |
| 60 | + rev: v1.4.2 |
| 61 | + hooks: |
| 62 | + - id: remove-tabs |
| 63 | + exclude: ^(docs) |
| 64 | + |
| 65 | +# CMake formatting |
| 66 | +- repo: https://github.com/cheshirekow/cmake-format-precommit |
| 67 | + rev: v0.6.13 |
| 68 | + hooks: |
| 69 | + - id: cmake-format |
| 70 | + additional_dependencies: [pyyaml] |
| 71 | + types: [file] |
| 72 | + files: (\.cmake|CMakeLists.txt)(.in)?$ |
| 73 | + |
| 74 | +# Suggested hook if you add a .clang-format file |
| 75 | +# - repo: https://github.com/pre-commit/mirrors-clang-format |
| 76 | +# rev: v13.0.0 |
| 77 | +# hooks: |
| 78 | +# - id: clang-format |
0 commit comments