orio-search/pyproject.toml
Максим Рябов 2d52872398 Add ruff linter and formatter configuration
Set up ruff as the project linter and formatter with rules tailored
for FastAPI/async codebase. Migrate pytest config from pytest.ini to
pyproject.toml. Auto-fix imports, modernize str+Enum to StrEnum,
add strict=True to zip(), and format all Python files.
2026-04-10 23:47:50 +03:00

46 lines
1.2 KiB
TOML

[project]
name = "orio-search"
version = "2.0.0"
requires-python = ">=3.12"
[tool.ruff]
target-version = "py312"
line-length = 120
exclude = [".git", "__pycache__", ".venv", "docs", "searxng"]
[tool.ruff.lint]
select = [
"F", # Pyflakes
"E", "W", # pycodestyle
"I", # isort
"UP", # pyupgrade (modernize to 3.12)
"B", # flake8-bugbear
"SIM", # flake8-simplify
"ASYNC", # async anti-patterns
"S", # flake8-bandit (security)
"T20", # no stray print()
"RET", # return patterns
"PIE", # misc lints
"RUF", # ruff-specific
]
ignore = [
"E501", # line length — formatter handles this
"S101", # assert — used in tests and validation
"RET504", # assignment before return — often more readable
"B008", # Depends() in default args — standard FastAPI pattern
]
[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = ["S101", "S104", "S106", "B011", "ASYNC"]
"app/config.py" = ["S104"] # bind 0.0.0.0 for Docker
[tool.ruff.lint.isort]
known-first-party = ["app"]
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true
[tool.pytest.ini_options]
asyncio_mode = "auto"