diff --git a/pyproject.toml b/pyproject.toml index c7980fef8..1f882a688 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,32 +3,23 @@ target-version = "py311" line-length = 120 [tool.ruff.lint] +# 规则集:E/F(等同flake8基础)+ I(isort)+ B(bugbear,低风险) +# 逐步加规则,避免一次性引入太多噪音 select = [ "E", # pycodestyle errors - "F", # pyflakes + "F", # pyflakes (未使用import/变量等) "W", # pycodestyle warnings "I", # isort - "B", # flake8-bugbear - "UP", # pyupgrade - "SIM", # flake8-simplify - "RET", # flake8-return - "ARG", # flake8-unused-arguments + "B", # flake8-bugbear(常见bug模式) ] ignore = [ "E402", # module-import-not-at-top-of-file(循环导入导致的延迟导入很多) "E501", # line-too-long(black已经管了) - "UP006", # use-list-type (太多了,3.9+才支持,项目目标3.11但历史代码多) - "UP007", # use-union-type "B008", # do-not-perform-callback-from-arg (fastapi依赖注入常用) - "ARG001",# unused-function-argument (接口方法参数多,框架注入) - "ARG002",# unused-method-argument - "RET501",# do-not-use-return-None - "RET502",# do-not-implicitly-return-None - "SIM108",# use-ternary-operator (可读性考虑) ] [tool.ruff.lint.per-file-ignores] -"tests/*" = ["B011", "S101"] +"tests/*" = ["B011"] "apps/*/migrations/*" = ["ALL"] "alembic/*" = ["ALL"]