Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
124 lines (119 loc) · 4.19 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
124 lines (119 loc) · 4.19 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
# Hooks for prek (https://prek.j178.dev), a fast, drop-in pre-commit runner.
# Run all hooks with `prek run --all-files` (or `pre-commit run --all-files`).
#
# Every tool that is also a project dependency runs through `uv run` as a local
# hook, so its version comes from uv.lock (the single source of truth) and can
# never drift from a separate `rev:` pin. Only tools that are not Python
# dependencies (the pre-commit file hooks, actionlint, prettier) stay pinned by
# `rev`; each has a single source, so it does not drift either.
ci:
# pre-commit.ci cannot run the `language: system` hooks below (they need uv or
# the Rust toolchain), so skip them there; CI enforces them via the dedicated
# uv-based workflows instead.
skip:
- ruff-check
- ruff-format
- mypy
- ty
- codespell
- zizmor
- cargo-fmt
- cargo-clippy
autofix_commit_msg: "chore(pre-commit): auto-fixes from hooks"
autoupdate_commit_msg: "chore(pre-commit): autoupdate hooks"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
exclude: ^tests/data/
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-toml
- id: check-json
- id: detect-private-key
- id: end-of-file-fixer
exclude: ^tests/data/
- id: mixed-line-ending
args: [--fix=lf]
exclude: ^tests/data/
- id: trailing-whitespace
exclude: ^tests/data/
# actionlint is a Go binary, not a Python dependency, so it stays pinned here.
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint
# `code-quality` is a current GitHub permission scope that actionlint
# does not recognize yet; ignore only that specific diagnostic.
args: ["-ignore", "code-quality"]
# Markdown / YAML / JS / JSON formatting for the docs site and configs.
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.4.2
hooks:
- id: prettier
types_or: [markdown, yaml, javascript, ts, json]
exclude: ^(tests/data/|Cargo\.lock$)
# TOML formatting. The hook installs the `taplo` PyPI package (which bundles
# the binary), so prek bootstraps it with no system dependency.
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format
# Local hooks: every tool runs through uv (or the repo's Rust toolchain), so
# the version is whatever uv.lock / the toolchain pins. No `rev:` to drift.
- repo: local
hooks:
- id: ruff-check
name: "🐶 Ruff linter"
language: system
types: [python]
entry: uv run --no-sync ruff check --fix
require_serial: true
- id: ruff-format
name: "🐶 Ruff formatter"
language: system
types: [python]
entry: uv run --no-sync ruff format
require_serial: true
- id: mypy
name: "🆎 Static typing with mypy"
language: system
types: [python]
files: ^pysrc/yamlrocks/
pass_filenames: false
entry: uv run --no-sync mypy pysrc/yamlrocks
require_serial: true
- id: ty
name: "🆎 Static typing with ty"
language: system
types: [python]
files: ^pysrc/yamlrocks/
pass_filenames: false
entry: uv run --no-sync ty check pysrc/yamlrocks
require_serial: true
- id: codespell
name: "🔤 Check for common misspellings"
language: system
types: [text]
entry: uv run --no-sync codespell
- id: zizmor
name: "🌈 Audit GitHub Actions workflows with zizmor"
language: system
types: [yaml]
files: ^\.github/workflows/
pass_filenames: false
entry: uv run --no-sync zizmor .github/workflows/ --persona=pedantic
- id: cargo-fmt
name: "🦀 Format Rust with cargo fmt"
language: system
types: [rust]
pass_filenames: false
entry: cargo fmt --
- id: cargo-clippy
name: "🦀 Lint Rust with Clippy"
language: system
types: [rust]
pass_filenames: false
entry: cargo clippy --all-targets -- -D warnings