-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
163 lines (149 loc) · 6.42 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
163 lines (149 loc) · 6.42 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
ci:
autoupdate_commit_msg: "chore(deps): update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"
autoupdate_schedule: "monthly"
exclude: ^.cruft.json|.copier-answers.yml$
repos:
- repo: https://github.com/adamchainz/blacken-docs
rev: "fda77690955e9b63c6687d8806bafd56a526e45f" # frozen: 1.20.0
hooks:
- id: blacken-docs
additional_dependencies: [black==26.*]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "3e8a8703264a2f4a69428a0aa4dcb512790b2c8c" # frozen: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: name-tests-test
args: ["--pytest-test-first"]
- id: requirements-txt-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/pygrep-hooks
rev: "3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316" # frozen: v1.10.0
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- repo: https://github.com/rbubley/mirrors-prettier
rev: "0ee178619d696787ca73d210cc191d720868c631" # frozen: v3.9.6
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]
# mkdocstrings/mkdocs-typer2 `:::` directives rely on indented
# continuation lines that prettier folds into a single paragraph;
# the generated schemas/*.schema.json files are committed verbatim
# from `json.dumps(..., indent=2)` (see test_json_schema.py) so they
# can't drift from a plain regeneration -- prettier collapses short
# scalar arrays (e.g. `"required": [...]`) onto one line, which
# `json.dumps` doesn't do, so those files are excluded here instead.
exclude: ^docs/.*\.md$|^schemas/.*\.schema\.json$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "39d9ac5938dadb73df0564a45f163e25ff9fa6e2" # frozen: v0.16.1
hooks:
- id: ruff-check
args: ["--fix"]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "41e691678310dfd3833f7ab4e180ddb014310356" # frozen: v2.3.0
hooks:
- id: mypy
files: src|tests|noxfile.py
args: []
additional_dependencies:
- nox
- pytest
- cryptography
- githubkit
- inline-snapshot
- jsonschema
- pydantic
- respx
- typer
- types-jsonschema
- rich
- ruamel.yaml
- repo: https://github.com/codespell-project/codespell
rev: "57b21406f092110c18776e39b0bda50d37c945c8" # frozen: v2.4.3
hooks:
- id: codespell
additional_dependencies:
- tomli; python_version<'3.11'
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "745eface02aef23e168a8afb6b5737818efbea95" # frozen: v0.11.0.1
hooks:
- id: shellcheck
- repo: local
hooks:
- id: disallow-caps
name: Disallow improper capitalization
language: pygrep
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
# tests/event_data and its inline snapshots contain verbatim captured
# GitHub event payloads whose text can't be edited (e.g. the real PR
# title "Dump Github Actions events")
exclude: .pre-commit-config.yaml|tests/event_data/|tests/test_github_context.py|tests/test_make_payload.py
- id: validate-image-manifest
name: Validate odp-releaser image manifest
# Dogfoods this project's own hook (see .pre-commit-hooks.yaml)
# against the known-good e2e fixture only -- tests/manifests/ holds
# deliberately invalid configs used by the unit tests, so files: is
# anchored to this one path rather than reusing a broad pattern.
entry: uv run odp-releaser validate image-manifest
language: system
files: ^tests/e2e/image_manifest\.yaml$
pass_filenames: true
- id: validate-deploy-targets
name: Validate odp-releaser deploy targets
entry: uv run odp-releaser validate deploy-targets
language: system
files: ^tests/e2e/deploy_targets\.yaml$
pass_filenames: true
- id: regenerate-json-schemas
name: Regenerate JSON Schemas from pydantic models
# schemas/*.schema.json are generated from the pydantic config models
# (see src/odp_releaser/schemas/json_schema.py); test_json_schema.py
# asserts the committed files are current, but nothing stopped a
# commit that changed a model without regenerating them. This
# regenerates both files in place and then diffs, so -- like
# ruff-format/blacken-docs -- a stale schema fails this commit but
# leaves the fix already written to disk; re-staging and
# re-committing is all that's needed. files: intentionally covers the
# model modules and the generator itself, not just the schema files,
# since the point is to catch model drift at the source rather than
# only re-trigger on edits to the schema files themselves.
entry: >-
bash -c 'set -e; uv run odp-releaser generate-config schema
image-manifest > schemas/image_manifest.schema.json; uv run
odp-releaser generate-config schema deploy-targets >
schemas/deploy_targets.schema.json; git diff --exit-code --
schemas/image_manifest.schema.json schemas/deploy_targets.schema.json'
language: system
files: ^(src/odp_releaser/schemas/(manifest_config|dispatch|json_schema)\.py|schemas/(image_manifest|deploy_targets)\.schema\.json)$
pass_filenames: false
- repo: https://github.com/henryiii/validate-pyproject-schema-store
rev: "9efb3138f1d55c197b17348a8dd5b732d384603f" # frozen: 2026.08.01
hooks:
- id: validate-pyproject
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "6b63472e72e1a91ed8a2f6d483790dfb644fa1d3" # frozen: 0.37.4
hooks:
- id: check-dependabot
- id: check-github-actions
- id: check-github-workflows
- id: check-readthedocs
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: "451b56af716f9f0d0c2b816503a3fd0cf8b036fa" # frozen: v1.29.0
hooks:
- id: zizmor
files: "^\\.github"
args: [--persona=pedantic]
update:
cooldown_days: 7
freeze: true