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