[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", ] [tool.ruff.lint] # 当前阶段:摸底模式,规则集与原flake8对齐 # 后续迭代计划: # Phase 1: 修完 bugbear 后正式替换 flake8 # Phase 2: 启用 UP(pyupgrade) + SIM(simplify) # Phase 3: 启用 RET(return) + ARG(unused-args) select = [ "E", # pycodestyle errors(同flake8) "F", # pyflakes(同flake8) "W", # pycodestyle warnings(同flake8) "B", # flake8-bugbear(新增,摸底用) ] # 与原 setup.cfg flake8 配置对齐,确保不新增阻断 ignore = [ "E203", "E501", # line-too-long(black管) "E302", "E402", # module-import-not-at-top(循环导入多) "E722", # bare-except "W291", "W293", "F401", # unused-import "F403", "F405", "F841", # unused-variable "B008", # do-not-perform-callback-from-arg(fastapi依赖注入) ] [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "F403", "F405"] "tests/*" = ["E402", "F401", "F841"] "packages/ports/*" = ["E301"] "apps/*/migrations/*" = ["ALL"] "alembic/*" = ["ALL"]