From 6efdfbe19465dc5c2802124e2008659df37d2874 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Tue, 28 Jul 2026 13:19:55 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20pyproject.toml=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8E=9F=E7=94=9Fruff=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DCode=20Quality=E5=85=A8=E9=87=8F=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=20(#1074)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/api/app/middleware/auth.py | 2 +- pyproject.toml | 42 +++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) 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"]