-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruff.toml
More file actions
201 lines (197 loc) · 12.8 KB
/
ruff.toml
File metadata and controls
201 lines (197 loc) · 12.8 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
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
# See https://docs.astral.sh/ruff/configuration/
# For a full list of supported rules, see https://docs.astral.sh/ruff/rules/
# For a full list of options, see https://docs.astral.sh/ruff/settings/
target-version = "py39"
[lint]
ignore = [
"A001", # Variable {name} is shadowing a Python builtin
"A002", # Function argument {name} is shadowing a Python builtin
"ANN001", # Missing type annotation for function argument {name}
"ANN002", # Missing type annotation for *{name}
"ANN003", # Missing type annotation for **{name}
"ANN201", # Missing return type annotation for public function {name}
"ANN202", # Missing return type annotation for private function {name}
"ANN204", # Missing return type annotation for special method {name}
"ANN205", # Missing return type annotation for staticmethod {name}
"ANN206", # Missing return type annotation for classmethod {name}
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name}
"ARG001", # Unused function argument: {name}
"ARG002", # Unused method argument: {name}
"ARG004", # Unused static method argument: {name}
"ARG005", # Unused lambda argument: {name}
"B007", # Loop control variable {name} not used within loop body
"B011", # Do not assert False (python -O removes these calls), raise AssertionError()
"B018", # Found useless expression. Either assign it to a variable or remove it.
"B024", # {name} is an abstract base class, but it has no abstract methods or properties
"B027", # {name} is an empty method in an abstract base class, but has no abstract decorator
"B904", # Within an except* clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling
"BLE001", # Do not catch blind exception: {name}
"C402", # Unnecessary generator (rewrite as a dict comprehension)
"C405", # Unnecessary {kind} literal (rewrite as a set literal)
"C408", # Unnecessary {kind}() call (rewrite as a literal)
"C901", # {name} is too complex ({complexity} > {max_complexity})
"COM812", # Trailing comma missing
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method
"D106", # Missing docstring in public nested class
"D107", # Missing docstring in __init__
"D200", # One-line docstring should fit on one line
"D202", # No blank lines allowed after function docstring (found {num_lines})
"D205", # 1 blank line required between summary line and description
"D207", # Docstring is under-indented
"D209", # Multi-line docstring closing quotes should be on a separate line
"D212", # Multi-line docstring summary should start at the first line
"D213", # Multi-line docstring summary should start at the second line
"D400", # First line should end with a period
"D401", # First line of docstring should be in imperative mood: "{first_line}"
"D403", # First word of the docstring should be capitalized: {} -> {}
"D404", # First word of the docstring should not be "This"
"D410", # Missing blank line after section ("{name}")
"D411", # Missing blank line before section ("{name}")
"D413", # Missing blank line after last section ("{name}")
"D415", # First line should end with a period, question mark, or exclamation point
"D417", # Missing argument description in the docstring for {definition}: {name}
"DTZ001", # datetime.datetime() called without a tzinfo argument
"DTZ005", # datetime.datetime.now() called without a tz argument
"E402", # Module level import not at top of cell
"E501", # Line too long ({width} > {limit})
"E713", # Test for membership should be not in
"E722", # Do not use bare except
"E731", # Do not assign a lambda expression, use a def
"EM101", # Exception must not use a string literal, assign to variable first
"EM102", # Exception must not use an f-string literal, assign to variable first
"EM103", # Exception must not use a .format() string directly, assign to variable first
"ERA001", # Found commented-out code
"F401", # {name} imported but unused; consider using importlib.util.find_spec to test for availability
"F403", # from {name} import * used; unable to detect undefined names
"F523", # .format call has unused arguments at position(s): {message}
"F541", # f-string without any placeholders
"F811", # Redefinition of unused {name} from {row}
"F821", # Undefined name {name}. {tip}
"F841", # Local variable {name} is assigned to but never used
"FBT001", # Boolean-typed positional argument in function definition
"FBT002", # Boolean default positional argument in function definition
"FBT003", # Boolean positional value in function call
"FIX002", # Line contains TODO, consider resolving the issue
"FIX004", # Line contains HACK, consider resolving the issue
"FLY002", # Consider {expression} instead of string join
"FURB188", # Prefer str.removeprefix() over conditionally replacing with slice.
"G003", # Logging statement uses +
"I001", # Import block is un-sorted or un-formatted
"ICN001", # {name} should be imported as {asname}
"INP001", # File {filename} is part of an implicit namespace package. Add an __init__.py.
"ISC003", # Explicitly concatenated string should be implicitly concatenated
"LOG015", # {}() call on root logger
"N802", # Function name {name} should be lowercase
"N803", # Argument name {name} should be lowercase
"N806", # Variable {name} in function should be lowercase
"N818", # Exception name {name} should be named with an Error suffix
"PERF102", # When using only the {subset} of a dict use the {subset}() method
"PERF203", # try-except within a loop incurs performance overhead
"PERF401", # Use {message_str} to create a transformed list
"PIE796", # Enum contains duplicate value: {value}
"PLC0206", # Extracting value from dictionary without calling .items()
"PLC0415", # import should be at the top-level of a file
"PYI006", # Use < or >= for sys.version_info comparisons
"PYI024", # Use typing.NamedTuple instead of collections.namedtuple
"PYI032", # Prefer object to Any for the second parameter to {method_name}
"PYI045", # __aiter__ methods should return an AsyncIterator, not an AsyncIterable
"PYI056", # Calling .{name}() on __all__ may not be supported by all type checkers (use += instead)
"PLE0604", # Invalid object in __all__, must contain only strings
"PLR0911", # Too many return statements ({returns} > {max_returns})
"PLR0912", # Too many branches ({branches} > {max_branches})
"PLR0913", # Too many arguments in function definition ({c_args} > {max_args})
"PLR0915", # Too many statements ({statements} > {max_statements})
"PLR1704", # Redefining argument with the local name {name}
"PLR1711", # Useless return statement at end of function
"PLR1714", # Consider merging multiple comparisons: {expression}. Use a set if the elements are hashable.
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"PLR5501", # Use elif instead of else then if, to reduce indentation
"PLW0120", # else clause on loop without a break statement; remove the else and dedent its contents
"PLW0603", # Using the global statement to update {name} is discouraged
"PLW1508", # Invalid type for environment variable default; expected str or None
"PLW1641", # Object does not implement __hash__ method
"PLW2901", # Outer {outer_kind} variable {name} overwritten by inner {inner_kind} target
"PT009", # Use a regular assert instead of unittest-style {assertion}
"PT015", # Assertion always fails, replace with pytest.fail()
"PT017", # Found assertion on exception {name} in except block, use pytest.raises() instead
"PT027", # Use pytest.raises instead of unittest-style {assertion}
"PT028", # Test function parameter {} has default argument
"PTH100", # os.path.abspath() should be replaced by Path.resolve()
"PTH103", # os.makedirs() should be replaced by Path.mkdir(parents=True)
"PTH107", # os.remove() should be replaced by Path.unlink()
"PTH110", # os.path.exists() should be replaced by Path.exists()
"PTH118", # os.{module}.join() should be replaced by Path with / operator
"PTH120", # os.path.dirname() should be replaced by Path.parent
"PTH123", # open() should be replaced by Path.open()
"RET501", # Do not explicitly return None in function if it is the only possible return value
"RET503", # Missing explicit return at the end of function able to return non-None value
"RET504", # Unnecessary assignment to {name} before return statement
"RET505", # Unnecessary {branch} after return statement
"RET506", # Unnecessary {branch} after raise statement
"RET507", # Unnecessary {branch} after continue statement
"RSE102", # Unnecessary parentheses on raised exception
"RUF005", # Consider {expression} instead of concatenation
"RUF013", # PEP 484 prohibits implicit Optional
"RUF022", # __all__ is not sorted
"RUF023", # {}.__slots__ is not sorted
"S101", # Use of assert detected
"S105", # Possible hardcoded password assigned to: "{}"
"S110", # try-except-pass detected, consider logging the exception
"S301", # pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"S603", # subprocess call: check for execution of untrusted input
"SIM102", # Use a single if statement instead of nested if statements
"SIM103", # Return the condition {condition} directly
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
"SIM108", # Use ternary operator {contents} instead of if-else-block
"SIM114", # Combine if branches using logical or operator
"SIM115", # Use a context manager for opening files
"SIM117", # Use a single with statement with multiple contexts instead of nested with statements
"SIM118", # Use key {operator} dict instead of key {operator} dict.keys()
"SIM300", # Yoda condition detected
"SIM910", # Use {expected} instead of {actual}
"SLF001", # Private member accessed: {access}
"SLOT002", # Subclasses of {namedtuple_kind} should define __slots__
"T201", # print found
"TC001", # Move application import {} into a type-checking block
"TC003", # Move standard library import {} into a type-checking block
"TD003", # Missing issue link for this TODO
"TD004", # Missing colon in TODO
"TD005", # Missing issue description after TODO
"TRY002", # Create your own exception
"TRY003", # Avoid specifying long messages outside the exception class
"TRY004", # Prefer TypeError exception for invalid type
"TRY203", # Remove exception handler; error is immediately re-raised
"TRY300", # Consider moving this statement to an else block
"TRY400", # Use logging.exception instead of logging.error
"TRY401", # Redundant exception object included in logging.exception call
"UP004", # Class {name} inherits from object
"UP006", # Use {to} instead of {from} for type annotation
"UP008", # Use super() instead of super(__class__, self)
"UP010", # Unnecessary __future__ import {import} for target Python version
"UP015", # Unnecessary mode argument
"UP018", # Unnecessary {literal_type} call (rewrite as a literal)
"UP024", # Replace aliased errors with OSError
"UP028", # Replace yield over for loop with yield from
"UP030", # Use implicit references for positional format fields
"UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of format call
"UP035", # Import from {target} instead: {names}
"UP036", # Version block is outdated for minimum Python version
"UP037", # Remove quotes from type annotation
"YTT201", # sys.version_info[0] == 3 referenced (python4), use >=
"YTT203", # sys.version_info[1] compared to integer (python4), compare sys.version_info to tuple
]
# Select all rules by default, and then ignore the ones we don't want.
# This is a good way to stay up-to-date with new rules in ruff.
select = ["ALL"]
# This is to suppress
# https://docs.astral.sh/ruff/rules/non-pep585-annotation/
# https://docs.astral.sh/ruff/rules/non-pep604-annotation-union/#non-pep604-annotation-union-up007
[lint.pyupgrade]
keep-runtime-typing = true