forked from fmhy/bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyproject.toml
111 lines (85 loc) · 3.34 KB
/
pyproject.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
[tool.ruff]
target-version = "py312"
line-length = 100
ignore = [
# (missing public docstrings) These work off of the Python sense of "public", rather than our
# bespoke definition based off of `@public`. When ruff supports custom plugins then we can write
# appropriate rules to require docstrings for `@public`.
"D100",
"D101",
"D102",
"D103",
"D104",
"D105",
"D106",
"D107",
# (docstring imperative mood) Overly restrictive.
"D401",
# (module level import not at top) There are several places where we use e.g.
# warnings.filterwarings calls before imports.
"E402",
# (no type comparison): There are a few places where we use `== type(None)` which are more clear
# than the equivalent `isinstance` check.
'E721',
# (bare exception): There are many places where we want to catch a maximally generic exception.
'E722',
# (no assign lambda): existing code assigns lambdas in a few places. With ruff formatting
# requiring extra empty lines between defs, disallowing lambda assignment can make code less
# readable.
"E731",
# (try-except-in-loop) we use this pattern in many places and the performance impact is negligible
"PERF203",
# (no concatenation) Existing codebase has many concatentations, no reason to disallow them.
"RUF005",
# (assorted perf rules) We have a lot of violations, enable when autofix is available
"PERF401", # (manual-list-comprehension)
"PERF402", # (manual-list-copy)
]
# By default, ruff only uses all "E" (pycodestyle) and "F" (pyflakes) rules.
# Here we append to the defaults.
select = [
# (flake8-builtins) detect shadowing of python builtin symbols by variables and arguments.
# Attributes are OK (which is why A003) is not included here.
"A001",
"A002",
# (useless expression): Expressions that aren't assigned to anything are typically bugs.
"B018",
# (pycodestyle) pycodestyle rules
"E",
# (pyflakes) pyflakes rules
"F",
# (isort) detect improperly sorted imports
"I001",
# (performance) perflint rules
"PERF",
# (pylint) use all pylint rules from categories "Convention", "Error", and "Warning" (ruff
# currently implements only a subset of pylint's rules)
"PLE",
"PLW",
# (no commented out code) keep commented out code blocks out of the codebase
# "ERA001",
# (ruff-specific) Enable all ruff-specific checks (i.e. not ports of
# functionality from an existing linter).
"RUF",
# (private member access) Flag access to `_`-prefixed symbols. By default the various special
# methods on `NamedTuple` are ignored (e.g. `_replace`).
"SLF001",
# (flake8-type-checking) Auto-sort imports into TYPE_CHECKING blocks depending on whether
# they are runtime or type-only imports.
"TCH",
# (banned-api) Flag use of banned APIs. See tool.ruff.flake8-tidy-imports.banned-api for details.
"TID251",
# (disallow print statements) keep debugging statements out of the codebase
"T20",
# (f-strings) use f-strings instead of .format()
"UP032",
# (invalid escape sequence) flag errant backslashes
"W605",
]
[tool.ruff.isort]
# Combine multiple `from foo import bar as baz` statements with the same source
# (`foo`) into a single statement.
combine-as-imports = true
# Imports of the form `from foo import bar as baz` show one `import bar as baz`
# per line. Useful for __init__.py files that just re-export symbols.
force-wrap-aliases = true