-
Notifications
You must be signed in to change notification settings - Fork 354
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
169 lines (152 loc) · 4.81 KB
/
.pre-commit-config.yaml
File metadata and controls
169 lines (152 loc) · 4.81 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
164
165
166
167
168
169
# pre-commit is a framework for running code quality checks and making
# automated fixes. These checks are defined below as "hooks", which each
# run a specific tool or perform a specific check.
#
# All of these hooks are run on every pull request via pre-commit.ci. To
# apply all pre-commit autofixes on a pull request, add the following
# comment to the conversation tab:
#
# pre-commit.ci autofix
#
# To perform all checks and apply all autofixes, run:
#
# pre-commit run --all-files
#
# For more information, please refer to the following resources.
#
# PlasmaPy Contributor Guide: https://docs.plasmapy.org/en/latest/contributing/pre-commit.html
# pre-commit.ci configuration: https://pre-commit.ci/#configuration
# pre-commit docs: https://pre-commit.com/#adding-pre-commit-plugins-to-your-project
ci:
autofix_prs: false
autoupdate_schedule: monthly
# skip hooks that require network access, which pre-commit.ci forbids
skip: [uv-lock]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-ast
name: validate Python code
- id: trailing-whitespace
exclude: .*\.py # use ruff format instead
- id: end-of-file-fixer
exclude: .*\.py
- id: check-merge-conflict
exclude: .*\.rst
- id: check-case-conflict
- id: check-illegal-windows-names
- id: name-tests-test
args: [--pytest-test-first]
exclude: src/plasmapy/tests/_helpers/.*
- id: detect-private-key
- id: fix-byte-order-marker
- id: mixed-line-ending
args: [--fix=lf]
- id: forbid-submodules
- id: check-json
- id: check-toml
- id: check-yaml
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.16.0
hooks:
- id: pretty-format-yaml
args: [--autofix]
# Labels with spaces must be put in quotes in `labeler.yml`.
# pretty-format-yaml removes those quotes and breaks the action.
exclude: .github/labeler.yml
- id: pretty-format-ini
args: [--autofix]
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.0
hooks:
- id: check-github-workflows
- repo: https://github.com/sirosen/texthooks
rev: 0.7.1
hooks:
- id: fix-smartquotes
- id: fix-spaces
- id: fix-ligatures
- id: forbid-bidi-controls
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
# skip the hooks in this repo covered by ruff rules
hooks:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
name: codespell (add false positives to pyproject.toml)
args: [--write-changes]
exclude: CITATION.cff
- repo: https://github.com/adhtruong/mirrors-typos
# use mirrors-typos because `pre-commit autoupdate` drops the version
# of the primary typos repo from v1.x.y to v1
rev: v1.44.0
hooks:
- id: typos
name: typos (add false positives to _typos.toml)
exclude: CITATION.cff|docs/notebooks/dispersion/stix_dispersion.ipynb
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.4
hooks:
- id: ruff-check
name: ruff-check (see https://docs.astral.sh/ruff/rules)
args: [--fix]
- id: ruff-format
- repo: https://github.com/asottile/blacken-docs
rev: 1.20.0
hooks:
- id: blacken-docs
name: autoformat code blocks in docs
# docstrings are formatted using the ruff-format hook
exclude: docs/contributing/coding_guide.rst|.*\.py
additional_dependencies:
- black==25.9.0
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.2
hooks:
- id: sphinx-lint
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.25
hooks:
- id: validate-pyproject
name: validate pyproject.toml
additional_dependencies: ['validate-pyproject-schema-store[all]>=2026']
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.16.2
hooks:
- id: pyproject-fmt
name: format pyproject.toml
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.10.7
hooks:
# running uv lock requires network access or a warm cache, so it
# cannot be run via pre-commit.ci, even with the `--offline`,
# `--no-index`, and/or `--check` flags
- id: uv-lock
name: uv-lock (skipped in CI; use `nox -s requirements` for problems)
- repo: https://github.com/hukkin/mdformat
rev: 1.0.0
hooks:
- id: mdformat
name: format .md files
# skip wrapping line length to preserve semantic line breaks and
# avoid messing up GitHub formatting of files in .github/content
exclude: licenses/.*|LICENSE.md|PATENT.md
additional_dependencies:
- mdformat-footnote
- mdformat-gfm
- mdformat-gfm-alerts
- mdformat-ruff
- repo: local
hooks:
- id: cff
name: validate CITATION.cff
entry: cffconvert --validate
language: python
additional_dependencies: [cffconvert]
pass_filenames: false