mirror of
https://github.com/MaxRyabov/orio-search.git
synced 2026-10-19 15:23:33 +00:00
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.
46 lines
1.2 KiB
TOML
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"
|