-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff.toml
More file actions
206 lines (203 loc) · 7.5 KB
/
ruff.toml
File metadata and controls
206 lines (203 loc) · 7.5 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
# Copied from https://github.com/dry-python/returns/blob/master/pyproject.toml
# Exclude a variety of commonly ignored directories.
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",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
target-version = "py313"
line-length = 120
preview = true
fix = true
format.quote-style = "single"
format.docstring-code-format = false
lint.select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"C90", # maccabe
"COM", # flake8-commas
"D", # pydocstyle
"DTZ", # flake8-datetimez
"E", # pycodestyle
"ERA", # flake8-eradicate
"EXE", # flake8-executable
"F", # pyflakes
"FBT", # flake8-boolean-trap
"FLY", # pyflint
"FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ICN", # flake8-import-conventions
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"N", # pep8-naming
"PERF", # perflint
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # ruff
"S", # flake8-bandit
"SIM", # flake8-simpify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T100", # flake8-debugger
"TRY", # tryceratops
"UP", # pyupgrade
"W", # pycodestyle
"YTT", # flake8-2020
]
lint.ignore = [
"A005", # allow to shadow stdlib and builtin module names
"COM812", # trailing comma, conflicts with `ruff format`
# Different doc rules that we don't really care about:
"D100",
"D104",
"D106",
"D203",
"D212",
"D401",
"D404",
"D405",
"ISC001", # implicit string concat conflicts with `ruff format`
"ISC003", # prefer explicit string concat over implicit concat
"PLR09", # we have our own complexity rules
"PLR2004", # do not report magic numbers
"PLR6301", # do not require classmethod / staticmethod when self not used
"TRY003", # long exception messages from `tryceratops`
"E501", # line too long
]
# lint.per-file-ignores."*.pyi" = [ "D103" ]
# lint.per-file-ignores."returns/context/__init__.py" = [ "F401", "PLC0414" ]
# lint.per-file-ignores."returns/contrib/mypy/*.py" = [ "S101" ]
# lint.per-file-ignores."returns/contrib/pytest/__init__.py" = [ "F401", "PLC0414" ]
# lint.per-file-ignores."returns/interfaces/*.py" = [ "S101" ]
# lint.per-file-ignores."returns/methods/__init__.py" = [ "F401", "PLC0414" ]
# lint.per-file-ignores."returns/pipeline.py" = [ "F401", "PLC0414" ]
# lint.per-file-ignores."returns/pointfree/__init__.py" = [ "F401", "PLC0414" ]
# lint.per-file-ignores."returns/primitives/asserts.py" = [ "S101" ]
lint.per-file-ignores."**/tests/**/*.py" = [
"A002", # allow shadowing builtins (like `id`) in tests
"B017", # allow blind exception assertions in tests
"B901", # allow yield + return in generator tests (testing do notation)
"B903", # allow non-dataclass simple classes in tests
"C901", # complexity in tests is fine
"D102", # test methods don't need docstrings
"D105", # magic methods don't need docstrings in tests
"D107", # __init__ doesn't need docstrings in tests
"E402", # imports can be after statements in tests
"FBT001", # boolean positional args in test function definitions
"FBT002", # boolean positional args in test function definitions
"FBT003", # boolean positional values in test function calls
"FURB118", # allow simple add functions instead of operator.add
"PLC0415", # imports inside functions are fine in tests
"PLC2701", # allow importing private modules for testing internals
"PLR0124", # allow name compared with itself (testing identity)
"PLR0133", # allow constant comparisons in tests
"PT011", # allow broad pytest.raises
"PT017", # allow assertions on caught exceptions
"RUF002", # allow ambiguous unicode in docstrings
"RUF006", # allow storing async functions without awaiting in tests
"RUF029", # allow async functions to not use `await`
"RUF043", # allow regex patterns in pytest match
"S101", # asserts
"S105", # hardcoded passwords
"S108", # allow /tmp paths in tests
"S110", # try-except-pass is fine in cleanup
"S404", # subprocess calls are for tests
"S603", # do not require `shell=True`
"S607", # partial executable paths
"SIM105", # contextlib.suppress not required
"SIM115", # allow file operations without context manager
"SIM117", # allow nested with statements
"SLF001", # allow accessing private members for testing
]
lint.per-file-ignores."tests/test_examples/*" = ["D102"]
lint.per-file-ignores."docs/scripts/**/*.py" = [
"C901", # complexity ok in doc scripts
"E722", # bare except ok for fallback behavior
"PLR6201", # tuple vs set membership check
"S110", # try-except-pass ok in doc scripts
]
lint.per-file-ignores."**/*.pyi" = [
"D103", # stubs don't need docstrings
"N818", # exception naming conventions relaxed for stubs
]
lint.per-file-ignores."**/main.py" = [
"D103", # placeholder main.py files don't need docstrings
]
lint.per-file-ignores."workspaces/python/klaw-*/src/**/__init__.py" = [
"D103", # placeholder modules don't need docstrings
]
lint.per-file-ignores."workspaces/rust/*/src/**/__init__.py" = [
"D103", # placeholder modules don't need docstrings
]
lint.per-file-ignores."workspaces/rust/klaw-dbase/**/*.py" = [
"C901", # complex scan function is okay
"FBT003", # boolean positional in batch_iter_with_progress
"PTH118", # allow os.path.join for now
"PTH207", # allow iglob for now
]
lint.per-file-ignores."workspaces/python/klaw-core/src/klaw_core/**/*.py" = [
"A004", # allow TimeoutError re-export
"C901", # complex functions like _apply_op are okay
"D105", # magic methods don't need docstrings
"D107", # __init__ in exception classes doesn't need docstrings
"D402", # allow fn.range() docstring
"E402", # allow imports after TypeVar in executor.py
"FBT001", # boolean positional args in some APIs (splitlines, channel)
"FBT002", # boolean default args in some APIs
"LOG015", # allow root logger for simple warnings
"N818", # BackendException naming is fine
"PLC0415", # lazy imports to avoid circular deps (Result/Option)
"PLC2801", # dunder call for __aenter__ is intentional
"PLW1641", # Expr doesn't need __hash__ (uses msgspec frozen struct)
"PLW2901", # loop variable reassignment in _apply is intentional
"RUF029", # async channel function doesn't await (returns sync result)
"S101", # asserts in backend code
"S110", # try-except-pass for cleanup
"SIM105", # contextlib.suppress not required in cleanup
"SLF001", # internal API access (_complete, _fail, etc.)
"UP046", # msgspec.Struct requires Generic[T] syntax, not PEP 695
]
# lint.per-file-ignores."tests/test_examples/test_maybe/test_maybe_pattern_matching.py" = [
# "D101",
# "D103",
# "F811",
# ]
# lint.per-file-ignores."tests/test_examples/test_result/test_result_pattern_matching.py" = [
# "D103",
# ]
# lint.per-file-ignores."tests/test_pattern_matching.py" = [ "S101" ]
lint.external = ["WPS"]
lint.flake8-quotes.inline-quotes = "single"
lint.mccabe.max-complexity = 6
# lint.pep8-naming.staticmethod-decorators = [ "law_definition", "staticmethod" ]
lint.pydocstyle.convention = "google"