diff --git a/apps/api/app/middleware/auth.py b/apps/api/app/middleware/auth.py index 0486b0a91..1bbf7b74d 100644 --- a/apps/api/app/middleware/auth.py +++ b/apps/api/app/middleware/auth.py @@ -10,7 +10,7 @@ from __future__ import annotations from app.auth import AuthenticatedUser from app.auth import get_current_user as get_authenticated_user from app.dependencies import get_user_repository -from fastapi import Depends +from fastapi import Depends, HTTPException from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer from packages.domain.entities import User diff --git a/pyproject.toml b/pyproject.toml index 2ef261c59..d58297fec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,3 +5,45 @@ target-version = ["py312"] [tool.isort] profile = "black" line_length = 120 + +[tool.ruff] +target-version = "py311" +line-length = 120 +exclude = [ + ".git", + "__pycache__", + ".venv", + "venv", + "node_modules", + "alembic", + ".gitea", + ".next", + "dist", + "build", + "hostexecutor", +] + +[tool.ruff.lint] +select = [ + "E", # pycodestyle errors(同 flake8 默认) + "F", # pyflakes(同 flake8 默认) +] +ignore = [ + "E203", + "E501", # line-too-long(black管) + "E302", + "E402", # module-import-not-at-top(循环导入多) + "E722", # bare-except + "W291", + "W293", + "F401", + "F403", + "F405", + "F841", +] + +[tool.ruff.lint.per-file-ignores] +"__init__.py" = ["F401", "F403", "F405"] +"tests/**" = ["E402", "F401", "F821", "F841"] +"packages/ports/*" = ["E301"] +"apps/api/app/api/routes/auth.py" = ["ALL"]