-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
217 lines (201 loc) · 7.08 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
217 lines (201 loc) · 7.08 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
206
207
208
209
210
211
212
213
214
215
216
217
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# Pre-commit hooks for Holoscan SDK
# See https://pre-commit.com for more information
# Install: pip install pre-commit && pre-commit install (or: uvx pre-commit install)
# Run manually: pre-commit run --all-files
default_language_version:
python: python3
# Skip all hooks for skills/ - files in this directory are verbatim upstream
# copies intended to match the source byte-for-byte. Modifying them in transit
# (line endings, trailing whitespace, codespell auto-fixes, copyright year
# bumps, etc.) breaks that byte-for-byte property and invalidates the detached
# signature (`skill.oms.sig`) that ships alongside each skill - once the
# signature is attached, any in-place modification fails verification against
# the trust anchor.
exclude: ^skills/
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
exclude: ^.*\.patch$
- id: end-of-file-fixer
exclude: ^.*\.patch$
- id: check-yaml
# Exclude .clang-format file because check-yaml do not support multi-document file
exclude: ^.*\.patch|\.clang-format$
- id: check-json
exclude: ^\.vscode/|^\.devcontainer/|.*\.patch$
- id: check-added-large-files
exclude: ^.*\.patch$
# Copyright header check (NVIDIA SPDX)
- repo: local
hooks:
- id: check-copyright
name: Check copyright headers
# Commits check staged paths. Wide lists from ``--all-files`` are narrowed to the
# main/release diff unless an explicit base is supplied. Use the script's ``--full-scan``
# option for a deliberate full-tree audit.
entry: python3 scripts/check_copyright.py
args:
- --reject-nvidia-proprietary-path
- ^
- --exclude
- CodeCoverage.cmake
- --exclude
- common-debian.sh
# Paths are rooted at the repository layout represented by this config.
- --exclude
- \.cache
- --exclude
- build
- --exclude
- install
- --exclude
- build-*
- --exclude
- install-*
- --exclude
- modules/holoviz/thirdparty/
- --exclude
- .*\.patch$
# Fern bundled dist/ output (generated files, no NVIDIA copyright header).
- --exclude
- docs/fern/dist/
- --update-current-year
language: system
pass_filenames: true
- id: test-check-copyright
name: Test copyright header checker
entry: pytest scripts/test_check_copyright.py
language: python
additional_dependencies:
- pytest
pass_filenames: false
files: ^scripts/(check_copyright|test_check_copyright)\.py$
- id: check-doc-source-links
name: Check documentation source links
entry: python3 docs/scripts/render_source_links.py --docs-root docs --write
language: system
pass_filenames: true
files: ^docs/.*\.mdx?$
- id: test-gxf-entity-codec
name: Test GXF entity codec
entry: pytest scripts/test_gxf_entity_codec.py
language: python
additional_dependencies:
- numpy
- pytest
pass_filenames: false
files: ^scripts/(convert_gxf_entities_to_video|convert_video_to_gxf_entities|gxf_entity_codec|test_gxf_entity_codec)\.py$
- id: check-doc-links
name: Check documentation links
entry: python3 docs/scripts/check_doc_links.py
language: system
pass_filenames: false
files: ^docs/
- id: check-local-markdown-links
name: Check local Markdown file links
entry: python3 docs/scripts/check_doc_links.py --local-files-only
language: system
pass_filenames: false
always_run: true
files: ^
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.6
hooks:
- id: remove-tabs # Replace tabs by whitespaces before committing
args: [--whitespaces-count, '4'] # defaults to: 4
exclude: |
(?x)^(
modules/holoviz/thirdparty/
)
types_or: [c++, cmake, dockerfile, markdown, python, shell]
# Lint: Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.13.2
hooks:
- id: ruff-check
args: [--fix]
files: ^
exclude: ^scripts/register_devzone_release\.py$
- id: ruff-format
files: ^
exclude: ^scripts/register_devzone_release\.py$
# Codespell
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies:
- tomli>=2.0.1,<3.0; python_version<'3.11'
files: ^
args:
- --skip=*.onnx,*NOTICE.txt,*.toml,*vale*,*.patch,*docs/fern/dist*
- --ignore-regex=.*codespell-ignore$
- --toml=.codespell.toml
- --write-changes
# Cpplint
- repo: https://github.com/cpplint/cpplint
rev: 2.0.2
hooks:
- id: cpplint
args:
- --quiet
- --exclude=.cache
- --exclude=.local
- --exclude=tmp
- --exclude=build
- --exclude=install
- --exclude=build-\*
- --exclude=install-\*
- --exclude=gxf-build-\*
- --exclude=src/core/distributed/generated
- --exclude=src/core/services/generated
- --exclude=modules/holoviz/thirdparty/nvpro_core
- --exclude=examples/custom_cuda_kernel_multi_sample/cpp/edge_detection.cu
- --filter=-whitespace/indent_namespace,-build/c++17,-build/include_order
files: ^.*\.(cpp|cu|cuh|h|hpp|cc|cxx)$
# Paths are rooted at the repository layout represented by this config.
exclude: |
(?x)^(
\.cache|
\.local|
tmp|
build|
install|
build-|
install-|
gxf-build-|
src/core/distributed/generated/|
src/core/services/generated/|
modules/holoviz/thirdparty/nvpro_core/|
examples/custom_cuda_kernel_multi_sample/cpp/edge_detection\.cu$
)
# cmakelint
- repo: local
hooks:
- id: cmakelint
name: cmakelint
entry: cmakelint
language: python
additional_dependencies: ["cmakelint>=1.4.2,<2.0"]
args:
- "--filter=-whitespace/indent,-linelength,-readability/wonkycase,-convention/filename,-package/stdargs"
files: ^.*(CMakeLists\.txt|\.cmake)$
exclude: ^(build|install|build-|install-|\.cache)/
# markdownlint
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.47.0
hooks:
- id: markdownlint
args: [--fix, --config, .markdownlint.yaml]
files: ^.*\.mdx?$
types_or: [markdown, mdx]
exclude: ^swipat/summary\.md$
# clang-format
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.8
hooks:
- id: clang-format