Skip to content

Commit

Permalink
Add configuration for pre-commit.ci, update pre-commit hooks (#1746)
Browse files Browse the repository at this point in the history
This PR adds configuration for pre-commit.ci, reformats the pre-commit config file, and updates pre-commit hooks.

See rapidsai/build-planning#124 for the motivation.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Ray Douglass (https://github.com/raydouglass)
  - Matthew Murray (https://github.com/Matt711)
  - Jake Awe (https://github.com/AyodeAwe)

URL: #1746
  • Loading branch information
bdice authored Dec 9, 2024
1 parent 83a8971 commit 09f7f62
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 90 deletions.
185 changes: 97 additions & 88 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,91 +1,100 @@
# Copyright (c) 2022-2023, NVIDIA CORPORATION.
# Copyright (c) 2022-2024, 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: ["verify-alpha-spec"]
submodules: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--settings-path=python/rmm/pyproject.toml"]
files: python/.*
types_or: [python, cython, pyi]
- repo: https://github.com/ambv/black
rev: 22.3.0
hooks:
- id: black
args: ["--config=python/rmm/pyproject.toml"]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.15.0
hooks:
- id: cython-lint
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format
types_or: [c, c++, cuda]
args: ["-fallback-style=none", "-style=file", "-i"]
- repo: https://github.com/sirosen/texthooks
rev: 0.4.0
hooks:
- id: fix-smartquotes
exclude: |
(?x)^(
^benchmarks/utilities/cxxopts.hpp
)
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
exclude: |
(?x)^(
pyproject.toml|
benchmarks/utilities/cxxopts.hpp
)
- repo: local
hooks:
- id: cmake-format
name: cmake-format
entry: ./scripts/run-cmake-format.sh cmake-format
language: python
types: [cmake]
# Note that pre-commit autoupdate does not update the versions
# of dependencies, so we'll have to update this manually.
additional_dependencies:
- cmakelang==0.6.13
- id: cmake-lint
name: cmake-lint
entry: ./scripts/run-cmake-format.sh cmake-lint
language: python
types: [cmake]
# Note that pre-commit autoupdate does not update the versions
# of dependencies, so we'll have to update this manually.
additional_dependencies:
- cmakelang==0.6.13
- id: doxygen-check
name: doxygen-check
entry: ./scripts/doxygen.sh
types_or: [file]
language: system
pass_filenames: false
verbose: true
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.278
hooks:
- id: ruff
files: python/.*$
- repo: https://github.com/rapidsai/pre-commit-hooks
rev: v0.4.0
hooks:
- id: verify-copyright
- id: verify-alpha-spec
- repo: https://github.com/rapidsai/dependency-file-generator
rev: v1.16.0
hooks:
- id: rapids-dependency-file-generator
args: ["--clean"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--settings-path=python/rmm/pyproject.toml"]
files: python/.*
types_or: [python, cython, pyi]
- repo: https://github.com/ambv/black
rev: 24.10.0
hooks:
- id: black
args: ["--config=python/rmm/pyproject.toml"]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.16.6
hooks:
- id: cython-lint
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format
types_or: [c, c++, cuda]
args: ["-fallback-style=none", "-style=file", "-i"]
- repo: https://github.com/sirosen/texthooks
rev: 0.6.8
hooks:
- id: fix-smartquotes
exclude: |
(?x)^(
^benchmarks/utilities/cxxopts.hpp
)
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
exclude: |
(?x)^(
pyproject.toml|
benchmarks/utilities/cxxopts.hpp
)
- repo: local
hooks:
- id: cmake-format
name: cmake-format
entry: ./scripts/run-cmake-format.sh cmake-format
language: python
types: [cmake]
# Note that pre-commit autoupdate does not update the versions
# of dependencies, so we'll have to update this manually.
additional_dependencies:
- cmakelang==0.6.13
- id: cmake-lint
name: cmake-lint
entry: ./scripts/run-cmake-format.sh cmake-lint
language: python
types: [cmake]
# Note that pre-commit autoupdate does not update the versions
# of dependencies, so we'll have to update this manually.
additional_dependencies:
- cmakelang==0.6.13
- id: doxygen-check
name: doxygen-check
entry: ./scripts/doxygen.sh
types_or: [file]
language: system
pass_filenames: false
verbose: true
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
hooks:
- id: ruff
files: python/.*$
- repo: https://github.com/rapidsai/pre-commit-hooks
rev: v0.4.0
hooks:
- id: verify-copyright
- id: verify-alpha-spec
- repo: https://github.com/rapidsai/dependency-file-generator
rev: v1.16.0
hooks:
- id: rapids-dependency-file-generator
args: ["--clean"]

default_language_version:
python: python3
python: python3
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Copyright (c) 2024, NVIDIA CORPORATION.

[tool.codespell]
# note: pre-commit passes explicit lists of files here, which this skip file list doesn't override -
# this is only to allow you to run codespell interactively
skip = "./pyproject.toml,./.git,./.github,./cpp/build,.*egg-info.*,./.mypy_cache,./benchmarks/utilities/cxxopts.hpp"
# ignore short words, and typename parameters like OffsetT
ignore-regex = "\\b(.{1,4}|[A-Z]\\w*T)\\b"
ignore-words-list = "inout"
ignore-words-list = "inout,thirdparty"
builtin = "clear"
quiet-level = 3

Expand Down
2 changes: 1 addition & 1 deletion python/rmm/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def on_missing_reference(app, env, node, contnode):
# all that's missing. Include the empty prefix in case we're searching
# for a stripped template.
extra_prefixes = ["rmm::", "rmm::mr::", "mr::", ""]
for (name, dispname, typ, docname, anchor, priority) in env.domains[
for name, dispname, typ, docname, anchor, priority in env.domains[
"cpp"
].get_objects():
for prefix in extra_prefixes:
Expand Down

0 comments on commit 09f7f62

Please sign in to comment.