-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
82 lines (75 loc) · 3.22 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
82 lines (75 loc) · 3.22 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
# Hooks for pre-commit.ci, which runs org-wide on magpylib repos and fails a
# repo that has no config at all.
#
# Narrower than magpylib's own: this repo is half TypeScript, and
# `npm run compile` already runs tsc, ESLint and the two contribution checks
# over it, so the hooks here cover the Python and the things no other check
# looks at.
#
# Formatting is *not* among the omissions, whatever this comment used to say.
# ruff-format and prettier were turned on deliberately (e6013f3): being the one
# repo in the org that formats differently is a cost paid by every person who
# touches it. Note that prettier is scoped by `types_or` below and TypeScript
# is not in the list — .ts files are shaped by ESLint alone, and running
# prettier over them by hand reformats a thousand lines nobody asked about.
#
# The one thing to know: `autoupdate_schedule` bumps the formatter versions,
# and a new version formats differently. Let the autoupdate pull request's own
# hook run finish before merging it, so the bump and the reformat it implies
# travel together — merged apart, the difference lands on whoever opens the
# next pull request, as a commit they did not write.
ci:
autoupdate_commit_msg: "chore(deps): update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
autoupdate_schedule: "monthly"
exclude: ^vscode-extension/(node_modules|out|\.vscode-test)/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v6.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: check-json
# VS Code's own config files are JSONC — comments and all — which it
# reads happily and a strict JSON parser does not. Any .vscode/, not
# just the root one: sandbox/ has its own, naming the interpreter the
# Extension Development Host should use. The schema files and
# package.json, which have to be real JSON, are still checked.
exclude: (^|/)\.vscode/|/jsconfig\.json$
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/rbubley/mirrors-prettier
rev: "v3.9.6"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, javascript, json]
args: [--prose-wrap=always]
# VS Code's own config files are JSONC, which prettier parses as
# strict JSON and chokes on.
exclude: (^|/)\.vscode/|/jsconfig\.json$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.16.1"
hooks:
- id: ruff-check
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: "v2.4.3"
hooks:
- id: codespell
# British spelling is used throughout the prose on purpose.
args: ["--ignore-words-list=recognise,recognised,minimise,behaviour"]
- repo: https://github.com/abravalheri/validate-pyproject
rev: "v0.25"
hooks:
- id: validate-pyproject
additional_dependencies: ["validate-pyproject-schema-store[all]"]
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.37.4"
hooks:
- id: check-github-workflows