-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
ruff.toml
89 lines (81 loc) · 3.04 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
# extend pyproject.toml for requires-python (workaround astral-sh/ruff#10299)
extend = "pyproject.toml"
exclude = [
"**/_vendor",
"setuptools/_distutils",
"setuptools/config/_validate_pyproject",
]
[lint]
extend-select = [
"C901",
"W",
# local
"ANN2", # missing-return-type-*
"F", # Pyflakes
"F404", # late-future-import
"FA", # flake8-future-annotations
"I", # isort
"PERF", # Perflint
"PGH", # pygrep-hooks (blanket-* rules)
"PT", # flake8-pytest-style
"PYI", # flake8-pyi
"RUF10", # unused-noqa & redirected-noqa
"TRY", # tryceratops
"UP", # pyupgrade
"YTT", # flake8-2020
]
ignore = [
"PERF203", # try-except-in-loop, micro-optimisation with many false-positive. Worth checking but don't block CI
"PT004", # deprecated https://github.com/astral-sh/ruff/issues/8796#issuecomment-2057143531
"PT005", # deprecated https://github.com/astral-sh/ruff/issues/8796#issuecomment-2057143531
"PT007", # temporarily disabled, TODO: configure and standardize to preference
"PT011", # temporarily disabled, TODO: tighten expected error
"PT012", # pytest-raises-with-multiple-statements, avoid extra dummy methods for a few lines, sometimes we explicitly assert in case of no error
"TRY003", # raise-vanilla-args, avoid multitude of exception classes
"TRY301", # raise-within-try, it's handy
"UP015", # redundant-open-modes, explicit is preferred
"UP027", # unpacked-list-comprehension, is actually slower for cases relevant to unpacking, set for deprecation: https://github.com/astral-sh/ruff/issues/12754
"UP030", # temporarily disabled
"UP031", # temporarily disabled
"UP032", # temporarily disabled
"UP038", # Using `X | Y` in `isinstance` call is slower and more verbose https://github.com/astral-sh/ruff/issues/7871
# Only enforcing return type annotations for public functions
"ANN202", # missing-return-type-private-function
"ANN204", # missing-return-type-special-method
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"W191",
"E111",
"E114",
"E117",
"D206",
"D300",
"Q000",
"Q001",
"Q002",
"Q003",
"COM812",
"COM819",
"ISC001",
"ISC002",
]
[lint.per-file-ignores]
# Suppress nuisance warnings about module-import-not-at-top-of-file (E402) due to workaround for #4476
"setuptools/__init__.py" = ["E402"]
"pkg_resources/__init__.py" = ["E402"]
[lint.isort]
combine-as-imports = true
split-on-trailing-comma = false
# Force Ruff/isort to always import setuptools before distutils in tests as long as distutils_hack is supported
# This also ensures _distutils_hack is imported before distutils
# https://github.com/pypa/setuptools/issues/4137
section-order = ["future", "standard-library", "eager", "third-party", "first-party", "local-folder", "delayed"]
sections.eager = ["_distutils_hack"]
sections.delayed = ["distutils"]
[lint.flake8-annotations]
ignore-fully-untyped = true
[format]
# Enable preview to get hugged parenthesis unwrapping and other nice surprises
# See https://github.com/jaraco/skeleton/pull/133#issuecomment-2239538373
preview = true
# https://docs.astral.sh/ruff/settings/#format_quote-style
quote-style = "preserve"