Repository navigation
chore: 引入 Ruff 静态检查与测试覆盖率门槛 - #5
Merged
Merged
Conversation
在 pyproject.toml 增加 [tool.ruff] 基线(pyflakes + isort + 核心 pycodestyle + bugbear,E501/B008 暂豁免)与 [tool.coverage] 配置,并把 ruff 加入 dev extra: 项目 CI 用 uv,dev 依赖必须同步进 uv.lock。 按规则修复存量问题:导入排序、未使用导入、歧义变量名 l、except 中 raise 补 from。未启用 ruff format,避免全仓库格式化的大 diff(可另议)。 验证:uv lock --check 通过;ruff check 全绿;pytest 205 passed,覆盖率 84.20%。
在 .github/workflows/ci.yml 的 test job 中新增 ruff 步骤,并给 pytest 加 --cov --cov-fail-under=80。沿用上游 uv run --locked 写法,不新增工作流文件, 避免与现有 ci.yml 冲突。
Owner
|
感谢你这次的完善!Ruff 静态检查和覆盖率门槛能让后续迭代更稳,也很好地接入了现有 CI。我已检查,改动没有发现问题,感谢贡献。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
项目已有 CI(
uv lock --check+ 全量测试 + Docker 构建),建议补充静态检查与测试覆盖率门槛。改动
pyproject.toml:新增[tool.ruff]基线(pyflakes + isort + 核心 pycodestyle + bugbear,豁免 E501/B008)与[tool.coverage]配置;ruff加入devextra。l、except中raise补from。.github/workflows/ci.yml:test job 增加uv run --locked ruff check .,pytest 增加--cov --cov-fail-under=80。uv.lock。说明
ruff format,避免全仓库格式化的大 diff(可后续另议)。验证
本地按 CI 同款命令:
uv lock --check通过、ruff check .全绿、uv run --locked pytest -q --cov --cov-fail-under=80→ 205 passed,84.20%。