@@ -129,33 +129,177 @@ exclude_lines = [
129
129
]
130
130
131
131
[tool .ruff ]
132
+ # preview = true # TODO: Enable this when we have the bandwidth
132
133
line-length = 99
133
134
extend-exclude = [
134
135
" pytest_django/_version.py" ,
135
136
]
136
137
137
138
[tool .ruff .lint ]
138
139
extend-select = [
139
- " B" , # flake8-bugbear
140
+ " AIR" , # Airflow
141
+ " ERA" , # eradicate
142
+ " FAST" , # FastAPI
143
+ " YTT" , # flake8-2020
144
+ " ANN" , # flake8-annotations
145
+ " ASYNC" , # flake8-async
146
+ " S" , # flake8-bandit
140
147
" BLE" , # flake8-blind-except
148
+ " FBT" , # flake8-boolean-trap
149
+ " B" , # flake8-bugbear
150
+ " A" , # flake8-builtins
151
+ " COM" , # flake8-commas
152
+ " C4" , # flake8-comprehensions
153
+ " CPY" , # flake8-copyright
141
154
" DTZ" , # flake8-datetimez
155
+ " T10" , # flake8-debugger
156
+ " DJ" , # flake8-django
157
+ " EM" , # flake8-errmsg
158
+ " EXE" , # flake8-executable
159
+ " FIX" , # flake8-fixme
142
160
" FA" , # flake8-future-annotations
161
+ " INT" , # flake8-gettext
162
+ " ISC" , # flake8-implicit-str-concat
163
+ " ICN" , # flake8-import-conventions
164
+ " LOG" , # flake8-logging
143
165
" G" , # flake8-logging-format
144
- " I" , # isort
145
- " PGH" , # pygrep-hooks
166
+ " INP" , # flake8-no-pep420
146
167
" PIE" , # flake8-pie
147
- " PL" , # pylint
148
- " PT" , # flake8-pytest-style
168
+ " T20" , # flake8-print
149
169
" PYI" , # flake8-pyi
150
- " RUF" , # Ruff-specific rules
170
+ " PT" , # flake8-pytest-style
171
+ " Q" , # flake8-quotes
172
+ " RSE" , # flake8-raise
173
+ " RET" , # flake8-return
174
+ " SLF" , # flake8-self
175
+ " SIM" , # flake8-simplify
151
176
" SLOT" , # flake8-slots
152
- " T10" , # flake8-debugger
177
+ " TID" , # flake8-tidy-imports
178
+ " TD" , # flake8-todos
179
+ " TC" , # flake8-type-checking
180
+ " ARG" , # flake8-unused-arguments
181
+ " PTH" , # flake8-use-pathlib
182
+ " FLY" , # flynt
183
+ " I" , # isort
184
+ " C90" , # mccabe
185
+ " PD" , # pandas-vet
186
+ " N" , # pep8-naming
187
+ " PERF" , # Perflint
188
+ " E" , # pycodestyle Error
189
+ " W" , # pycodestyle Warning
190
+ " DOC" , # pydoclint
191
+ " D" , # pydocstyle
192
+ " F" , # Pyflakes
193
+ " PGH" , # pygrep-hooks
194
+ " PL" , # Pylint
153
195
" UP" , # pyupgrade
154
- " YTT" , # flake8-2020
196
+ " FURB" , # refurb
197
+ " TRY" , # tryceratops
198
+ " RUF" , # Ruff-specific rules
155
199
]
156
200
ignore = [
157
- " PLR0913" , # Too many arguments in function definition
158
- " PLR2004" , # Magic value used in comparison, consider replacing 3 with a constant variable
201
+ " D100" , # Missing docstring in public module
202
+ " D101" , # Missing docstring in public class
203
+ " D102" , # Missing docstring in public method
204
+ " D103" , # Missing docstring in public function
205
+ " D104" , # Missing docstring in public package
206
+ " D105" , # Missing docstring in magic method
207
+ " D107" , # Missing docstring in __init__
208
+ " D200" , # One-line docstring should fit on one line
209
+ " D202" , # No blank lines allowed after function docstring
210
+ " D203" , # Class definitions that are not preceded by a blank line
211
+ " D205" , # 1 blank line required between summary line and description
212
+ " D209" , # Multi-line docstring closing quotes should be on a separate line
213
+ " D212" , # Multi-line docstring summary should start at the first line
214
+ " D213" , # Multi-line docstring summary should start at the second line
215
+ " D400" , # First line should end with a period
216
+ " D401" , # First line of docstring should be in imperative mood
217
+ " D404" , # First word of the docstring should not be "This"
218
+ " D415" , # First line should end with a period, question mark, or exclamation point
219
+ " S101" , # Use of `assert` detected
220
+
221
+ # TODO - need to fix these
222
+ " ANN001" , # Missing type annotation for function argument
223
+ " ANN002" , # Missing type annotation for public function
224
+ " ANN003" , # Missing type annotation for public method
225
+ " ANN201" , # Missing return type annotation for public function
226
+ " ANN202" , # Missing return type annotation for private function
227
+ " ANN204" , # Missing return type annotation for special method
228
+ " ANN401" , # Dynamically typed expressions .. are disallowed
229
+ " ARG001" , # Unused function argument
230
+ " ARG002" , # Unused method argument
231
+ " C901" , # .. is too complex
232
+ " COM812" , # Trailing comma missing
233
+ " E501" , # Line too long
234
+ " EM101" , # Exception must not use a string literal, assign to variable first
235
+ " EM102" , # Exception must not use an f-string literal, assign to variable first
236
+ " FBT001" , # Boolean-typed positional argument in function definition
237
+ " FBT002" , # Boolean default positional argument in function definition
238
+ " FBT003" , # Boolean positional value in function call
239
+ " N802" , # Function name `assertRedirects` should be lowercase
240
+ " N806" , # Variable `UserModel` in function should be lowercase
241
+ " PLC0415" , # `import` should be at the top-level of a file
242
+ " PLR0913" , # Too many arguments in function definition
243
+ " PLR2004" , # Magic value used in comparison, consider replacing .. with a constant variable
244
+ " RET504" , # Unnecessary assignment to .. before `return` statement
245
+ " RET505" , # Unnecessary `elif` after `return` statement
246
+ " S105" , # Possible hardcoded password assigned
247
+ " SIM102" , # Use a single `if` statement instead of nested `if` statements
248
+ " SIM108" , # Use ternary operator .. instead of `if`-`else`-block
249
+ " SIM114" , # Combine `if` branches using logical `or` operator
250
+ " SLF001" , # Private member accessed
251
+ " TC002" , # Move third-party import `django.contrib.messages.Message` into a type-checking block
252
+ " TC003" , # Move standard library import `collections.abc.Sequence` into a type-checking block
253
+ " TRY003" , # Avoid specifying long messages outside the exception class
254
+ ]
255
+ [tool .ruff .lint .per-file-ignores ]
256
+ "tests/*.py" = [
257
+ " ANN" , # Disable all annotations
258
+ " FIX003" , # Line contains XXX, consider resolving the issue
259
+ " DJ008" , # Model does not define .. method
260
+ " N801" , # Class name should use CapWords convention
261
+ " N802" , # Function name should be lowercase
262
+ " S" , # Disable all security checks
263
+ " TD001" , # Invalid TODO tag
264
+ " TD002" , # Missing author in TODO
265
+ " TD003" , # Missing issue link for this TODO
266
+
267
+ # TODO - need to fix these
268
+ " ARG005" , # Unused lambda argument
269
+ " D300" , # Use triple double quotes `"""`
270
+ " D403" , # First word of the docstring should be capitalized
271
+ " ERA001" , # Found commented-out code
272
+ " SIM117" , # Use a single `with` statement with multiple contexts instead of nested `with` statements
273
+ " TC001" , # Move application import .. into a type-checking block
274
+ " TC006" , # Add quotes to type expression in `typing.cast()`
275
+ " PTH108" , # `os.unlink()` should be replaced by `Path.unlink()`
276
+ " PTH110" , # `os.path.exists()` should be replaced by `Path.exists()`
277
+ " RET503" , # Missing explicit `return` at the end of function able to return non-`None` value
278
+ " RSE102" , # Unnecessary parentheses on raised exception
279
+ ]
280
+ "pytest_django_test/*.py" = [
281
+ " ANN" , # Disable all annotations
282
+ " FIX003" , # Line contains XXX, consider resolving the issue
283
+ " DJ008" , # Model does not define .. method
284
+ " N801" , # Class name should use CapWords convention
285
+ " N802" , # Function name should be lowercase
286
+ " S" , # Disable all security checks
287
+ " TD001" , # Invalid TODO tag
288
+ " TD002" , # Missing author in TODO
289
+ " TD003" , # Missing issue link for this TODO
290
+
291
+ # TODO - need to fix these
292
+ " ARG005" , # Unused lambda argument
293
+ " D300" , # Use triple double quotes `"""`
294
+ " D403" , # First word of the docstring should be capitalized
295
+ " ERA001" , # Found commented-out code
296
+ " SIM117" , # Use a single `with` statement with multiple contexts instead of nested `with` statements
297
+ " TC001" , # Move application import .. into a type-checking block
298
+ " TC006" , # Add quotes to type expression in `typing.cast()`
299
+ " PTH108" , # `os.unlink()` should be replaced by `Path.unlink()`
300
+ " PTH110" , # `os.path.exists()` should be replaced by `Path.exists()`
301
+ " RET503" , # Missing explicit `return` at the end of function able to return non-`None` value
302
+ " RSE102" , # Unnecessary parentheses on raised exception
159
303
]
160
304
161
305
[tool .ruff .lint .isort ]
0 commit comments