-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expand file tree
/
Copy pathruff.toml
More file actions
132 lines (116 loc) · 4.6 KB
/
ruff.toml
File metadata and controls
132 lines (116 loc) · 4.6 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
line-length = 120
[lint]
preview = true
select = ["ALL"]
explicit-preview-rules = false
ignore = [
# Pylint convention
"PLC0415", # import-outside-top-level
"PLC1901", # compare-to-empty-string
# Should probably fix these
"PLC2801", # unnecessary-dunder-call
"PLC2701", # import-private-name
# Pylint refactor
"PLR0915", # too-many-statements
"PLR0914", # too-many-locals
"PLR0913", # too-many-arguments
"PLR0912", # too-many-branches
"PLR1702", # too-many-nested-blocks
"PLR0904", # too-many-public-methods
"PLR0917", # too-many-positional-arguments
"PLR0916", # too-many-boolean-expressions
"PLR0911", # too-many-return-statements
# Should probably fix these
"PLR6301", # no-self-use
"PLR2004", # magic-value-comparison
# Pylint warning
"PLW1641", # eq-without-hash
# Should probably fix these
"PLW1514", # unspecified-encoding
"PLW0603", # global-statement
# Flake8 async
# Should probably fix these
"ASYNC230", # blocking-open-call-in-async-function
"ASYNC240", # pathlib for async operations
"ASYNC250", # blocking-input-call-in-async-function
# Should probably fix these after dealing with shielding for anyio
"ASYNC109", # async-function-with-timeout
# flake8-implicit-str-concat
"ISC003", # explicit-string-concatenation
# Ruff Specific
# This code is problematic because using instantiated types as defaults is so common across the codebase.
# Its purpose is to prevent accidenatally assigning mutable defaults. However, this is a bit overkill for that.
# That being said, it would be nice to add some way to actually guard against that specific mutable default behavior.
"RUF009", # function-call-in-dataclass-default-argument
"RUF056", # falsy-dict-get-fallback
# Should probably fix this
"RUF029", # unused-async
# Security linter
"S603", # subprocess-without-shell-equals-true
# Should probably fix this
"S104", # hardcoded-bind-all-interfaces
"S110", # try-except-pass
"S112", # try-except-continue
"S311", # suspicious-non-cryptographic-random-usage
"S608", # hardcoded-sql-expression
# Need review on which of these we can/should fix
"S101", # assert
"S404", # suspicious-subprocess-import
"S607", # start-process-with-partial-path
# Should fix
"FBT", # boolean positional usage: ~2100 errors
"ANN", # function annotations: ~1100 errors # Gets fixed with mypy-exclusion removal
"G", # logging format: ~1000 errors
"RET", # return linting: ~700 errors
"B", # potential bugs linting: ~600 errors
"PT", # pytest styling: ~600 errors
"SIM", # code simplifications: ~500 errors
"A", # bad behavior relative to builtins: ~200 errors
"PTH", # pathlib linting: ~200 errors
"PGH", # cheap code quality improvements: ~100 errors
"LOG", # logging: <50 errors
# Might be nice, might be annoying
"BLE001", # blind exceptions: ~300 errors
"D", # docstrings: ~9000 errors,
"TRY", # proper exception behavior: ~1300 errors
"EM", # exception messages: ~1000 errors
"C", # comprehensions: ~600 errors
"SLF", # private member access: ~600 errors
"FURB", # "refurbishing" and "modernizing": ~200 errors
"PERF", # anti-pattern linting: ~200 errors
"N", # pep8 naming: ~200 errors
# Probably fine for our purposes
"COM812", # trailing commas: ~5000 errors
"CPY001", # copyright notices: ~900 errors
"TC", # type checking linting: ~1700 errors # Too much reliance on runtime types to enable this
"T20", # using print: ~1300 errors # might want to enable this but not for CLI or tools/
"TD", # formatting of TODOs: ~800 errors
"DOC", # also docstrings: ~700 errors
"ARG", # unused arguments: ~500 errors
"ERA", # commented out code: ~400 errors
"DTZ", # datetimez: <50 errors # likely needs the tzlocal library as a dependency
"FIX", # TODOs, etc: ~400 errors
]
[lint.per-file-ignores]
"chia/_tests/*" = ["S106"]
"chia/__init__.py" = ["RUF067"]
[lint.flake8-implicit-str-concat]
# Found 3279 errors.
# allow-multiline = false
[lint.flake8-tidy-imports]
ban-relative-imports = "all"
[lint.flake8-tidy-imports.banned-api]
"asyncio.create_task".msg = "Use `from chia.util.task_referencer import create_referenced_task` and `create_referenced_task()`"
[lint.isort]
required-imports = ["from __future__ import annotations"]
[lint.pylint]
max-args = 5
max-locals = 15
max-returns = 6
max-branches = 12
max-statements = 50
max-nested-blocks = 5
max-public-methods = 20
max-bool-expr = 5
[lint.pyupgrade]
keep-runtime-typing = true