Skip to content

Commit de36f1a

Browse files
committed
Add pre-commit.ci configs.
1 parent 87dd032 commit de36f1a

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed

.pre-commit-config.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION.
2+
ci:
3+
autofix_commit_msg: |
4+
[pre-commit.ci] auto code formatting
5+
autofix_prs: false
6+
autoupdate_branch: ''
7+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
8+
autoupdate_schedule: quarterly
9+
skip: []
10+
submodules: false
11+
12+
repos:
13+
- repo: https://github.com/pre-commit/pre-commit-hooks
14+
rev: v5.0.0
15+
hooks:
16+
- id: end-of-file-fixer
17+
- id: mixed-line-ending
18+
- id: trailing-whitespace
19+
- repo: https://github.com/pre-commit/mirrors-clang-format
20+
rev: v19.1.6
21+
hooks:
22+
- id: clang-format
23+
types_or: [file]
24+
files: |
25+
(?x)^(
26+
^.*\.c$|
27+
^.*\.cpp$|
28+
^.*\.cu$|
29+
^.*\.cuh$|
30+
^.*\.cxx$|
31+
^.*\.h$|
32+
^.*\.hpp$|
33+
^.*\.inl$|
34+
^.*\.mm$
35+
)
36+
args: ["-fallback-style=none", "-style=file", "-i"]
37+
38+
# TODO/REMINDER: add the Ruff vscode extension to the devcontainers
39+
# Ruff, the Python auto-correcting linter/formatter written in Rust
40+
- repo: https://github.com/astral-sh/ruff-pre-commit
41+
rev: v0.8.6
42+
hooks:
43+
- id: ruff # linter
44+
- id: ruff-format # formatter
45+
46+
# TOML lint & format
47+
- repo: https://github.com/ComPWA/taplo-pre-commit
48+
rev: v0.9.3
49+
hooks:
50+
# See https://github.com/NVIDIA/cccl/issues/3426
51+
# - id: taplo-lint
52+
# exclude: "^docs/"
53+
- id: taplo-format
54+
exclude: "^docs/"
55+
56+
- repo: https://github.com/codespell-project/codespell
57+
rev: v2.3.0
58+
hooks:
59+
- id: codespell
60+
additional_dependencies: [tomli]
61+
args: ["--toml", "pyproject.toml"]
62+
exclude: |
63+
(?x)^(
64+
build|
65+
CITATION.md
66+
)
67+
68+
69+
default_language_version:
70+
python: python3

pyproject.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright (c) 2024, NVIDIA CORPORATION.
2+
3+
[tool.ruff]
4+
target-version = "py310"
5+
fix = true
6+
show-fixes = true
7+
exclude = ["docs/tools"]
8+
9+
[tool.ruff.lint]
10+
extend-select = ["I"]
11+
12+
[tool.codespell]
13+
# To run codespell interactively and fix errors that pre-commit reports, try
14+
# `codespell -i 3 -w -H`. This will run with interactive review (-i 3), writes
15+
# changes to disk (-w), and includes hidden files (-H).
16+
# Note: pre-commit passes explicit lists of files here, which this skip file
17+
# list doesn't override - the skip list is only to allow you to run codespell
18+
# interactively.
19+
skip = "./.git,./build,./CITATION.md"
20+
# ignore short words, and typename parameters like OffsetT
21+
ignore-regex = "\\b(.{1,4}|[A-Z]\\w*T)\\b"
22+
ignore-words-list = "inout,imovable,optionN,aCount,quitted,Invokable,countr,unexpect,numer,euclidian,couldn,OffsetT,FromM"
23+
builtin = "clear"
24+
quiet-level = 3

0 commit comments

Comments
 (0)