-
Notifications
You must be signed in to change notification settings - Fork 44
/
.pre-commit-config.yaml
150 lines (140 loc) · 5.17 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
default_stages: [pre-commit, pre-push, manual]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-symlinks
- id: destroyed-symlinks
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: check-ast
- id: check-added-large-files
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: detect-private-key
- id: debug-statements
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
hooks:
- id: ruff
files: '^python/.*'
args: ["--fix", "--exit-non-zero-on-fix"]
exclude: |
(?x)(
^python/triton/runtime/.*|
^test/|
^docs/conf.py$
)
- repo: https://github.com/google/yapf
rev: "7e21823"
hooks:
- id: yapf
args: ["-p", "-i"]
exclude: "python/test/unit/language/test_line_info.py"
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.2
hooks:
- id: clang-format
# Expand YAML anchors in files used by github workflows, because github can't
# do this itself. This lets us use anchors, which avoids code duplication.
- repo: local
hooks:
- id: expand-yaml-anchors
name: Expand YAML anchors
language: golang
additional_dependencies: [github.com/mikefarah/yq/v4@latest]
entry: >
bash -c '
OUT=".github/workflows/integration-tests.yml"
IN="$OUT.in"
echo "# AUTOGENERATED by pre-commit, modify the .in file instead." > "$OUT" &&
echo >> "$OUT"
yq "explode(.)" "$IN" >> "$OUT"
'
files: ^.github/workflows/integration-tests.yml.*
pass_filenames: false
- repo: https://github.com/PyCQA/bandit
rev: '1.7.9'
hooks:
- id: bandit
files: '^(benchmarks|scripts|third_party/intel)/.*\.py$'
args: ["-c", "bandit.yaml", "-s", "B404,B603,B607"]
stages: [pre-commit, pre-push, manual]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
hooks:
- id: ruff
files: '^(benchmarks|third_party/intel|scripts)/.*'
args: ["--fix", "--line-length", "120"]
stages: [pre-commit, pre-push, manual]
- repo: https://github.com/pycqa/pylint
rev: v3.2.6
hooks:
- id: pylint
name: pylint for scripts
files: '^scripts/.*\.py$'
# FIXME: will be deleted soon
exclude: '^scripts/create-noop-ipex\.py$'
args:
- --check-quote-consistency=true
# Max line length 120 is consistent with ruff's one in upstream
- --max-line-length=120
# Disable line-too-long: rely on ruff's check for line length
- --disable=line-too-long
# Disable import-error: not everything can be imported when pre-commit runs
- --disable=import-error
# Disable unused-import: ruff has a corresponding check and supports "noqa: F401"
- --disable=unused-import
# FIXME: revisit these checks later
- --disable=missing-module-docstring
- --disable=missing-function-docstring
- --disable=missing-class-docstring
- --disable=duplicate-code
- --disable=too-many-locals
- --disable=too-many-statements
- --disable=too-many-arguments
stages: [pre-commit, pre-push, manual]
- id: pylint
name: pylint for benchmarks
files: '^benchmarks/.*\.py$'
args:
- --check-quote-consistency=true
# Max line length 120 is consistent with ruff's one in upstream
- --max-line-length=120
# Disable line-too-long: rely on ruff's check for line length
- --disable=line-too-long
# Disable import-error: not everything can be imported when pre-commit runs
- --disable=import-error
- --disable=no-name-in-module
# Disable unused-import: ruff has a corresponding check and supports "noqa: F401"
- --disable=unused-import
# Disable invalid_name: benchmarks use a lot of UPPER_SNAKE arguments
- --disable=invalid-name
# Disable unnecessary-lambda-assignment: benchmark use a lot of lambda assignments
- --disable=unnecessary-lambda-assignment
# FIXME: revisit these checks later
- --disable=import-outside-toplevel
- --disable=too-few-public-methods
- --disable=consider-using-generator
- --disable=missing-module-docstring
- --disable=missing-function-docstring
- --disable=missing-class-docstring
- --disable=duplicate-code
- --disable=too-many-locals
- --disable=too-many-statements
- --disable=too-many-arguments
- --disable=fixme
stages: [pre-commit, pre-push, manual]
exclude: |
(?x)(
^include/triton/external/|
^third_party/amd/backend/include/hip/|
^third_party/amd/backend/include/hsa/|
^third_party/amd/backend/include/roctracer/|
^third_party/amd/backend/lib/|
^third_party/nvidia/backend/include/cuda.h|
^third_party/f2reduce
)