-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
181 lines (162 loc) · 5.43 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
181 lines (162 loc) · 5.43 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
170
171
172
173
174
175
176
177
178
179
180
181
# Pre-commit hooks for claude-howto project
# Run `pre-commit install` to set up hooks
# Run `pre-commit run --all-files` to check all files
default_language_version:
python: python3.11
repos:
# Ruff - Fast Python linter and formatter
# Keep this in step with the `ruff` floor in scripts/requirements-dev.txt and
# the unpinned `uv pip install ruff` in the CI lint job. A stale pin here
# reformats files the newer ruff in CI then rejects, and vice versa.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.10
hooks:
- id: ruff
name: ruff-lint
args: [--fix, --exit-non-zero-on-fix]
types_or: [python, pyi]
files: ^scripts/
- id: ruff-format
name: ruff-format
types_or: [python, pyi]
files: ^scripts/
# Bandit - Security linter
- repo: https://github.com/PyCQA/bandit
rev: 1.7.10
hooks:
- id: bandit
name: bandit-security
args: [-c, scripts/pyproject.toml]
additional_dependencies: ["bandit[toml]"]
types: [python]
files: ^scripts/
exclude: ^scripts/tests/
# Standard pre-commit hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
name: check-yaml
args: [--allow-multiple-documents]
- id: check-toml
name: check-toml
- id: end-of-file-fixer
name: fix-end-of-file
- id: trailing-whitespace
name: fix-trailing-whitespace
- id: check-added-large-files
name: check-large-files
args: [--maxkb=1000]
- id: check-merge-conflict
name: check-merge-conflict
# mypy - Type checking
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
name: mypy-type-check
args: [--config-file, scripts/pyproject.toml]
files: ^scripts/
exclude: ^scripts/tests/
additional_dependencies:
- types-Markdown
# Local doc quality hooks (mirrors CI checks — CI is a 2nd pass of these)
- repo: local
hooks:
- id: markdown-lint
name: markdown-lint
language: node
entry: markdownlint
args: ['--ignore', 'node_modules', '--ignore', '.venv', '--config', '.markdownlint.json']
types: [markdown]
additional_dependencies: ['markdownlint-cli']
- id: cross-references
name: cross-references
language: system
entry: python scripts/check_cross_references.py
pass_filenames: false
types: [markdown]
- id: mermaid
name: mermaid-syntax
language: system
entry: python scripts/check_mermaid.py
pass_filenames: false
types: [markdown]
verbose: true
- id: link-check
name: link-check
language: system
entry: python scripts/check_links.py
pass_filenames: false
types: [markdown]
verbose: true
- id: markdown-rendering
name: markdown-rendering
language: system
entry: python scripts/check_markdown_rendering.py
pass_filenames: false
types: [markdown]
# The EPUB build is intentionally CI-only (see the `build-epub` job in
# .github/workflows/test.yml). It needs a local `mmdc` binary, which has
# no working arm64 build, so running it here made the gate impossible to
# satisfy on arm64 machines while `check_mermaid.py` skipped silently.
# Vietnamese documentation checks
- repo: local
hooks:
- id: vietnamese-markdown-lint
name: vietnamese-markdown-lint
language: node
entry: markdownlint
args: ['--ignore', 'node_modules', '--ignore', '.venv', '--config', '.markdownlint.json']
files: ^vi/.*\.md$
additional_dependencies: ['markdownlint-cli']
- id: vietnamese-cross-references
name: vietnamese-cross-references
language: system
entry: python scripts/check_cross_references.py --lang vi
pass_filenames: false
files: ^vi/.*\.md$
- id: vietnamese-mermaid
name: vietnamese-mermaid-syntax
language: system
entry: python scripts/check_mermaid.py
pass_filenames: false
files: ^vi/.*\.md$
verbose: true
- id: vietnamese-link-check
name: vietnamese-link-check
language: system
entry: python scripts/check_links.py
pass_filenames: false
files: ^vi/.*\.md$
verbose: true
# Japanese documentation checks
- repo: local
hooks:
- id: japanese-markdown-lint
name: japanese-markdown-lint
language: node
entry: markdownlint
args: ['--ignore', 'node_modules', '--ignore', '.venv', '--config', '.markdownlint.json']
files: ^ja/.*\.md$
additional_dependencies: ['markdownlint-cli']
- id: japanese-cross-references
name: japanese-cross-references
language: system
entry: python scripts/check_cross_references.py
pass_filenames: false
files: ^ja/.*\.md$
- id: japanese-mermaid
name: japanese-mermaid-syntax
language: system
entry: python scripts/check_mermaid.py
pass_filenames: false
files: ^ja/.*\.md$
verbose: true
- id: japanese-link-check
name: japanese-link-check
language: system
entry: python scripts/check_links.py
pass_filenames: false
files: ^ja/.*\.md$
verbose: true