-
Notifications
You must be signed in to change notification settings - Fork 253
Expand file tree
/
Copy pathruff.toml
More file actions
141 lines (127 loc) · 3.92 KB
/
ruff.toml
File metadata and controls
141 lines (127 loc) · 3.92 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
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
line-length = 120
respect-gitignore = true
target-version = "py310"
[format]
indent-style = "space"
quote-style = "double"
docstring-code-format = true
docstring-code-line-length = "dynamic"
exclude = ["**/_version.py"]
[lint]
select = [
# pycodestyle
"E",
"W",
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
# flake8-bandit
"S",
# flake8-unused-arguments
"ARG",
# flake8-quotes
"Q",
# pep8-naming
"N",
# flake8-comprehensions
"C4",
# flake8-pie
"PIE",
# flake8-print
"T20",
# Ruff-specific rules
"RUF",
# flake8-pytest-style
"PT",
# flake8-datetimez
"DTZ",
]
ignore = [
# typing backward compat — support older Python versions
"UP006", # non-pep585-annotation (e.g. Dict vs dict)
"UP007", # non-pep604-annotation (e.g. Union[X, Y] vs X | Y)
"UP035", # deprecated-import from typing
# security rules too strict for this project
"S101", # asserts
"S311", # allow random.* (not cryptographic)
"S404", # allow subprocess imports
# style preferences
"C408", # unnecessary dict/list/tuple call (dict() is fine)
"E501", # line too long (formatter handles what it can; the rest is intentional)
"E741", # ambiguous variable name (I, l, O)
"B007", # unused loop control variable
"B905", # zip without explicit strict
"SIM108", # ternary if/else
"RUF005", # collection literal concatenation (list + list is fine)
]
exclude = ["**/_version.py"]
[lint.isort]
known-first-party = ["cuda"]
[lint.flake8-quotes]
inline-quotes = "double"
[lint.per-file-ignores]
"__init__.py" = ["F401", "E402", "F403", "F405"]
"setup.py" = ["F401"]
"**/tests/**" = [
"T201", # print
"ARG001", # unused function argument (fixtures)
"ARG002", # unused method argument
"RUF012", # mutable class default (ctypes _fields_ is standard)
"RUF059", # unused unpacked variable (side-effect assignments)
"F841", # unused local variable (side-effect assignments)
"E402", # module-level import not at top of file
"E702", # multiple statements on one line (compact test tables)
"N801", # CUDA naming conventions in tests
"N802",
"N803",
"N806",
"N816",
"PT006", # pytest.mark.parametrize names type
"PT007", # pytest.mark.parametrize values type
"PT011", # pytest.raises too broad
"PT012", # pytest.raises with multiple statements
"PT014", # duplicate parametrize test cases
"PT018", # composite assertion
"RUF005", # collection literal concatenation
"RUF043", # pytest.raises ambiguous regex pattern
"RUF003", # ambiguous unicode character in comment
"B028", # no explicit stacklevel in warnings (test code)
]
"**/examples/**" = [
"T201", # print
"E402", # module-level import not at top of file
"RUF059", # unused unpacked variable
]
"**/benchmarks/**" = [
"T201", # print
"RUF012", # mutable class default (ctypes _fields_ is standard)
"RUF059", # unused unpacked variable
"F841", # unused local variable
"E402", # module-level import not at top of file
]
# CUDA bindings mirror C API naming conventions (CamelCase types, camelCase functions)
# Keep examples opted-in to enforce naming conventions in example-local identifiers.
"cuda_bindings/{benchmarks,cuda,docs,tests}/**" = [
"N801", # invalid-class-name
"N802", # invalid-function-name
"N803", # invalid-argument-name
"N806", # non-lowercase-variable-in-function
"N816", # mixed-case-variable-in-global-scope
]
"cuda_bindings/{build_hooks.py,setup.py}" = ["N801", "N802", "N803", "N806", "N816"]
# scripts and build tooling — print is the expected output method
"toolshed/**" = ["T201"]
"ci/**" = ["T201"]
"**/build_hooks.py" = ["T201"]
"**/docs/**/conf.py" = ["T201", "ARG001"]
"cuda_pathfinder/**/canary_probe_subprocess.py" = ["T201"]