Add pre-commit.ci configs.

This commit is contained in:
Allison Piper
2025-04-14 12:16:04 -04:00
parent 87dd03254f
commit de36f1a248
2 changed files with 94 additions and 0 deletions

70
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,70 @@
# Copyright (c) 2025, NVIDIA CORPORATION.
ci:
autofix_commit_msg: |
[pre-commit.ci] auto code formatting
autofix_prs: false
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: quarterly
skip: []
submodules: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.6
hooks:
- id: clang-format
types_or: [file]
files: |
(?x)^(
^.*\.c$|
^.*\.cpp$|
^.*\.cu$|
^.*\.cuh$|
^.*\.cxx$|
^.*\.h$|
^.*\.hpp$|
^.*\.inl$|
^.*\.mm$
)
args: ["-fallback-style=none", "-style=file", "-i"]
# TODO/REMINDER: add the Ruff vscode extension to the devcontainers
# Ruff, the Python auto-correcting linter/formatter written in Rust
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
hooks:
- id: ruff # linter
- id: ruff-format # formatter
# TOML lint & format
- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
# See https://github.com/NVIDIA/cccl/issues/3426
# - id: taplo-lint
# exclude: "^docs/"
- id: taplo-format
exclude: "^docs/"
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
additional_dependencies: [tomli]
args: ["--toml", "pyproject.toml"]
exclude: |
(?x)^(
build|
CITATION.md
)
default_language_version:
python: python3

24
pyproject.toml Normal file
View File

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