-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathruff.toml
More file actions
82 lines (79 loc) · 3.18 KB
/
Copy pathruff.toml
File metadata and controls
82 lines (79 loc) · 3.18 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
[lint]
future-annotations = true
# https://docs.astral.sh/ruff/rules/
extend-select = [
"ANN2", # flake8-annotations: missing-return-type
"C4", # flake8-comprehensions
"F401", # unused-import
"F404", # late-future-import
"FA", # flake8-future-annotations
"FLY", # Flynt
"ICN", # flake8-import-conventions
"PERF", # Perflint
"PGH", # pygrep-hooks (blanket-* rules)
"PYI", # flake8-pyi
"RUF", # Ruff-specific rules
"SIM9", # flake8-simplify: split-static-string + zip-dict-keys-and-values
"SLOT", # flake8-slots
"TC", # flake8-type-checking
"TID", # flake8-tidy-imports
"UP", # pyupgrade
"YTT", # flake8-2020
]
ignore = [
# Only enforce return types on public functions. Where otherwise mypy infers as Any
# Still worth running `ruff check --fix --select=202` once in a while for autofixes
"ANN202", # missing-return-type-private-function
# Explicit is preferred
"UP015", # redundant-open-modes,
# Autofixes print-f style formatting to f-strings,
# which is sometimes simpler, but looses template code reading semantics
"UP032", # f-string
# TC helps prevent circular imports, reduce runtime cost of typing symbols,
# and prevent leaking implementations details into modules
# However stdlib is not at risk of circular import, is clearly not public API,
# and assume it's gonna be included in the import chain at some point anyway
"TC003", # typing-only-standard-library-import
# Typeshed doesn't want complex or non-literal defaults for maintenance and testing reasons.
# This doesn't affect us, let's have more complete stubs.
"PYI011", # typed-argument-default-in-stub
"PYI014", # argument-default-in-stub
"PYI053", # string-or-bytes-too-long
# Good to watch for, but often unfixable
# Anyway Python 3.11 introduced "zero cost" exception handling
"PERF203", # try-except-in-loop,
# TODO: Consider later
"UP031", # printf-string-formatting
"RUF059", # unused-unpacked-variable
]
# F401 would remove imports not marked as explicit re-exports, which may break API boundaries
extend-unsafe-fixes = ["F401"]
[lint.per-file-ignores]
"**/typings/**/*.pyi" = [
"E402", # https://github.com/astral-sh/ruff/issues/26160
"F811", # Re-exports false positives
# The following can't be controlled for external libraries:
"A", # Shadowing builtin names
"E741", # ambiguous variable name
"F403", # `from . import *` used; unable to detect undefined names
"FBT", # flake8-boolean-trap
"ICN001", # unconventional-import-alias
"N8", # Naming conventions
"PLC2701", # Private name import
"PLE0302", # The special method expects a given signature
"PLR0904", # Too many public methods
"PLR0913", # Argument count
"PLR0917", # Too many positional arguments
"PLW3201", # misspelled dunder method name
"SLOT", # flake8-slots
# Stubs can sometimes re-export entire modules.
# Issues with using a star-imported name will be caught by type-checkers.
"F405", # may be undefined, or defined from star imports
# It's normal to be missing annotations for local stubs.
# If they were complete, we'd upload them to typeshed!
"ANN0",
"ANN2",
]
# https://docs.astral.sh/ruff/settings/#lintflake8-type-checking
[lint.flake8-type-checking]
quote-annotations = true