Code Quality红灯:ruff B017*8 + E721*1 + F541*1 业务测试代码问题 #839

Closed
opened 2026-07-24 20:17:04 +08:00 by xiaoxia · 1 comment
Owner

当前状态(2026-07-25更新)

Code Quality仍有10个ruff错误(--statistics模式,仅按类型汇总):

类型 数量 说明
B017 (assert-raises-exception) 8 pytest.raises(Exception) 应改为具体异常类型
E721 (type-comparison) 1 用type() == 判断类型,应改用isinstance()
F541 (f-string-missing-placeholders) 1 f-string里没有占位符,可自动修复

已修复的部分

  • 状态机相关测试文件的B017:test_generation_task.py等3个文件已改用 pytest.raises(ValueError, match=...)
  • test_jwt_handler.py:4个B017仍未修复

待确认

剩余4个B017 + E721 + F541 具体在哪些文件,因ruff用--statistics只输出汇总不输出文件名,需本地跑 ruff check apps packages tests 确认。

标签

  • P1
  • bug
## 当前状态(2026-07-25更新) Code Quality仍有10个ruff错误(--statistics模式,仅按类型汇总): | 类型 | 数量 | 说明 | |------|------|------| | B017 (assert-raises-exception) | 8 | pytest.raises(Exception) 应改为具体异常类型 | | E721 (type-comparison) | 1 | 用type() == 判断类型,应改用isinstance() | | F541 (f-string-missing-placeholders) | 1 | f-string里没有占位符,可自动修复 | ## 已修复的部分 - ✅ 状态机相关测试文件的B017:test_generation_task.py等3个文件已改用 `pytest.raises(ValueError, match=...)` - ❌ test_jwt_handler.py:4个B017仍未修复 ## 待确认 剩余4个B017 + E721 + F541 具体在哪些文件,因ruff用--statistics只输出汇总不输出文件名,需本地跑 `ruff check apps packages tests` 确认。 ## 标签 - P1 - bug
xiaoxia added the bugP1 labels 2026-07-24 20:17:04 +08:00
xiaoxia changed title from Code Quality红灯:ruff B017*4 + E721*1 业务测试代码问题 to Code Quality红灯:ruff B017*8 + E721*1 + F541*1 业务测试代码问题 2026-07-25 10:44:50 +08:00
Author
Owner

【CI巡检更新 2026-07-25】

当前Code Quality红灯:10个错误(B0178 + E7211 + F541*1)

部分已修复(状态机测试文件的B017已清掉),但test_jwt_handler.py的4个B017还在,整体数量没降。

建议后端优先处理:

  1. test_jwt_handler.py的4个B017 — 小改动,收益明确
  2. F541 — 可--fix自动修,1分钟搞定
  3. 剩余4个B017 + E721 — 需先定位文件再修
【CI巡检更新 2026-07-25】 当前Code Quality红灯:10个错误(B017*8 + E721*1 + F541*1) 部分已修复(状态机测试文件的B017已清掉),但test_jwt_handler.py的4个B017还在,整体数量没降。 建议后端优先处理: 1. test_jwt_handler.py的4个B017 — 小改动,收益明确 2. F541 — 可--fix自动修,1分钟搞定 3. 剩余4个B017 + E721 — 需先定位文件再修
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: xiaoxia/xiaoxia-saas#839