-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathruff.toml
More file actions
executable file
·298 lines (292 loc) · 7.1 KB
/
ruff.toml
File metadata and controls
executable file
·298 lines (292 loc) · 7.1 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# SPDX-FileCopyrightText: 2025 Knitli Inc.
# SPDX-FileContributor: Adam Poulemanos <adam@knit.li>
#
# SPDX-License-Identifier: MIT OR Apache-2.0
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"typings",
"tests/fixtures/malformed.py",
]
extend-include = ["*.ipynb"]
fix = true
line-length = 100
indent-width = 4
target-version = "py312"
[format]
docstring-code-format = true
docstring-code-line-length = 80
line-ending = "auto"
indent-style = "space"
skip-magic-trailing-comma = true
exclude = [
"**/_vendor",
"setuptools/_distutils",
"setuptools/config/_validate_pyproject",
".venv",
".git",
".github",
".vscode",
".idea",
"dist",
"build",
"site",
"bin",
"lib",
"include",
"docs",
]
# Enable preview, required for quote-style = "preserve"
preview = true
# https://docs.astral.sh/ruff/settings/#format-quote-style
quote-style = "double"
[lint]
fixable = ["ALL"]
# Almost all rules; but not all https://docs.astral.sh/ruff/rules/
select = [
"A",
"ASYNC",
"B",
"C",
"D",
"E",
"F",
"FLY",
"FURB",
"G",
"I",
"ICN",
"INT",
"N",
"LOG",
"PD",
"PERF",
"PIE",
"PT",
"PTH",
"PYI",
"Q",
"RSE",
"RET",
"S",
"SLF",
"SLOT",
"SIM",
"TRY",
"RUF",
"UP",
"YTT",
"W",
]
extend-select = [
"A003",
"ANN201",
"ANN002",
"COM818",
"C901",
"DTZ005",
"DTZ007",
"FBT001",
"ISC003",
"TID252",
"TID253",
]
ignore = [
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E402",
"E111",
"E114",
"E117",
"D200",
"D205",
"D206",
"D300",
"D417",
"E501",
"Q000",
"Q001",
"Q002",
"Q003",
"PYI051", # redundant annotation with Literal and str -- we like to be explicit here
"COM812",
"COM819",
"ISC001",
"ISC002",
"D212",
"SLF001", # Private member accessed... it's not private for us.
"TRY003",
"UP015", # redundant-open-modes, explicit is preferred
]
exclude = [
".venv/",
"**/_vendor",
"setuptools/_distutils",
"setuptools/config/_validate_pyproject",
"typings",
"tests/fixtures/malformed.py",
]
[lint.pydocstyle]
convention = "google"
[lint.per-file-ignores]
"**/**/__init__.py" = [
"E402", # module level import not at top of file
]
# Ignore specific rules for certain files
"**/validation/**/*.py" = [
"S110", # try-except-pass
"TRY301", # abstract raise to an inner function
"S101", # allow assert
"SLF001", # Private member accessed
"D100", # missing docstring in public module
"D102", # missing docstring in public class
"D103", # missing docstring in public function
"D104", # missing docstring in public method
"D105", # missing docstring in magic method
"D107", # missing docstring in __init__
"G004", # f-string in logging statement
"N806", # incorrect case for function name
]
"tests/*.py" = [
"ANN",
"C901", # too complex
"D",
"DTZ",
"FBT001", # boolean typed positional argument
"G004", # f-string in logging statement
"N806", # incorrect case for function name
"PT012", # pytest.raises() block should contain a single simple statement
"PT017", # Found assertion on exception in except block
"PT018", # Assertion should be broken down into multiple parts
"PT011", # pytest.raises() too broad
"B017", # Do not assert blind exception
"PTH",
"S",
"SIM",
"SLF001", # Private member accessed
"PYI024", # Use typing.NamedTuple instead of collections.namedtuple
]
"scripts/**/*.py" = [
"ANN",
"C901", # too complex
"D",
"DTZ",
"N806", # incorrect case for function name
"S108", # Probable insecure usage of temporary file or directory
"TRY300", # Consider moving this statement to an else block
"RUF001", # String contains ambiguous characters
]
"mise-tasks/**/*.py" = [
"ANN",
"C901", # too complex
"D",
"DTZ",
"N806", # incorrect case for function name
"S108", # Probable insecure usage of temporary file or directory
]
"src/codeweaver/testing/**/*.py" = [
"ANN",
"C901", # too complex
"D",
"DTZ",
"FBT001", # boolean typed positional argument
"G004", # f-string in logging statement
"N806", # incorrect case for function name
"PTH",
"S",
"SIM",
"SLF001", # Private member accessed
]
#! The wall of shame for complex files that need to be gradually improved
# CLI commands are complex by nature due to argument parsing and validation
"src/codeweaver/cli/commands/*.py" = [
"C901", # too complex - CLI commands have inherent complexity
]
# Registry and provider management have complex configuration logic
"src/codeweaver/common/registry/provider.py" = [
"C901", # too complex - provider instantiation has complex branching
]
"src/codeweaver/common/statistics.py" = [
"C901", # too complex - statistics updates have complex conditional logic
]
# Core metadata determination has many edge cases
"src/codeweaver/core/metadata.py" = [
"C901", # too complex - file extension detection has many cases
]
# Engine components have complex orchestration logic
"src/codeweaver/engine/chunker/parallel.py" = [
"C901", # too complex - parallel processing has complex error handling
]
"src/codeweaver/engine/failover.py" = [
"C901", # too complex - failover logic has many edge cases
]
"src/codeweaver/engine/services/indexing_service.py" = [
"C901", # too complex - indexing orchestration is inherently complex
]
"src/codeweaver/engine/resource_estimation.py" = [
"C901", # too complex - file counting has many edge cases and depth handling
]
# Server components have complex lifecycle and health check logic
"src/codeweaver/server/health_service.py" = [
"C901", # too complex - health checks have many conditions
]
"src/codeweaver/server/server.py" = [
"C901", # too complex - server lifecycle has complex orchestration
]
"src/codeweaver/engine/chunker/base.py" = [
"C901", # too complex - `from_backup_profile` has complex branching
]
"src/codeweaver/providers/vector_stores/inmemory.py" = [
"C901", # too complex - vector store initialization has many conditions
]
# Provider config validation has complex asymmetric compatibility checking
"src/codeweaver/providers/config/categories/embedding.py" = [
"C901", # too complex - asymmetric validation has inherent complexity
"G201", # logger.exception preferred - existing logging style
"SIM102", # nested if - validates multiple independent conditions
"TRY300", # else block - return-in-try pattern intentional
"TRY301", # abstract raise - validation raises are intentional inline
"TRY401", # redundant exception in logging - existing style
]
"tools/tests/**/*.py" = [
"ANN201", # missing type annotation for self in method
"ANN002",
"S101",
"S108"
]
"tools/**/tests/**/*.py" = [
"ANN201", # missing type annotation for self in method
"ANN002",
"S101",
"S108"
]
[lint.isort]
force-single-line = false
force-wrap-aliases = false
lines-after-imports = 2
lines-between-types = 1
split-on-trailing-comma = false