-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruff.toml
205 lines (179 loc) · 4.02 KB
/
ruff.toml
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
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"__init__.py",
]
cache-dir = "./.ruff_cache"
# Group violations by containing file.
output-format = "concise"
src = [ "src", "test" ]
# Enumerate all fixed violations.
show-fixes = true
# Same as Black.
line-length = 66
indent-width = 4
# Assume Python 3.11
target-version = "py311"
[lint]
# Enable Ruff's rules
select = [
# pycodestyle
"E",
# pycodestyle warnings
"W",
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
# flake8-quotes
"Q",
# pep8-naming
"N",
# pydocstyle
"D",
# flake8-comprehensions
"C4",
# flake8-annotations
"ANN",
# flake8-async
"ASYNC",
# unused arguments in functions
"ARG001",
# flake8-import-conventions
"ICN",
# pyupgrade
"UP",
# Ruff-specific rules
"RUF",
]
# Ignore specific PEP 8 warnings for indentation and spacing
ignore = [
# W191: indentation contains tabs
"W191",
# E111: indentation is not a multiple of four
"E111",
# E114: indentation is not a multiple of four (continued)
"E114",
# E117: over-indented block
"E117",
# D206: missing docstring in public module
"D206",
# D300: use type annotations instead of comments for types
"D300",
# Q000-Q003: various quality gate issues
"Q000",
"Q001",
"Q002",
"Q003",
# COM812, COM819: various comment-related issues
"COM812",
"COM819",
# ISC001, ISC002: various import sorting issues
"ISC001",
"ISC002",
# D203-D213: various docstring-related issues
"D203",
"D211",
"D212",
"D213",
# ANN001-ANN003: various annotation-related issues
"ANN001",
"ANN002",
"ANN003",
# D100, D401, D404, D205, D210, D417: various docstring and annotation issues
"D100",
"D401",
"D404",
"D205",
"D210",
"D417",
# SIM117: similar line in nearby lines
"SIM117",
# I001: invalid import order
"I001",
# line too long, handled by black
"E501",
# do not perform function calls in argument defaults
"B008",
# Allow raising exceptions without from e, for HTTPException
"B904",
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = [ "ALL" ]
unfixable = [ ]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Ignore `E402` (import violations) in all `__init__.py` files, and in select subdirectories.
[lint.per-file-ignores]
"__init__.py" = [ "E402" ]
"**/{tests,docs,tools}/*" = [ "E402" ]
[lint.flake8-errmsg]
max-string-length = 20
[lint.flake8-pytest-style]
parametrize-names-type = "csv"
parametrize-values-row-type = "tuple"
parametrize-values-type = "tuple"
[lint.flake8-type-checking]
exempt-modules = [ "typing", "typing_extensions" ]
[lint.flake8-unused-arguments]
ignore-variadic-names = true
[lint.pycodestyle]
max-doc-length = 66
[lint.pydocstyle]
convention = "pep257"
[lint.isort]
force-single-line = false
force-wrap-aliases = false
lines-after-imports = -1
lines-between-types = 0
split-on-trailing-comma = false
[lint.pylint]
max-args = 5
max-bool-expr = 5
max-branches = 5
max-locals = 7
max-nested-blocks = 4
max-positional-args = 5
[lint.mccabe]
# Flag errors (`C901`) whenever the complexity level exceeds 5.
max-complexity = 5
[lint.pyupgrade]
keep-runtime-typing = true
[lint.ruff]
# Make it a violation to use a tuple in a subscript without parentheses.
parenthesize-tuple-in-subscript = true
[format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "lf"