-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
97 lines (90 loc) · 3.26 KB
/
pyproject.toml
File metadata and controls
97 lines (90 loc) · 3.26 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
[project]
name = "kuznetzov-test"
version = "0.1.0"
description = ""
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"alembic>=1.17.2",
"asyncpg>=0.30.0",
"fastapi-cache2>=0.2.2",
"fastapi[standard]>=0.121.3",
"httpx>=0.28.1",
"pydantic-settings>=2.12.0",
"pytest>=9.0.1",
"pytest-asyncio>=1.3.0",
"redis>=7.1.0",
"slowapi>=0.1.9",
"sqlalchemy>=2.0.44",
"sqlalchemy-utils>=0.42.0",
]
[tool.ruff]
line-length = 120
exclude = [
"migrations",
]
[tool.ruff.lint.mccabe]
max-complexity = 7
[tool.ruff.lint.pylint]
max-args = 6 # Максимальное кол-во аргументов функции
max-branches = 10 # Максимальное кол-во ветвей if/else
max-statements = 50 # Максимальное кол-во операторов в функции
[tool.ruff.lint]
preview = true # Enables experimental rules like E225
select = [
"A", # flake8-builtins (переопределение встроенных имен)
"B", # flake8-bugbear -- опасные паттерны (использование x == None вместо x is None, и т.д.)
"C", # flake8-comprehensions (ненужный list(), ненужный dict())
"E", # Ошибки из pycodestyle (PEP 8)
"F", # Логические ошибки и потенциальные баги (неиспользуемый импорт, обращение к необъявленной переменной, и т.д.)
"I", # isort (сортировка импортов)
"W", # Предупреждения из pycodestyle (пробелы в конце строки, пустые строки, и т.д.)
"UP", # pyupgrade -- модернизация кода (замена type(x) == int на isinstance(x, int), и т.д.)
"PL", # Pylint правила (сложность функции, глобальные переменные)
"RET", # проверка return-ов
"COM", # Запятые
]
fixable = [
"E",
"F401",
"I",
"W",
"COM",
]
unfixable = [
"A",
"B",
"C",
"PL",
"RET",
"UP",
]
ignore = [
"RET501", # запрет на `return None` -- конфликт с mypy
"RET504", # лишнее определение переменной перед return
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None`
"UP031", # Use format specifiers instead of percent format
"PLR6301", # Method could be a function, class method, or static method
"PLC0415", # `import` should be at the top-level of a file
"B008", # Do not perform function call in argument defaults
]
[tool.ruff.lint.per-file-ignores]
"**/__init__.py" = ["F401"]
"**/test*.py" = ["PLR2004", "PLR0913", "PLR0915", "C901"]
[tool.ruff.lint.isort]
known-first-party = [
"api",
"orm",
"services",
"env_settings"
] # перечислить пакеты и отдельные модули для импортов
force-single-line = false
relative-imports-order = "closest-to-furthest"
combine-as-imports = true
[tool.pytest.ini_options]
asyncio_mode = "auto"
addopts = [
"-vv", # подробный вывод хода теста
"--import-mode=importlib", # меньше проблем с импортами
'-s'
]