-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
169 lines (168 loc) · 5.23 KB
/
.pre-commit-config.yaml
File metadata and controls
169 lines (168 loc) · 5.23 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
# SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# https://pre-commit.com/
#
# Before first use: `pre-commit install`
# To run: `pre-commit run --all-files`
# To update: `pre-commit autoupdate`
# - &flake8_dependencies below needs updated manually
fail_fast: false
default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-ast
- id: check-toml
- id: check-yaml
exclude: '^conda/recipes/.*\.yaml$'
- id: check-executables-have-shebangs
- id: check-vcs-permalinks
- id: destroyed-symlinks
- id: detect-private-key
- id: debug-statements
- id: end-of-file-fixer
exclude_types: [svg]
- id: mixed-line-ending
args: [--fix=lf]
- id: trailing-whitespace
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.24.1
hooks:
- id: validate-pyproject
name: Validate pyproject.toml
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
hooks:
- id: autoflake
args: [--in-place]
- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py311-plus]
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
# - id: black-jupyter # Consider adding this
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.5
hooks:
- id: ruff
args: [--fix-only, --show-fixes] # --unsafe-fixes]
- repo: https://github.com/PyCQA/flake8
rev: 7.2.0
hooks:
- id: flake8
args: ["--config=.flake8"] # uses config
additional_dependencies: &flake8_dependencies
# These versions need updated manually
- flake8==7.2.0
- flake8-bugbear==24.12.12
- flake8-simplify==0.21.0 # Not maintained, so consider deleting
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
types_or: [python, rst, markdown]
additional_dependencies: [tomli]
files: ^(nx_cugraph)/
args: ["-L thirdparty,coo,COO,numer"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.5
hooks:
- id: ruff
# Don't have strict linting for miscellaneous code
args: [--extend-exclude, "benchmarks/,ci/,notebooks/"]
- repo: https://github.com/rapidsai/dependency-file-generator
rev: v1.20.0
hooks:
- id: rapids-dependency-file-generator
args: ["--clean", "--warn-all", "--strict"]
- repo: local
hooks:
- id: nx-cugraph-meta-data-update
name: nx-cugraph meta-data updater
entry: bash -c "PYTHONPATH=. python _nx_cugraph/__init__.py"
files: ^(nx_cugraph|_nx_cugraph)/
types: [python]
language: python
pass_filenames: false
additional_dependencies: ["networkx>=3.6.1"]
- repo: local
hooks:
- id: nx-cugraph-readme-update
name: nx-cugraph README updater
entry: bash -c "PYTHONPATH=. python ./scripts/update_readme.py ./README.md"
files: ^(nx_cugraph|_nx_cugraph)/
types_or: [python, markdown]
language: python
pass_filenames: false
additional_dependencies: ["networkx>=3.6.1"]
- repo: local
hooks:
- id: disallow-improper-nxver-comparison
name: disallow improper comparison to `_nxver`
language: pygrep
# We expect bug-fix releases to be the same, so these rules avoid cases like:
# >>> (X, Y, 1) <= (X, Y)
# False
entry: "_nxver > |_nxver <= | < _nxver| >= _nxver"
# Use e.g. `_nxver < ...` or `_nxver >= ...` instead
exclude: .pre-commit-config.yaml
- repo: https://github.com/rapidsai/pre-commit-hooks
rev: v1.3.3
hooks:
- id: verify-copyright
args: [--fix, --spdx]
files: |
(?x)
[.](sh|py)$|
[.]flake8([.]cython)?$|
meta[.]yaml$|
setup[.]cfg$|
^[.]github/ISSUE_TEMPLATE/|
pytest[.]ini$|
Makefile$|
dependencies[.]yaml$|
pyproject[.]toml$|
^[.]pre-commit-config[.]yaml$|
recipe[.]yaml$
- id: verify-alpha-spec
args: ["--fix"]
- id: verify-pyproject-license
- id: verify-hardcoded-version
exclude: |
(?x)
devcontainer[.]json$|
dependencies[.]yaml$|
^[.]github/workflows/|
[.]md$|
pom[.]xml$|
^[.]pre-commit-config[.]yaml$|
[.]rst$|
^conda/environments/|
^[.]github/ISSUE_TEMPLATE/
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: no-commit-to-branch
args: [-p, "^release/.*$|^main$"]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes