-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
164 lines (162 loc) · 5.24 KB
/
.pre-commit-config.yaml
File metadata and controls
164 lines (162 loc) · 5.24 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
default_install_hook_types:
- commit-msg
- pre-commit
- pre-push
repos:
- repo: https://github.com/radxa-docs/pre-commit-hooks
rev: 5a4b5c737aed720c8c5515edb42f6eba77f3f809
hooks:
- id: use-webp-image
- id: fix-en-dash-list
- id: tab-with-querystring-undefined
- id: tab-without-querystring
- id: no-full-uri-for-internal-pages
- id: check-external-links
- id: disable-sidebar_label
- id: index-to-README
- id: globally-available-components
- id: remove-category-json
- id: check-chinese
files: "i18n/en/docusaurus-plugin-content-docs/current"
exclude: "i18n/en/docusaurus-plugin-content-docs/current/roobi/advanced-feature.md"
- id: trademark-check
- repo: https://github.com/detailyang/pre-commit-shell
rev: 1.0.5
hooks:
- id: shell-lint
args: [-x]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
stages:
- pre-commit
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
args: [--maxkb=2048]
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: pretty-format-json
args: [--autofix, --no-ensure-ascii]
exclude: ^(i18n/en/code.json|i18n/en/docusaurus-plugin-content-blog/options.json|i18n/en/docusaurus-plugin-content-docs/current.json|i18n/en/docusaurus-theme-classic/footer.json|i18n/en/docusaurus-theme-classic/navbar.json)$
- id: trailing-whitespace
args: ["--markdown-linebreak-ext=md,mdx"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
stages:
- pre-commit
- repo: https://github.com/crate-ci/typos
rev: v1
hooks:
- id: typos
- repo: https://github.com/milin/gitown
rev: v0.1.7
hooks:
- id: gitown
args:
[
"--ownership_threshold=34",
"--codeowners_filename=.github/CODEOWNERS",
]
stages:
- manual
exclude: .github/CODEOWNERS
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.13.9
hooks:
- id: commitizen
- id: commitizen-branch
args: [--rev-range, $PRE_COMMIT_FROM_REF..$PRE_COMMIT_TO_REF]
stages:
- pre-push
- repo: local
hooks:
- id: cleanup-ds-store
name: Cleanup .DS_Store files
language: system
entry: bash
pass_filenames: false
args:
- -c
- |
files=$(find . -name ".DS_Store" -not -path "./.git/*")
if [ -n "$files" ]; then
echo "Removing .DS_Store files:"
echo "$files"
find . -name ".DS_Store" -not -path "./.git/*" -delete
fi
tracked=$(git ls-files -- ':(glob)**/.DS_Store')
if [ -n "$tracked" ]; then
echo "Staging .DS_Store deletions:"
echo "$tracked"
printf '%s\n' "$tracked" | while IFS= read -r f; do
[ -n "$f" ] && git add -u -- "$f"
done
fi
- id: forbid-ds-store
name: Forbid .DS_Store files
language: system
entry: bash
pass_filenames: false
- id: check-markdown-filename
name: Check Markdown filenames for underscores
language: system
entry: bash
files: '\.md$'
stages:
- pre-commit
args:
- -c
- |
for file in "$@"; do
filename=$(basename "$file")
if [[ "$filename" =~ ^_ ]]; then
continue
fi
if [[ "$filename" =~ _ ]]; then
if git cat-file -e "HEAD:$file" 2>/dev/null; then
# Legacy file kept for compatibility; only block new underscore names.
continue
fi
echo "Error: Markdown file contains underscore: $file"
echo "Please rename to use hyphens (-) instead of underscores (_)"
echo "Example: file_name.md -> file-name.md"
exit 1
fi
done
- --
- id: agent-doc-lint
name: Agent doc lint
language: system
entry: scripts/agent-doc-lint.sh
files: '^(docs|i18n/en/docusaurus-plugin-content-docs/current)/.*\.(md|mdx)$'
stages:
- pre-commit
- id: agent-doc-drift-guard
name: Agent doc drift guard
language: system
entry: scripts/agent-doc-drift-guard.sh
args:
- --warn-only
pass_filenames: false
files: '^(docs|i18n/en/docusaurus-plugin-content-docs/current)/.*\.(md|mdx)$'
stages:
- pre-commit
- id: agent-doc-translation-guard
name: Agent doc translation guard
language: system
entry: scripts/agent-doc-translation-guard.sh
pass_filenames: false
files: '^(docs|i18n/en/docusaurus-plugin-content-docs/current)/.*\.(md|mdx)$'
stages:
- pre-commit