-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
205 lines (184 loc) · 6.42 KB
/
.pre-commit-config.yaml
File metadata and controls
205 lines (184 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
repos:
# SPDX copyright header check
- repo: local
hooks:
- id: copyright-header
name: copyright header
entry: python3 scripts/lint/check_copyright.py
language: system
files: '\.(rs|go|py|pyi|toml|yaml|yml|md|mjs|js|ts|h|sh)$|\.gitignore$'
exclude: '(/SKILL\.md|index\.js|index\.d\.ts|nemo_relay\.h|node_modules/|target/|\.venv/|pkg/|^\.github/pull_request_template\.md)$'
# General file hygiene
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: '^(ATTRIBUTIONS-(Rust|Python|Node)\.md|patches/.*\.patch)$'
- id: end-of-file-fixer
exclude: '^(ATTRIBUTIONS-(Rust|Python|Node)\.md|patches/.*\.patch)$'
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-added-large-files
args: ["--maxkb=500"]
exclude: '^ATTRIBUTIONS-(Rust|Python|Node)\.md$'
# GitHub Actions — workflow semantics
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint
files: '^(\.github/workflows/.*\.ya?ml|\.github/actions/.*/action\.ya?ml|\.github/actionlint\.ya?ml)$'
pass_filenames: false
# Python — ruff lint + format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.0
hooks:
- id: ruff
args: ["--fix"]
- id: ruff-format
# Python — type checking
- repo: local
hooks:
- id: ty
name: ty (type check)
entry: uv run ty check . --exclude docs/** --exclude fern/** --exclude third_party/** --exclude ./examples/** --exclude .cache/** --exclude .claude/**
language: system
types: [python]
pass_filenames: false
# Documentation — external link validation
- repo: https://github.com/lycheeverse/lychee.git
rev: lychee-v0.23.0
hooks:
- id: lychee
name: docs markdown linkcheck
args:
- --no-progress
- --include-fragments
- --root-dir
- .
- --scheme
- http
- --scheme
- https
- --accept
- '200..=299,403,429'
- --exclude
- '^https?://(localhost|127\.0\.0\.1|\[::1\])(:[0-9]+)?(/.*)?$'
- --exclude
- '^https://www\.npmjs\.com/package/nemo-relay-(node|wasm)$'
- --exclude
- '^https://github\.com/NVIDIA/NeMo-Relay(?:/.*)?$'
- --exclude
- '^https://nvidia-nemo-relay\.docs\.buildwithfern\.com/nemo-relay(?:/.*)?$'
- README.md
- CONTRIBUTING.md
- docs/**/*.mdx
always_run: true
pass_filenames: false
# Lockfiles — manifest freshness
- repo: local
hooks:
- id: cargo-lockfile-check
name: Cargo.lock is up to date
entry: bash -c 'cargo metadata --format-version 1 --no-deps >/dev/null'
language: system
files: '^(Cargo\.toml|Cargo\.lock|crates/.*/Cargo\.toml)$'
pass_filenames: false
- id: uv-lockfile-check
name: uv.lock is up to date
entry: uv lock
language: system
files: '^(pyproject\.toml|uv\.lock)$'
pass_filenames: false
- id: node-lockfile-check
name: package-lock.json is up to date
entry: bash -c 'npm install --package-lock-only --ignore-scripts --audit=false --fund=false'
language: system
files: 'package(?:-lock)?\.json$'
pass_filenames: false
# Rust — fmt + clippy + cargo-deny
- repo: local
hooks:
- id: ffi-header-sync
name: ffi header sync
entry: cargo check -p nemo-relay-ffi
language: system
files: '^crates/ffi/(Cargo\.toml|cbindgen\.toml|nemo_relay\.h|src/.*\.rs)$'
pass_filenames: false
- id: cargo-fmt
name: cargo fmt
entry: cargo fmt --all --
language: system
types: [rust]
pass_filenames: false
- id: cargo-clippy
name: cargo clippy
entry: cargo clippy --workspace --all-targets -- -D warnings
language: system
types: [rust]
pass_filenames: false
- id: cargo-check
name: cargo check
entry: cargo check --workspace --all-targets
language: system
types: [rust]
pass_filenames: false
- id: cargo-deny
name: cargo deny
entry: cargo deny check
language: system
files: '(Cargo\.toml|Cargo\.lock|deny\.toml)$'
pass_filenames: false
- id: attributions-rust
name: ATTRIBUTIONS-Rust.md (Cargo.lock)
entry: bash scripts/generate_attributions.sh rust
language: system
files: '^(Cargo\.lock|ATTRIBUTIONS-Rust\.md)$'
pass_filenames: false
- id: attributions-python
name: ATTRIBUTIONS-Python.md (uv.lock)
entry: bash scripts/generate_attributions.sh python
language: system
files: '^(uv\.lock|ATTRIBUTIONS-Python\.md)$'
pass_filenames: false
- id: attributions-node
name: ATTRIBUTIONS-Node.md (package-lock.json)
entry: bash scripts/generate_attributions.sh node
language: system
files: '^(package-lock\.json|ATTRIBUTIONS-Node\.md)$'
pass_filenames: false
# Go — fmt + vet
- repo: local
hooks:
- id: go-fmt
name: go fmt
entry: gofmt -l -w
language: system
types: [go]
- id: go-vet
name: go vet
entry: bash -c 'cd go/nemo_relay && go vet ./...'
language: system
types: [go]
pass_filenames: false
# JavaScript / TypeScript — format
- repo: local
hooks:
- id: node-prettier-check
name: node prettier check
entry: node scripts/lint/prettier-precommit.mjs
language: system
files: '^(crates/node|crates/wasm/(wrappers|tests-js|scripts))/.*\.(?:[cm]?js|[mc]?ts|tsx)$'
pass_filenames: false
- id: node-docstrings-check
name: node docstrings check
entry: node scripts/lint/check_public_docstrings.mjs all
language: system
files: '^(?:(?:crates/node|crates/wasm/wrappers/(?:esm|nodejs))/(?:plugin|adaptive|typed)\.(?:js|d\.ts))$'
pass_filenames: false