ci: 引入 Ruff Lint/Format 与 pytest-cov,建立 CI/CD 质量保障流水线#96
Merged
Conversation
- 新增 ci.yml: Lint(Ruff) / Format(Ruff) / Test(pytest) 三 Job 并行执行 - 新增 coverage.yml: 覆盖率报告生成(HTML/XML/Summary),初始基线 85% - 配置 [tool.ruff]: F/E/W/I/UP 规则集,target-version=py312 - 配置 [tool.pytest.ini_options]: asyncio_mode=auto,统一测试参数 - 扩展 dev 依赖: ruff>=0.9.0, pytest-cov>=6.0 - 新增 .python-version 锁定 uv 目标版本为 3.12 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 91 个源码文件 + 25 个测试文件通过 Ruff format 统一格式化 - 导入排序优化(isort 规则:标准库 → 第三方 → 第一方 → 相对导入) - 行宽统一为 88 字符,长表达式自动折行 - 字符串引号统一为双引号,缩进风格为空格 - 同步修复 Ruff Lint 检出的安全自动修复项: · 移除未使用导入(F401) · 现代化 import 路径(UP035: collections.abc.Callable) · StrEnum 迁移(UP042: str+Enum → StrEnum) · f-string 去冗余前缀(F541) · 内联条件返回(SIM103) 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 47 个测试文件通过 Ruff format 统一格式化 - 导入排序优化、行宽/引号/缩进风格与源码保持一致 - 移除未使用导入(F401: aiosqlite 提升至模块顶层) 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
- 新增 .coverage、htmlcov/、coverage.xml、junit.xml 至忽略规则 - 避免本地测试产物误入版本库 🤖 Generated with [Claude Code](https://github.com/claude), [CodeX](https://openai.com), [Gemini](https://github.com/apps/gemini-code-assist) Co-Authored-By: Aurelius Huang<threefish.ai@gmail.com>
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.
概述
为 coding-proxy 项目引入业界标准的 CI/CD 自动化质量保障流水线,填补项目在代码质量自动化检查方面的空白。
此前项目仅有
release.yml(PyPI 发布)和promote.yml(预发布提升)两个工作流,缺失 Lint、Format、测试执行、覆盖率报告等关键质量门禁,代码质量完全依赖人工审查。变更内容
🆕 新增文件
.github/workflows/ci.yml.github/workflows/coverage.yml.python-version🔧 配置变更
pyproject.toml新增:[tool.ruff]— Ruff Linter & Formatter 配置(F/E/W/I/UP 规则集)[tool.pytest.ini_options]— pytest 统一配置(asyncio_mode=auto)ruff>=0.9.0、pytest-cov>=6.0.gitignore新增:.coverage、htmlcov/、coverage.xml、junit.xml🎨 代码格式化
架构设计
验证结果
All checks passed!116 files already formatted工具选型依据
影响范围
release.yml和promote.yml(Release 流程完全独立)v*) 会自动触发 CI,确保 release 代码同样经过质量检查