# Copyright (c) 2022-2025, NVIDIA CORPORATION. repos: - 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.12.0 hooks: - id: isort # Use the config file specific to each subproject so that each # project can specify its own first/third-party packages. args: ["--config-root=python/", "--resolve-all-configs"] files: python/.* types_or: [python, cython, pyi] - repo: https://github.com/psf/black rev: 22.3.0 hooks: - id: black files: python/.* # Explicitly specify the pyproject.toml at the repo root, not per-project. args: ["--config", "pyproject.toml"] - repo: https://github.com/PyCQA/flake8 rev: 7.1.1 hooks: - id: flake8 args: ["--config=.flake8"] files: python/.*$ types: [file] types_or: [python, cython] additional_dependencies: ["flake8-force"] - repo: https://github.com/pre-commit/mirrors-mypy rev: 'v1.3.0' hooks: - id: mypy additional_dependencies: [types-cachetools] args: ["--config-file=pyproject.toml", "python/pylibraft/pylibraft", "python/raft-dask/raft_dask"] pass_filenames: false - repo: https://github.com/PyCQA/pydocstyle rev: 6.1.1 hooks: - id: pydocstyle # https://github.com/PyCQA/pydocstyle/issues/603 additional_dependencies: [toml] args: ["--config=pyproject.toml"] - 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"] exclude: cpp/include/raft/thirdparty/.* - repo: local hooks: - id: no-deprecationwarning name: no-deprecationwarning description: 'Enforce that DeprecationWarning is not introduced (use FutureWarning instead)' entry: '(category=|\s)DeprecationWarning[,)]' language: pygrep types_or: [python, cython] - id: cmake-format name: cmake-format entry: ./cpp/scripts/run-cmake-format.sh cmake-format language: python types: [cmake] exclude: .*/thirdparty/.* # 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 verbose: true require_serial: true - id: cmake-lint name: cmake-lint entry: ./cpp/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 verbose: true require_serial: true exclude: .*/thirdparty/.* - id: include-check name: include-check entry: python ./cpp/scripts/include_checker.py cpp/bench cpp/include cpp/tests pass_filenames: false language: python additional_dependencies: [gitpython] - repo: https://github.com/codespell-project/codespell rev: v2.2.2 hooks: - id: codespell additional_dependencies: [tomli] args: ["--toml", "pyproject.toml"] exclude: | (?x) ^CHANGELOG[.]md$| ^cpp/cmake/patches/cutlass/build-export[.]patch$ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: - id: check-json - repo: https://github.com/rapidsai/pre-commit-hooks rev: v0.4.0 hooks: - id: verify-copyright files: | (?x) [.](cmake|cpp|cu|cuh|h|hpp|sh|pxd|py|pyx)$| CMakeLists[.]txt$| CMakeLists_standalone[.]txt$| meta[.]yaml$ exclude: | (?x) cpp/include/raft/neighbors/detail/faiss_select/| cpp/include/raft/thirdparty/| docs/source/sphinxext/github_link[.]py| - id: verify-alpha-spec - repo: https://github.com/rapidsai/dependency-file-generator rev: v1.17.0 hooks: - id: rapids-dependency-file-generator args: ["--clean"] default_language_version: python: python3