[tool.black] line-length = 120 target-version = ["py312"] extend-exclude = ''' ( \.git | \.cache | \.pytest_cache | \.mypy_cache | __pycache__ | node_modules | \.venv | venv | build | dist | \.next | out | coverage ) ''' [tool.isort] profile = "black" line_length = 120 extend_skip_glob = [ ".git/**", ".cache/**", ".pytest_cache/**", ".mypy_cache/**", "__pycache__/**", "node_modules/**", ".venv/**", "venv/**", "build/**", "dist/**", ".next/**", "out/**", "coverage/**", ] [tool.coverage.run] source = ["apps/api/app", "packages"] omit = [ "*/migrations/*", "*/tests/*", "*/test_*.py", "*/site-packages/*", ] branch = true [tool.ruff] target-version = "py311" line-length = 120 exclude = [ ".git", ".cache", "__pycache__", ".venv", "venv", "node_modules", "alembic", ".gitea", ".next", "dist", "build", "hostexecutor", ] [tool.ruff.lint] # 正式替换 flake8:规则集与原 flake8 完全对齐 # 后续迭代计划: # Phase 2: 加入 B (flake8-bugbear),修完后升级为阻断级 # Phase 3: 启用 UP(pyupgrade) + SIM(simplify) # Phase 4: 启用 RET(return) + ARG(unused-args) select = [ "E", # pycodestyle errors(同 flake8) "F", # pyflakes(同 flake8) "W", # pycodestyle warnings(同 flake8) "B", # flake8-bugbear(P0-5 Step 2 已完成修复) ] # 与原 setup.cfg + .flake8 的 flake8 配置完全对齐 # 注意:W503 在 ruff≥0.14 中已被移除(行为变默认),故不列入 ignore = [ "E203", "E501", # line-too-long(black管) "E302", "E402", # module-import-not-at-top(循环导入多) "E722", # bare-except "W291", "W293", "B008", # function-call-in-default-argument(FastAPI 依赖注入模式,大量使用) "F403", "F405", ] [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "F403", "F405"] "tests/*" = ["E402", "F401", "F821", "F841"] "packages/ports/*" = ["E301"] # E704 在 ruff≥0.14 已移除 "apps/api/app/api/routes/auth.py" = ["ALL"] "apps/api/app/api/routes/workspaces.py" = ["ALL"] "apps/api/app/middleware/auth.py" = ["ALL"] "apps/*/migrations/*" = ["ALL"] "alembic/*" = ["ALL"] "tests/**" = ["B011"]