-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy path.pre-commit-config.yaml
182 lines (180 loc) · 7 KB
/
.pre-commit-config.yaml
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
170
171
172
173
174
175
176
177
178
179
180
181
182
---
repos:
- repo: https://github.com/adrienverge/yamllint
rev: v1.37.0
hooks:
- id: yamllint
types: [yaml]
args: ['-c', './scripts/pre-commit/yamllint.yml']
exclude: 'meta\.yaml$'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-json # checks that all json files have proper syntax
- id: check-toml # checks that all toml files have proper syntax
- id: debug-statements # check for debug statements
exclude: '^(config/aedifix/main.py|config/aedifix/templates/.*)$' # intentional
- id: end-of-file-fixer # check all files end in a newline
# handled by clang-format
exclude_types: [c, c++, cuda]
- id: pretty-format-json
args: ['--autofix', '--indent=4']
- id: trailing-whitespace # remove trailing whitespace
# don't mess up diff files
exclude: '^src/cmake/patches/.*\.diff$'
# handled by clang-format
exclude_types: [c, c++, cuda]
# These hooks perform formatting or other related changes, and therefore should run
# before clang-format and clang-tidy do. This way, if they do make changes, we can do
# them and the formatting changes in 1 pass instead of multiple.
- repo: local
hooks:
- id: angle-includes
name: angle-includes
description: "Transform '' includes to <>"
entry: ./scripts/pre-commit/angle_includes.py
language: script
types_or: [c++, c, cuda]
stages: [pre-commit]
- id: copyright
name: copyright
description: 'Check that year is correct for copyright notices'
entry: ./scripts/pre-commit/copyright.py
language: python
exclude: '.*\.(png|pdf)|^(share/legate/realm_ucp_bootstrap/.*)$'
types_or: [file, text]
- id: legate-assert
name: legate-assert
description: 'Find uses of assert() that should be using LegateAssert()'
entry: ./scripts/pre-commit/legate_assert.py
language: python
'types_or': [c++, c, cuda]
stages: [pre-commit]
exclude: '^(src/cpp/legate/utilities/assert\.h|src/cpp/legate/utilities/abort.h)$'
- id: c-begone
name: c-begone
description: 'Convert C standard library functions and types to C++ equivalent'
entry: ./scripts/pre-commit/c_begone.py
language: python
'types_or': [c++, c, cuda]
stages: [pre-commit]
exclude: '^(src/cpp/legate/utilities/abort.h|share/legate/mpi_wrapper/.*|share/legate/realm_ucp_bootstrap/.*)$'
- id: traced-throw
name: traced-throw
description: 'Convert throw statements to throwing legate TracedException'
entry: ./scripts/pre-commit/traced_throw.py
language: python
'types_or': [c++, c, cuda]
stages: [pre-commit]
exclude: '^tests/cpp/.*$'
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
args: ["--toml=./pyproject.toml", "--write-changes"]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: 'v20.1.0'
hooks:
- id: clang-format
files: \.(cu|cuh|h|hpp|cc|inl)$
types_or: []
exclude: '^(share/legate/realm_ucp_bootstrap/.*)$'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.4
hooks:
- id: ruff-format
- id: ruff
args: ["--config=./pyproject.toml", "--fix"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.15.0'
hooks:
- id: mypy
pass_filenames: false
args: ['src', 'tests', 'config', 'test.py', 'scripts/release']
additional_dependencies: [numpy, pytest, pytest_mock, types-psutil, rich, "dask[distributed]"]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.16.6
hooks:
- id: cython-lint
- id: double-quote-cython-strings
- repo: https://github.com/netromdk/vermin
rev: 'v1.6.0'
hooks:
- id: vermin
args: ['--config-file', './setup.cfg']
- repo: https://github.com/jumanjihouse/pre-commit-hooks
rev: '3.0.0'
hooks:
- id: shellcheck
args: ['--rcfile', './scripts/pre-commit/shellcheckrc']
- repo: https://github.com/rhysd/actionlint
rev: v1.7.7
hooks:
- id: actionlint
types: [yaml]
files: ^\.github/workflows/
args: [-config-file=scripts/pre-commit/actionlint.yml]
entry: env SHELLCHECK_OPTS="--enable=all --severity=style" actionlint
- repo: local
hooks:
- id: legate-defined
name: legate-defined
description: 'Find uses of ifdef LEGATE_ that should be using LegateDefined()'
entry: ./scripts/pre-commit/legate_defined.sh
language: script
'types_or': [c++, c, cuda]
stages: [pre-commit]
exclude: '^(src/cpp/legate/experimental/stl/detail/config\.hpp|src/cpp/legate/utilities/compiler\.h|share/legate/mpi_wrapper/.*|src/cpp/legate/utilities/env.h)$'
- id: no-default
name: no-default
description: "Ban the use of default: in switch statements"
entry: ./scripts/pre-commit/no_default.py
language: python
'types_or': [c++, c, cuda]
stages: [pre-commit]
exclude: '^tests/cpp/.*$'
additional_dependencies:
- rich
- id: cmake-format
name: cmake-format
entry: ./scripts/pre-commit/cmake-format.bash cmake-format
language: python
types: [cmake]
exclude: '^(share/legate/realm_ucp_bootstrap/CMakeLists.txt|share/legate/realm_ucp_bootstrap/cmake/Config.cmake.in|continuous_integration/scripts/ucc-cmake-config/.*.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
- id: cmake-lint
name: cmake-lint
entry: ./scripts/pre-commit/cmake-format.bash 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
- id: dej2lint
name: dej2lint
description: 'Run yamllint on meta.yaml files, removing Jinja2 directives'
entry: python scripts/pre-commit/dej2lint.py
language: python
files: meta\.yaml$
args: ['-c', './scripts/pre-commit/yamllint.yml']
additional_dependencies: ['yamllint']
- id: check_cmake_format
name: check_cmake_format
description: 'Check that cmake-format.json is properly filled out with function signatures'
entry: ./scripts/pre-commit/check_cmake_format.py
args: ['--input-file', './scripts/pre-commit/cmake-format-legate.json']
language: python
types: [cmake]
require_serial: true
additional_dependencies:
- cmakelang
ci:
autoupdate_schedule: quarterly
default_language_version:
python: python3