chore: add ruff checks

This commit is contained in:
chengma
2026-07-07 15:11:40 +08:00
parent 862f791fde
commit 6e2347e1c8
13 changed files with 81 additions and 16 deletions
+3
View File
@@ -53,6 +53,7 @@
完成前至少检查:
- [ ] `python -m compileall app main.py` 通过(T-000 前仅文档改动不要求)。
- [ ] `python -m ruff check app tests main.py` 通过(T-525 后;当前只开启安全类规则)。
- [ ] T-006 完成后,纯逻辑改动有对应 `unittest`,至少覆盖正常路径和一个失败路径。
- [ ] 涉及 CDP 的改动,在测试商品(ITEM_ID 51100639510)上实跑验证。
- [ ] 涉及更新封面删除线上第一张图时,必须先验证该任务 `old_cover_path` 本地备份存在;备份缺失不得删除线上图片。
@@ -64,6 +65,7 @@
- [ ] 回复里如实说明跑了什么命令、结果如何。
```bash
python -m ruff check app tests main.py
python -m compileall app main.py
python -m unittest discover -s tests # T-006 完成且 tests/ 存在后
python prototypes/demo.py # 单账号闭环验证(不提交)
@@ -72,6 +74,7 @@ python prototypes/demo.py # 单账号闭环验证(不提交)
测试命令时机:
- T-006 前:`tests/` 尚未建立时,只要求运行与当前任务匹配的可用验证;不要因为 `python -m unittest discover -s tests` 缺目录而判失败。
- T-525 后:`python -m ruff check app tests main.py` 成为代码改动的必跑项;当前只启用安全类 lint,不要求全仓格式化。
- T-006 后:`python -m unittest discover -s tests` 成为纯逻辑改动的必跑项;新增/修改 appconfig、db、excel、prompts、config、chrome 纯逻辑时同步补测。
## 7. 绝不