|
1 |
| -# See https://pre-commit.com for more information |
2 |
| -# See https://pre-commit.com/hooks.html for more hooks |
| 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 |
3 | 14 | repos:
|
| 15 | +# Standard hooks |
4 | 16 | - repo: https://github.com/pre-commit/pre-commit-hooks
|
5 |
| - rev: v4.0.1 |
| 17 | + rev: "v4.1.0" |
6 | 18 | hooks:
|
7 |
| - - id: trailing-whitespace |
8 |
| - exclude: \.(xlsx|zip)$|data|\.idea |
9 |
| - - id: end-of-file-fixer |
10 |
| - exclude: \.(xlsx|zip)$|data|docs|\.idea |
11 |
| - - id: check-yaml |
12 |
| - - id: check-toml |
13 |
| - - id: check-added-large-files |
| 19 | + - id: check-added-large-files |
| 20 | + - id: check-case-conflict |
| 21 | +# - id: check-docstring-first |
| 22 | + - id: check-merge-conflict |
| 23 | + - id: check-symlinks |
| 24 | + - id: check-toml |
| 25 | + - id: check-yaml |
| 26 | + - id: debug-statements |
| 27 | + - id: end-of-file-fixer |
| 28 | + exclude: data|.ipynb$|^\. |
| 29 | + - id: mixed-line-ending |
| 30 | + - id: requirements-txt-fixer |
| 31 | + - id: trailing-whitespace |
| 32 | + exclude: data|.ipynb$ |
| 33 | +# TODO dvp: return rstcheck, fix docs files for that |
14 | 34 | - repo: https://github.com/myint/rstcheck
|
15 | 35 | rev: 3f92957
|
16 | 36 | hooks:
|
17 | 37 | - id: rstcheck
|
18 | 38 | - repo: local
|
19 | 39 | hooks:
|
| 40 | + # Nicely sort includes |
20 | 41 | - id: isort
|
21 | 42 | name: isort
|
22 |
| - exclude: dev|\.idea |
| 43 | + exclude: dev|\.idea|\.cache |
23 | 44 | entry: poetry run isort
|
24 | 45 | language: system
|
25 | 46 | types: [python]
|
| 47 | + # Black, the code formatter, natively supports pre-commit |
26 | 48 | - id: black
|
27 | 49 | name: black
|
28 | 50 | entry: poetry run black
|
29 | 51 | language: system
|
30 | 52 | types: [python]
|
31 |
| - - id: flake8 |
32 |
| - name: flake8 |
33 |
| - exclude: tests|runner|dev|\.idea |
34 |
| - entry: poetry run flake8 |
35 |
| - language: system |
36 |
| - types: [python] |
37 |
| -# - id: mypy |
38 |
| -# name: mypy |
39 |
| -# exclude: tests|runner|dev |
40 |
| -# entry: poetry run mypy |
| 53 | +# - id: flake8 |
| 54 | +# name: flake8 |
| 55 | +# entry: poetry run flake8 |
41 | 56 | # language: system
|
42 | 57 | # types: [python]
|
| 58 | +# Also code format the docs |
| 59 | +# - id: blacken-docs |
| 60 | +# name: blacken-docs |
| 61 | +# entry: poetry run blacken-docs |
| 62 | +# language: system |
| 63 | + |
| 64 | +# Changes tabs to spaces |
| 65 | +- repo: https://github.com/Lucas-C/pre-commit-hooks |
| 66 | + rev: "v1.1.13" |
| 67 | + hooks: |
| 68 | + - id: remove-tabs |
| 69 | + |
| 70 | +#- repo: https://github.com/sirosen/texthooks |
| 71 | +# rev: "0.3.1" |
| 72 | +# hooks: |
| 73 | +# - id: fix-ligatures |
| 74 | +# - id: fix-smartquotes |
| 75 | + |
| 76 | +# Autoremoves unused imports |
| 77 | +- repo: https://github.com/hadialqattan/pycln |
| 78 | + rev: "v1.2.5" |
| 79 | + hooks: |
| 80 | + - id: pycln |
| 81 | + additional_dependencies: [click<8.1] # TODO Unpin when typer updates |
| 82 | + stages: [manual] |
| 83 | + |
| 84 | +# Checking for common mistakes |
| 85 | +#- repo: https://github.com/pre-commit/pygrep-hooks |
| 86 | +# rev: "v1.9.0" |
| 87 | +# hooks: |
| 88 | +# - id: python-check-blanket-noqa |
| 89 | +# - id: python-check-blanket-type-ignore |
| 90 | +# - id: python-no-log-warn |
| 91 | +# - id: python-use-type-annotations |
| 92 | +# - id: rst-backticks |
| 93 | +# - id: rst-directive-colons |
| 94 | +# - id: rst-inline-touching-normal |
| 95 | + |
| 96 | +# Automatically remove noqa that are not used |
| 97 | +- repo: https://github.com/asottile/yesqa |
| 98 | + rev: "v1.3.0" |
| 99 | + hooks: |
| 100 | + - id: yesqa |
| 101 | + additional_dependencies: &flake8_dependencies |
| 102 | + - flake8-bugbear |
| 103 | + - pep8-naming |
| 104 | + |
| 105 | +# Flake8 also supports pre-commit natively (same author) |
| 106 | +#- repo: https://github.com/PyCQA/flake8 |
| 107 | +# rev: "4.0.1" |
| 108 | +# hooks: |
| 109 | +# - id: flake8 |
| 110 | +# exclude: ^(docs/.*|tools/.*)$ |
| 111 | +# additional_dependencies: *flake8_dependencies |
| 112 | + |
| 113 | +# PyLint has native support - not always usable, but works for us |
| 114 | +#- repo: https://github.com/PyCQA/pylint |
| 115 | +# rev: "v2.13.4" |
| 116 | +# hooks: |
| 117 | +# - id: pylint |
| 118 | +# files: ^pybind11 |
| 119 | + |
| 120 | +# CMake formatting |
| 121 | +#- repo: https://github.com/cheshirekow/cmake-format-precommit |
| 122 | +# rev: "v0.6.13" |
| 123 | +# hooks: |
| 124 | +# - id: cmake-format |
| 125 | +# additional_dependencies: [pyyaml] |
| 126 | +# types: [file] |
| 127 | +# files: (\.cmake|CMakeLists.txt)(.in)?$ |
| 128 | + |
| 129 | +# Check static types with mypy |
| 130 | +#- repo: https://github.com/pre-commit/mirrors-mypy |
| 131 | +# rev: "v0.942" |
| 132 | +# hooks: |
| 133 | +# - id: mypy |
| 134 | +# args: [--show-error-codes] |
| 135 | +# exclude: ^(tests|docs)/ |
| 136 | +# additional_dependencies: [nox, rich] |
| 137 | + |
| 138 | +# Checks the manifest for missing files (native support) |
| 139 | +#- repo: https://github.com/mgedmin/check-manifest |
| 140 | +# rev: "0.48" |
| 141 | +# hooks: |
| 142 | +# - id: check-manifest |
| 143 | +# # This is a slow hook, so only run this if --hook-stage manual is passed |
| 144 | +# stages: [manual] |
| 145 | +# additional_dependencies: [cmake, ninja] |
| 146 | + |
| 147 | +# Check for spelling |
| 148 | +#- repo: https://github.com/codespell-project/codespell |
| 149 | +# rev: "v2.1.0" |
| 150 | +# hooks: |
| 151 | +# - id: codespell |
| 152 | +# exclude: ".supp$" |
| 153 | +# args: ["-L", "nd,ot,thist"] |
| 154 | + |
| 155 | +# Check for common shell mistakes |
| 156 | +- repo: https://github.com/shellcheck-py/shellcheck-py |
| 157 | + rev: "v0.8.0.4" |
| 158 | + hooks: |
| 159 | + - id: shellcheck |
| 160 | + stages: [manual] |
| 161 | + |
| 162 | +# Disallow some common capitalization mistakes |
| 163 | +#- repo: local |
| 164 | +# hooks: |
| 165 | +# - id: disallow-caps |
| 166 | +# name: Disallow improper capitalization |
| 167 | +# language: pygrep |
| 168 | +# entry: PyBind|Numpy|Cmake|CCache|PyTest |
| 169 | +# exclude: ^\.pre-commit-config.yaml$ |
| 170 | + |
| 171 | +# Clang format the codebase automatically |
| 172 | +#- repo: https://github.com/pre-commit/mirrors-clang-format |
| 173 | +# rev: "v13.0.1" |
| 174 | +# hooks: |
| 175 | +# - id: clang-format |
| 176 | +# types_or: [c++, c, cuda] |
0 commit comments