-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathruff.toml
More file actions
192 lines (183 loc) · 8.02 KB
/
Copy pathruff.toml
File metadata and controls
192 lines (183 loc) · 8.02 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# https://github.com/charliermarsh/ruff
target-version = "py311"
line-length = 120
output-format = "full"
src = [
"packages/tabarena/src",
"packages/bencheval/src",
"packages/tabflow_slurm/src",
"tests",
"examples",
]
# File-discovery exclusions. MUST be top-level (not under [lint]): top-level `extend-exclude`
# prunes paths from both linting and formatting, and ADDS to ruff's built-in defaults
# (.git, build, dist, .venv, node_modules, ...) rather than replacing them.
extend-exclude = [
"docs", # not one of ruff's built-in default excludes
# --- Vendored upstream sources (not first-party; keep as-imported) ---
"packages/tabarena/src/tabarena/models/limix/_vendor", # vendored LimiX (Apache-2.0)
"packages/tabarena/src/tabarena/models/tabswift/_vendor", # vendored TabSwift (MIT)
"packages/tabarena/src/tabarena/models/tabm/_internal", # vendored from yandex-research/tabm
"packages/tabarena/src/tabarena/models/modernnca/_internal", # vendored from LAMDA-Tabular/TALENT
# --- Archived / experimental examples & scripts ---
"examples/!old",
"examples/!experimental",
"examples/tmp",
"scripts/!old",
]
[lint]
# Extend what ruff is allowed to fix, even it it may break
# This is okay given we use it all the time and it ensures
# better practices. Would be dangerous if using for first
# time on established project.
extend-safe-fixes = ["ALL"]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
select = [
"A",
# "ANN", # Handled by mypy
"ARG",
"B",
"BLE",
"COM",
"C4",
"D",
# "DTZ", # One day I should know how to utilize timezones and dates...
"E",
# "EXE", Meh
"ERA",
"F",
"FBT",
"I",
# "ISC", # Favours implicit string concatenation
"INP",
# "INT", # I don't understand this one
"N",
"NPY",
"PD",
"PLC",
"PLE",
"PLR",
"PLW",
"PIE",
"PT",
"PTH",
# "PYI", # Specific to .pyi files for type stubs
"Q",
"PGH004",
"RET",
"RUF",
"C90",
"S",
# "SLF", # Private member accessed (sure, it's python)
"SIM",
# "TRY", # Good in principle, would take a lot of work to statisfy
"T10",
"T20",
"TID",
"TC",
"UP",
"N",
"W",
"YTT",
]
ignore = [
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic mthod
"D203", # 1 blank line required before class docstring
"D205", # 1 blank line between summary and description
"D401", # First line of docstring should be in imperative mood
"N806", # Variable X in function should be lowercase
"E731", # Do not assign a lambda expression, use a def
"A002", # Shadowing a builtin
"A003", # Shadowing a builtin
"S101", # Use of assert detected.
"W292", # No newline at end of file
"PLC1901", # "" can be simplified to be falsey
"TC003", # Move stdlib import into TYPE_CHECKING
"PLR2004", # Magic numbers, gets in the way a lot
"PLR0915", # Too many statements
"N803", # Argument name `X` should be lowercase
"N802", # Function name should be lowercase
"COM812", # Trailing comma missing (conflicts with formatter)
"T201", # Remove prints
"C408", # use of {} instead of dict
# --- Relaxed during the repo-wide ruff rollout (high-volume, non-auto-fixable, stylistic) ---
"D102", # Missing docstring in public method (consistent with ignored D104/D105; backfilling ~850 docstrings is out of scope)
"D103", # Missing docstring in public function (same rationale as D102)
"FBT001", # Boolean-typed positional arg (pervasive in existing public APIs; changing signatures is behavioral)
"FBT002", # Boolean default positional arg (same rationale as FBT001)
"PLC0415", # `import` outside top-level (the repo intentionally lazy-imports optional model deps inside _fit/class bodies)
"ERA001", # Commented-out code (cleanup is judgment-heavy; avoid churn)
# --- Stage 3: remaining high-volume, non-auto-fixable, stylistic rules (kept correctness/safety rules enabled) ---
# Docstrings (consistent with already-ignored D102/D103/D104/D105):
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D107", # Missing docstring in __init__
"D414", # Empty docstring section
"D415", # Docstring first line should end with punctuation
"D417", # Missing argument description in docstring
# Complexity metrics (consistent with already-ignored PLR0915; max-args already set to 10):
"C901", # Function is too complex
"PLR0912", # Too many branches
"PLR0913", # Too many arguments
# Unused arguments — required to honor shared interfaces (sklearn/AutoGluon fit/predict signatures):
"ARG001", # Unused function argument
"ARG002", # Unused method argument
"ARG003", # Unused class method argument
"ARG005", # Unused lambda argument
"FBT003", # Boolean positional value in call (consistent with already-ignored FBT001/FBT002)
# Ambiguous-unicode (math symbols/accents in strings, docstrings, comments are intentional):
"RUF001", "RUF002", "RUF003",
# pandas idiom opinions (noisy / frequent false positives; .values etc. are used deliberately):
"PD011", "PD003", "PD010", "PD013", "PD015",
"INP001", # Implicit namespace package (examples/scripts dirs intentionally have no __init__.py)
"PLW2901", # `for` loop variable overwritten (stylistic)
"NPY002", # Legacy numpy random (migration to Generator is a behavioral change; pervasive)
"E501", # Line too long (the ruff formatter is the authority for code line length; residual is unwrappable URLs/strings/comments)
"PTH", # Prefer pathlib over os.path (stylistic; os.path usage is correct and pervasive — avoid ~56 hand conversions)
"E741", # Ambiguous variable name (e.g. `l`) (stylistic)
"PLW0603", # Use of `global` (occasionally necessary; low value to refactor)
# Naming (consistent with already-ignored N802/N803/N806):
"A001", # Variable shadows a builtin (consistent with ignored A002/A003)
"N801", # Class name should use CapWords
"N812", # Lowercase imported as non-lowercase (e.g. `torch.nn.functional as F`)
"N999", # Invalid module name
# Broadly-applied stylistic opinions (pervasive, low value, non-auto-fixable):
"BLE001", # Blind `except Exception` (intentional in benchmark runners that must not crash)
"RUF059", # Unused variable in unpacking assignment
"B007", # Loop control variable not used within loop body
"RUF012", # Mutable class attribute should be annotated `ClassVar` (pervasive in ML config classes)
"UP035", # Deprecated import (typing aliases; harmless, low priority)
"SIM102", "SIM105", "SIM108", "SIM117", # if/with simplification opinions
"PLC0206", # Extracting value from dict without `.items()`
"E402", # Module import not at top of file (intentional after sys.path / lazy setup)
"S301", # `pickle` usage (intrinsic to the benchmark's result serialization)
"B021", # f-string docstring (only flagged instances have no placeholders; harmless)
]
[lint.per-file-ignores]
# Tests don't need module/class docstrings; INP001 covers any test dir without
# an __init__.py.
"tests/**" = [
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"INP001", # File is part of an implicit namespace package
"PT011", # pytest.raises(...) too broad — acceptable in tests
"PT018", # Composite assertion — acceptable in tests
"B017", # assert pytest.raises(Exception) — acceptable in tests
"RUF043", # pytest.raises pattern is a regex — acceptable in tests
]
# `__init__.py` files intentionally re-export names for the public API surface.
"**/__init__.py" = [
"F401", # Imported but unused (re-export)
]
[lint.isort]
no-lines-before = ["future"]
required-imports = ["from __future__ import annotations"]
combine-as-imports = true
extra-standard-library = ["typing_extensions"]
force-wrap-aliases = true
[lint.pydocstyle]
convention = "google"
[lint.pylint]
max-args = 10