-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
163 lines (163 loc) · 5.06 KB
/
.pre-commit-config.yaml
File metadata and controls
163 lines (163 loc) · 5.06 KB
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
# https://pre-commit.com/
#
# Before first use:
#
# $ pre-commit install
#
ci:
autofix_prs: false
autoupdate_schedule: quarterly
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
skip: [no-commit-to-branch]
fail_fast: false
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Sanity checks
- id: check-added-large-files
- id: check-case-conflict
# - id: check-executables-have-shebangs # No executable files yet
- id: check-illegal-windows-names
- id: check-merge-conflict
# Checks based on file type
- id: check-ast
# - id: check-json # No json files yet
- id: check-symlinks
- id: check-toml
# - id: check-xml # No xml files yet
- id: check-yaml
# Detect mistakes
- id: check-vcs-permalinks
- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: forbid-submodules
# Automatic fixes
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
# - id: requirements-txt-fixer # No requirements.txt file yet
- id: trailing-whitespace
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.24.1
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
# Remove unnecessary imports (currently behaves better than ruff)
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args: [--in-place]
# Let's keep `pyupgrade` even though `ruff --fix` probably does most of it
- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
hooks:
- id: pyupgrade
args: [--py310-plus]
# black often looks better than ruff-format
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [black==25.1.0]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.5
hooks:
- id: ruff-check
args: [--fix-only, --show-fixes]
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
types_or: [python, markdown, rst, toml, yaml]
additional_dependencies:
- tomli; python_version<'3.11'
- repo: https://github.com/MarcoGorelli/auto-walrus
rev: 0.3.4
hooks:
- id: auto-walrus
args: [--line-length, "100"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.5
hooks:
- id: ruff-check
# - id: ruff-format # Prefer black, but may temporarily uncomment this to see
# `pyroma` may help keep our package standards up to date if best practices change.
# This is probably a "low value" check though and safe to remove if we want faster pre-commit.
# - repo: https://github.com/regebro/pyroma
# rev: "5.0"
# hooks:
# - id: pyroma
# args: [-n, "9", .] # Need author email to score a 10
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.6.2
hooks:
- id: prettier
args: [--prose-wrap=preserve]
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.0
hooks:
- id: sphinx-lint
args: [--enable, all, "--disable=line-too-long,leaked-markup"]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-eval
- id: python-no-log-warn
- id: text-unicode-replacement-char
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
- repo: https://github.com/adrienverge/yamllint
rev: v1.37.1
hooks:
- id: yamllint
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.2
hooks:
- id: check-dependabot
- id: check-github-workflows
# TODO: get zizmor to pass, and maybe set it up as a github action
# - repo: https://github.com/woodruffw/zizmor-pre-commit
# rev: v1.11.0
# hooks:
# - id: zizmor
- repo: local
hooks:
- id: disallow-caps
name: Disallow improper capitalization
language: pygrep
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest|RST|PyLint
exclude: (.pre-commit-config.yaml|docs/pages/guides/style\.md)$
- id: disallow-words
name: Disallow certain words
language: pygrep
entry: "[Ff]alsey"
exclude: .pre-commit-config.yaml$
- id: disallow-bad-permalinks
name: Disallow _ in permalinks
language: pygrep
entry: "^permalink:.*_.*"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: no-commit-to-branch # No commit directly to main
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes