-
Notifications
You must be signed in to change notification settings - Fork 103
/
.pre-commit-config.yaml
198 lines (184 loc) · 5.42 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
---
default_language_version:
# ensures that we get same behavior on CI(s) as on local machines
python: python3.11
exclude: >
(?x)^(
_readthedocs|
.tox
)$
repos:
- repo: https://github.com/pycontribs/mirrors-prettier
rev: "v3.3.3"
hooks:
- id: prettier
# Original hook implementation is flaky due to *several* bugs described
# in https://github.com/prettier/prettier/issues/12364
# a) CI=1 needed to avoid incomplete output
# b) two executions are needed because --list-different works correctly
# only when run with --check as with --write the output will also
# include other entries and logging level cannot be used to keep only
# modified files listed (any file is listes using the log level, regardless if
# is modified or not).
# c) We avoid letting pre-commit pass each filename in order to avoid
# runing multiple instances in parallel. This also ensures that running
# prettier from the command line behaves identically with the pre-commit
# one. No real performance downsides.
# d) exit with the return code from list-different (0=none, 1=some)
# rather than the write (0=successfully rewrote files). pre-commit.ci
entry: env CI=1 bash -c "prettier --list-different . || ec=$? && prettier --loglevel=error --write . && exit $ec"
pass_filenames: false
args: []
additional_dependencies:
- prettier
- prettier-plugin-toml
- repo: https://github.com/psf/black.git
rev: 24.10.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.1
hooks:
- id: toml-sort-fix
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.7.4"
hooks:
- id: ruff
args:
- "--exit-non-zero-on-fix"
- repo: https://github.com/streetsidesoftware/cspell-cli
rev: v8.16.0
hooks:
- id: cspell
name: Spell check with cspell
- repo: https://github.com/Lucas-C/pre-commit-hooks.git
rev: v1.5.5
hooks:
- id: remove-tabs
exclude: >
(?x)^(
.config/pylint-baseline.txt
)$
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v5.0.0
hooks:
# Side-effects:
- id: trailing-whitespace
- id: check-merge-conflict
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: check-added-large-files
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-symlinks
- id: check-yaml
exclude: >
(?x)^
(
mkdocs.yml
)
$
- id: detect-private-key
# Heavy checks:
- id: check-ast
- id: debug-statements
- repo: https://gitlab.com/bmares/check-json5
# Allow json comments, trailing commas
# https://github.com/pre-commit/pre-commit-hooks/issues/395
rev: v1.0.0
hooks:
- id: check-json5
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.42.0
hooks:
- id: markdownlint
exclude: >
(?x)^
(
\.github/ISSUE_TEMPLATE/\w+|
docs/(
faq|
index|
)|
README|
src/ansible_navigator/data/(help|welcome)
)\.md
$
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
# NOTE: dout is part of the stdout action regex
args: ["-L", "dout"]
# We exclude generated and external files as they are not directly under
# our control, so we cannot fix spelling in them.
exclude: >
(?x)^
(
tests/fixtures/integration/actions/.*\.json|
src/ansible_navigator/data/grammar/.*\.json
)
$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
args:
- --strict
types: [file, yaml]
- repo: https://github.com/PyCQA/flake8.git
rev: 7.1.1
hooks:
- id: flake8
language_version: python3
additional_dependencies:
- flake8-docstrings # uses pydocstyle
- repo: https://github.com/jsh9/pydoclint
rev: 0.5.9
hooks:
- id: pydoclint
- repo: https://github.com/asottile/pyupgrade
# keep it after flake8
rev: v3.19.0
hooks:
- id: pyupgrade
args: ["--py310-plus"]
- repo: https://github.com/pre-commit/mirrors-mypy.git
rev: v1.13.0
hooks:
- id: mypy
additional_dependencies:
- ansible-core
- jinja2
- libtmux
- pytest
- pytest-mock
- types-backports
- types-docutils
- types-mock
- types-PyYAML
- types-setuptools # Needed logging version
- types-typed-ast
- repo: https://github.com/pycqa/pylint.git
rev: v3.3.1
hooks:
- id: pylint
args:
- docs/
- src/
- tests/
additional_dependencies:
- ansible-core
- ansible-runner
- astroid
- dill>=0.3.6 # needed for py311
- jinja2
- jsonschema
- libtmux
- mkdocs-gen-files
- onigurumacffi
- pytest
- pytest-mock
- setuptools-scm
pass_filenames: false