|
1 | 1 | ci:
|
2 | 2 | autofix_commit_msg: 'refactor(lint): apply automatic lint fixes'
|
3 | 3 | autoupdate_commit_msg: 'chore(deps): bump pre-commit linter versions'
|
| 4 | + skip: [terraform_fmt, terraform_validate] |
| 5 | + |
| 6 | +default_install_hook_types: |
| 7 | + - commit-msg |
| 8 | + - pre-commit |
4 | 9 |
|
5 | 10 | default_language_version:
|
6 | 11 | python: python3.11
|
7 | 12 |
|
8 | 13 | repos:
|
9 |
| -- repo: https://github.com/pre-commit/pre-commit-hooks |
10 |
| - rev: v4.4.0 |
11 |
| - hooks: |
12 |
| - - id: check-case-conflict |
13 |
| - - id: check-executables-have-shebangs |
14 |
| - - id: check-json |
15 |
| - - id: check-merge-conflict |
16 |
| - - id: check-shebang-scripts-are-executable |
17 |
| - - id: check-symlinks |
18 |
| - - id: check-toml |
19 |
| - - id: check-vcs-permalinks |
20 |
| - - id: check-xml |
21 |
| - - id: check-yaml |
| 14 | + - repo: https://github.com/compilerla/conventional-pre-commit |
| 15 | + rev: v3.1.0 |
| 16 | + hooks: |
| 17 | + - id: conventional-pre-commit |
| 18 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 19 | + rev: v4.5.0 |
| 20 | + hooks: |
| 21 | + - id: check-case-conflict |
| 22 | + - id: check-executables-have-shebangs |
| 23 | + - id: check-json |
| 24 | + - id: check-merge-conflict |
| 25 | + - id: check-shebang-scripts-are-executable |
| 26 | + - id: check-symlinks |
| 27 | + - id: check-toml |
| 28 | + - id: check-vcs-permalinks |
| 29 | + - id: check-xml |
| 30 | + - id: check-yaml |
22 | 31 | args: [--allow-multiple-documents]
|
23 |
| - - id: detect-private-key |
24 |
| - - id: end-of-file-fixer |
25 |
| - - id: mixed-line-ending |
| 32 | + - id: detect-private-key |
| 33 | + - id: end-of-file-fixer |
| 34 | + - id: mixed-line-ending |
26 | 35 | args: [--fix=lf]
|
27 |
| - - id: trailing-whitespace |
| 36 | + - id: trailing-whitespace |
28 | 37 |
|
29 |
| -# rst |
30 |
| -- repo: https://github.com/pre-commit/pygrep-hooks |
| 38 | +# python |
| 39 | + - id: check-ast |
| 40 | + - id: check-builtin-literals |
| 41 | + - id: check-docstring-first |
| 42 | + - id: debug-statements |
| 43 | + - id: double-quote-string-fixer |
| 44 | + - id: name-tests-test |
| 45 | + - id: requirements-txt-fixer |
| 46 | + - repo: https://github.com/PyCQA/pylint |
| 47 | + rev: v3.0.3 |
| 48 | + hooks: |
| 49 | + # TODO: pylint-import-modules support for pylint v3 (or alternative linter) |
| 50 | + - id: pylint |
| 51 | + args: |
| 52 | + - --load-plugins=pylint.extensions.mccabe |
| 53 | + - --max-complexity=10 |
| 54 | + - --max-line-length=79 |
| 55 | + - --max-module-lines=500 |
| 56 | + - --max-args=10 |
| 57 | + - --score=n |
| 58 | + # TODO: narrow these down |
| 59 | + - -d broad-except |
| 60 | + - -d duplicate-code |
| 61 | + - -d fixme |
| 62 | + - -d import-error |
| 63 | + - -d invalid-name |
| 64 | + - -d locally-disabled |
| 65 | + - -d missing-docstring |
| 66 | + - -d too-few-public-methods |
| 67 | + - -d try-except-raise |
| 68 | + - -d ungrouped-imports # conflicts with reorder-python-imports |
| 69 | + - -d wrong-import-order # conflicts with reorder-python-imports |
| 70 | + - repo: https://github.com/Lucas-C/pre-commit-hooks |
| 71 | + rev: v1.5.4 |
| 72 | + hooks: |
| 73 | + - id: remove-crlf |
| 74 | + - id: remove-tabs |
| 75 | + exclude: 'Makefile' |
| 76 | + - repo: https://github.com/asottile/reorder-python-imports |
| 77 | + rev: v3.12.0 |
| 78 | + hooks: |
| 79 | + - id: reorder-python-imports |
| 80 | + args: [--py311-plus] |
| 81 | + - repo: https://github.com/asottile/pyupgrade |
| 82 | + rev: v3.15.0 |
| 83 | + hooks: |
| 84 | + - id: pyupgrade |
| 85 | + args: [--py311-plus] |
| 86 | + - repo: https://github.com/asottile/add-trailing-comma |
| 87 | + rev: v3.1.0 |
| 88 | + hooks: |
| 89 | + - id: add-trailing-comma |
| 90 | + - repo: https://github.com/pre-commit/mirrors-mypy |
| 91 | + rev: v1.8.0 |
| 92 | + hooks: |
| 93 | + - id: mypy |
| 94 | + require_serial: True |
| 95 | + # N.B. mypy requires an installed version of whatever third-party |
| 96 | + # library it is asked to check against. In practice, that means |
| 97 | + # whenever we see an error telling us to do so, we should add the |
| 98 | + # relevant library to `additional_dependencies`. |
| 99 | + # Note that some libraries keep their type hints in packages named |
| 100 | + # `types-$lib` or `$lib-stubs`. |
| 101 | + additional_dependencies: [] |
| 102 | + args: |
| 103 | + - --show-error-codes |
| 104 | + - --strict |
| 105 | + - --strict-equality |
| 106 | + - --warn-unreachable |
| 107 | + - repo: https://github.com/asottile/yesqa |
| 108 | + rev: v1.5.0 |
| 109 | + hooks: |
| 110 | + - id: yesqa |
| 111 | + # N.B. keep these in sync with flake8, otherwise yesqa will remove |
| 112 | + # required noqa's related to these plugins |
| 113 | + additional_dependencies: &flake8deps |
| 114 | + - flake8-2020==1.8.1 |
| 115 | + - flake8-broken-line==1.0.0 |
| 116 | + - flake8-builtins==2.2.0 |
| 117 | + - flake8-commas==2.1.0 |
| 118 | + - flake8-comprehensions==3.14.0 |
| 119 | + - flake8-typing-imports==1.15.0 |
| 120 | + - repo: https://github.com/hhatto/autopep8 |
| 121 | + rev: v2.0.4 |
| 122 | + hooks: |
| 123 | + - id: autopep8 |
| 124 | + args: [-a, -i, -p2] |
| 125 | + - repo: https://github.com/PyCQA/pydocstyle |
| 126 | + rev: 6.3.0 |
| 127 | + hooks: |
| 128 | + - id: pydocstyle |
| 129 | + args: |
| 130 | + - --ignore=D1,D203,D205,D212,D400,D401,D404,D407,D412,D413 |
| 131 | + - repo: https://github.com/PyCQA/flake8 |
| 132 | + rev: 7.0.0 |
| 133 | + hooks: |
| 134 | + - id: flake8 |
| 135 | + additional_dependencies: *flake8deps |
| 136 | + args: |
| 137 | + # https://www.flake8rules.com/ |
| 138 | + # E501: Line too long. Covered by autopep8. |
| 139 | + # E741: Do not use variables named 'I', 'O', or 'l'. |
| 140 | + # W503: Line break occurred before a binary operator. Breaks PEP8. |
| 141 | + - --ignore=E501,E741,W503 |
| 142 | + - --min-python-version=3.11 |
| 143 | + - repo: https://github.com/dosisod/refurb |
| 144 | + rev: v1.27.0 |
| 145 | + hooks: |
| 146 | + - id: refurb |
| 147 | + args: |
| 148 | + - --python-version |
| 149 | + - '3.11' |
| 150 | + - repo: local |
| 151 | + hooks: |
| 152 | + - id: poetry-check |
| 153 | + name: check pyproject.toml validity |
| 154 | + description: 'Validate the structure of the pyproject.toml file' |
| 155 | + entry: bash -c 'set -e; for toml in "$@"; do pushd ./${toml%pyproject.toml}; poetry check; popd; done' -- |
| 156 | + language: python |
| 157 | + additional_dependencies: |
| 158 | + - poetry>=1.5.0 |
| 159 | + pass_filenames: true |
| 160 | + files: 'pyproject\.toml$' |
| 161 | + - id: poetry-use-version-ranges |
| 162 | + name: avoid using carets for version ranges |
| 163 | + description: 'Avoid using carets for version ranges' |
| 164 | + entry: '\^' |
| 165 | + language: pygrep |
| 166 | + types: [toml] |
| 167 | + files: 'pyproject.toml$' |
| 168 | + - id: pytest-fixtures-require-scope |
| 169 | + name: ensure pytest fixture scopes are explicitly set |
| 170 | + description: 'Ensure we explicitly set pytest fixture scopes' |
| 171 | + entry: '@pytest\.fixture( |\n|(\(\)))' |
| 172 | + language: pygrep |
| 173 | + types: [python] |
| 174 | + - repo: https://github.com/pre-commit/pygrep-hooks |
31 | 175 | rev: v1.10.0
|
32 | 176 | hooks:
|
33 |
| - - id: rst-backticks |
34 |
| - - id: rst-directive-colons |
35 |
| - - id: rst-inline-touching-normal |
| 177 | + - id: python-no-eval |
| 178 | + - id: python-no-log-warn |
| 179 | + - id: python-use-type-annotations |
| 180 | + |
| 181 | +# rst |
| 182 | + - id: rst-backticks |
| 183 | + - id: rst-directive-colons |
| 184 | + - id: rst-inline-touching-normal |
36 | 185 |
|
37 | 186 | # json
|
38 |
| -- repo: https://github.com/python-jsonschema/check-jsonschema |
39 |
| - rev: 0.24.1 |
40 |
| - hooks: |
41 |
| - - id: check-github-workflows |
42 |
| - - id: check-renovate |
43 |
| - additional_dependencies: |
44 |
| - - pyjson5 |
| 187 | + - repo: https://github.com/python-jsonschema/check-jsonschema |
| 188 | + rev: 0.27.3 |
| 189 | + hooks: |
| 190 | + - id: check-github-workflows |
| 191 | + - id: check-renovate |
| 192 | + additional_dependencies: |
| 193 | + - pyjson5 |
| 194 | + |
| 195 | +# docker |
| 196 | + - repo: https://github.com/AleksaC/hadolint-py |
| 197 | + rev: v2.12.0.2 |
| 198 | + hooks: |
| 199 | + - id: hadolint |
| 200 | + args: |
| 201 | + - --ignore=DL3025 |
| 202 | + |
| 203 | +# java |
| 204 | + - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks |
| 205 | + rev: v2.12.0 |
| 206 | + hooks: |
| 207 | + - id: pretty-format-java |
| 208 | + args: [--autofix] |
| 209 | + |
| 210 | +# kotlin |
| 211 | + - id: pretty-format-kotlin |
| 212 | + args: [--autofix] |
45 | 213 |
|
46 | 214 | # javascript
|
47 |
| -- repo: https://github.com/pre-commit/mirrors-fixmyjs |
| 215 | + - repo: https://github.com/pre-commit/mirrors-fixmyjs |
48 | 216 | rev: v2.0.0
|
49 | 217 | hooks:
|
50 |
| - - id: fixmyjs |
51 |
| -# TODO: enable me |
52 |
| -# - repo: https://github.com/pre-commit/mirrors-jshint |
| 218 | + - id: fixmyjs |
| 219 | + exclude: '(.*.min.js)' |
| 220 | +# TODO: fixme |
| 221 | +# - repo: https://github.com/pre-commit/mirrors-jshint |
53 | 222 | # rev: v2.13.6
|
54 | 223 | # hooks:
|
55 |
| -# - id: jshint |
| 224 | +# - id: jshint |
| 225 | +# exclude: '(.*.min.js)' |
| 226 | + |
| 227 | +# terraform |
| 228 | + - repo: https://github.com/antonbabenko/pre-commit-terraform |
| 229 | + rev: v1.86.0 |
| 230 | + hooks: |
| 231 | + - id: terraform_fmt |
| 232 | + - id: terraform_validate |
| 233 | + |
| 234 | +# shell |
| 235 | + - repo: https://github.com/lovesegfault/beautysh |
| 236 | + rev: v6.2.1 |
| 237 | + hooks: |
| 238 | + - id: beautysh |
| 239 | + - repo: https://github.com/openstack/bashate |
| 240 | + rev: 2.1.1 |
| 241 | + hooks: |
| 242 | + - id: bashate |
| 243 | + args: [--max-line-length=80] |
| 244 | + - repo: https://github.com/shellcheck-py/shellcheck-py |
| 245 | + rev: v0.9.0.6 |
| 246 | + hooks: |
| 247 | + - id: shellcheck |
| 248 | + - repo: https://github.com/jumanjihouse/pre-commit-hooks |
| 249 | + rev: 3.0.0 |
| 250 | + hooks: |
| 251 | + - id: script-must-not-have-extension |
0 commit comments