Repository navigation
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
93 lines (84 loc) · 3.58 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
93 lines (84 loc) · 3.58 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
default_install_hook_types: [pre-commit, commit-msg]
exclude: ^(scratchpad/)
repos:
- repo: local
hooks:
- id: dco-check
name: DCO sign-off check
entry: "bash -c 'git rev-parse -q --verify MERGE_HEAD >/dev/null && exit 0; grep -q \"^Signed-off-by: \" \"$1\" || { echo \"Missing Signed-off-by trailer. Use: git commit -s\"; exit 1; }' --"
language: system
stages: [commit-msg]
- repo: local
hooks:
- id: license-headers
name: SPDX license headers
entry: uv run --no-sync python3 .github/scripts/check_license_headers.py --fix
language: system
types_or: [python, shell, ts, tsx, javascript, css]
exclude: ^docs/
- repo: local
hooks:
# A SHA-pinned action's comment must name the exact release (`# v7.0.1`). A moving
# tag like `# v7` trips zizmor's ref-version-mismatch on every PR once upstream re-tags it.
- id: action-pin-full-version
name: Action pin comments name an exact release
entry: '@[0-9a-f]{40} +# v[0-9]+(\.[0-9]+)?\s*$'
language: pygrep
files: ^\.github/.*\.ya?ml$
- repo: local
hooks:
# Moving ruff hooks to the local version allows for different behavior locally and in ci/cd pipelines.
- id: ruff-format
name: "Ruff formatter"
entry: bash -c 'if [ "$CICD" = "1" ]; then ruff format --check --diff --quiet --config=pyproject.toml "$@"; else ruff format --quiet --config=pyproject.toml "$@"; fi' --
language: system
types_or: [python, jupyter]
- id: ruff
name: "Ruff linter"
entry: bash -c 'if [ "$CICD" = "1" ]; then ruff check --no-fix --show-fixes --quiet --config=pyproject.toml "$@"; else ruff check --exit-non-zero-on-fix --fix --quiet --config=pyproject.toml "$@"; fi' --
language: system
types_or: [python, jupyter]
- repo: local
hooks:
- id: mypy
name: MyPy
entry: uv run --no-sync mypy --install-types --non-interactive .
pass_filenames: false
language: system
types_or: [python, jupyter]
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.8
hooks:
- id: uv-lock
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies:
- tomli
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.44.0
hooks:
- id: markdownlint
name: markdownlint (docs)
args: [--config, docs/docs/.markdownlint.json]
files: ^docs/docs/.*\.md$
# Docs validation hooks — skip gracefully when generated docs are not present
- repo: local
hooks:
- id: docs-mdx-validate
name: Validate generated MDX docs
entry: bash -c 'test -d docs/docs/api && uv run --no-sync python tooling/docs-autogen/validate.py docs/docs/api --skip-coverage --warn-only || true'
language: system
pass_filenames: false
files: (docs/docs/.*\.mdx$|tooling/docs-autogen/)
# Docstring quality gate — manual only (CI is the hard gate via docs-publish.yml).
# Run locally with: pre-commit run docs-docstring-quality --hook-stage manual
# Requires generated API docs (run `uv run python tooling/docs-autogen/build.py` first).
- id: docs-docstring-quality
name: Audit docstring quality
entry: uv run --no-sync python tooling/docs-autogen/audit_coverage.py --quality --fail-on-quality --threshold 0 --docs-dir docs/docs/api
language: system
pass_filenames: false
files: (mellea/.*\.py$|cli/.*\.py$)
stages: [manual]