chore(types): gate parallel mypy cleanup batch

This commit is contained in:
jxxghp
2026-10-17 16:26:40 +08:00
parent 5a79600eb4
commit 3366713e60
3 changed files with 16 additions and 51 deletions

View File

@@ -108,7 +108,7 @@ ARCH-201 至 ARCH-204 均达到实现、验证、提交、推送和远端门禁
| Event Contract | 53 | 均已有 payload model,但当前全部是 diagnostic enforcement |
| Python 源码量 | 373,625 行 | 本次重新扫描物理行数,排除 `app/plugins/**`;74 个文件超过 1,000 行,12 个超过 2,000 行;源码尺寸仅作观察 |
| 长方法 | 309 个超过 80 行 | 本次 AST 扫描排除 `app/plugins/**`;61 个超过 150 行,17 个超过 250 行;新增函数仍受 C901/嵌套深度门禁约束 |
| 全量 mypy 历史债务 | 5,374 / 260 文件 | 本轮在消息、站点、诊断、备份、用户配置、订阅、AcoustID、TMDB、仪表板和命令生命周期边界补齐类型,历史债务再减少 53 项;TMDB v3 API 显式导出并保留集合 parts 的列表合同,逐文件逐错误码无增长;此前工作流筛选、动态插件路由和 stdio 流补齐边界类型,历史债务减少 3 项;Bitpt 与 CookieCloud 补齐边界类型,历史债务减少 16 项;知行站点解析器补齐数值属性与基类合同,历史债务减少 18 项;通知排版补齐 Slack 消息块类型,历史债务减少 2 项;工作流资源过滤改用领域对象调用过滤链,恢复的节点输出在消费前归一化,并收紧可空资源列表的类型低水位;消息媒体交互类型债务已清零,canonical Facade 与 endpoint 类型边界已补齐,低水位只允许继续下降;微信 ClawBot 入站 item_list 媒体解析改为按子项键名分派后,类型错误减少 4 项;站点解析器分享率改用浮点初值,类型错误减少 20 项;本次下载与文件安全修复再减少 3 项;Transmission 进度回退值归一化再减少 2 项;本批清理 Servarr、认证、存储、订阅策略和搜索/规则/通知 Schema 的 18 项类型错误,并修复系统配置中的 Python 2 异常语法;本批再清理订阅元数据、订阅写入、交互宿主、整理路径、删除统计和工作流动作的 14 项类型错误,逐文件逐错误码无增长;本批补齐 OCR 请求参数、工具 Schema 摘要和宿主模块配置快照的 5 项边界类型,逐文件逐错误码无增长;本批为 Rousi 用户消息分页解析补齐返回类型与数据结构兜底,减少 2 项类型错误;本批优先处理 TMDB v3 电影与电视剧对象模型,补齐 98 个同步/异步方法注解并减少 122 项历史类型错误;随后补齐剧集、季度、人物、搜索和趋势对象的 142 个方法注解,再减少 142 项类型错误;绿联 API 响应边界补齐具体泛型与运行时字典收窄,减少 31 项类型错误;运行时限流器补齐状态方法、装饰器边界和时间队列类型,减少 31 项类型错误;QQ Bot API 响应边界补齐具体泛型与 JSON 形状校验,减少 17 项类型错误;rTorrent 客户端清理 182 项错误,调用端同步明确字典合同,累计再减少 190 项错误 |
| 全量 mypy 历史债务 | 4,919 / 258 文件 | 本轮在消息、站点、诊断、备份、用户配置、订阅、AcoustID、TMDB、仪表板和命令生命周期边界补齐类型,历史债务再减少 53 项;TMDB v3 API 显式导出并保留集合 parts 的列表合同,逐文件逐错误码无增长;此前工作流筛选、动态插件路由和 stdio 流补齐边界类型,历史债务减少 3 项;Bitpt 与 CookieCloud 补齐边界类型,历史债务减少 16 项;知行站点解析器补齐数值属性与基类合同,历史债务减少 18 项;通知排版补齐 Slack 消息块类型,历史债务减少 2 项;工作流资源过滤改用领域对象调用过滤链,恢复的节点输出在消费前归一化,并收紧可空资源列表的类型低水位;消息媒体交互类型债务已清零,canonical Facade 与 endpoint 类型边界已补齐,低水位只允许继续下降;微信 ClawBot 入站 item_list 媒体解析改为按子项键名分派后,类型错误减少 4 项;站点解析器分享率改用浮点初值,类型错误减少 20 项;本次下载与文件安全修复再减少 3 项;Transmission 进度回退值归一化再减少 2 项;本批清理 Servarr、认证、存储、订阅策略和搜索/规则/通知 Schema 的 18 项类型错误,并修复系统配置中的 Python 2 异常语法;本批再清理订阅元数据、订阅写入、交互宿主、整理路径、删除统计和工作流动作的 14 项类型错误,逐文件逐错误码无增长;本批补齐 OCR 请求参数、工具 Schema 摘要和宿主模块配置快照的 5 项边界类型,逐文件逐错误码无增长;本批为 Rousi 用户消息分页解析补齐返回类型与数据结构兜底,减少 2 项类型错误;本批优先处理 TMDB v3 电影与电视剧对象模型,补齐 98 个同步/异步方法注解并减少 122 项历史类型错误;随后补齐剧集、季度、人物、搜索和趋势对象的 142 个方法注解,再减少 142 项类型错误;绿联 API 响应边界补齐具体泛型与运行时字典收窄,减少 31 项类型错误;运行时限流器补齐状态方法、装饰器边界和时间队列类型,减少 31 项类型错误;QQ Bot API 响应边界补齐具体泛型与 JSON 形状校验,减少 17 项类型错误;rTorrent 客户端清理 182 项错误,调用端同步明确字典合同,累计再减少 190 项错误;豆瓣 API、中心服务接口及订阅消费端补齐返回边界和参数收窄,结合 Context 方法签名与缓存代理类型清理,累计再减少 455 项错误;缓存同步/异步继承冲突保留为设计债务,未纳入严格门禁 |
| Ruff 历史诊断 | 73 | 低水位门禁通过,但规则集只覆盖 `E4/E7/E9/F/I` |
| 覆盖率逐文件低水位 | 全 app(排除 app/plugins)当前聚合 77.68% | 存量文件低水位只增不减,新文件至少 80% |

View File

@@ -74,6 +74,7 @@ files =
app/adapters/external/github.py,
app/adapters/external/location.py,
app/adapters/external/market.py,
app/adapters/external/server.py,
app/adapters/external/plugin/__init__.py,
app/adapters/external/plugin/client.py,
app/adapters/external/wechat.py,
@@ -617,6 +618,7 @@ files =
app/modules/bangumi/bangumi.py,
app/modules/dingtalk/dingtalk.py,
app/modules/douban/scraper.py,
app/modules/douban/apiv2.py,
app/modules/feishu/__init__.py,
app/modules/feishu/openapi.py,
app/modules/filemanager/__init__.py,

View File

@@ -16,15 +16,6 @@
"str-bytes-safe": 2,
"union-attr": 14
},
"app/adapters/external/server.py": {
"arg-type": 5,
"assignment": 1,
"misc": 9,
"no-any-return": 19,
"no-untyped-call": 6,
"no-untyped-def": 59,
"type-arg": 40
},
"app/adapters/network/browser.py": {
"arg-type": 4,
"no-any-return": 2,
@@ -285,12 +276,10 @@
"redundant-cast": 2
},
"app/api/endpoints/anilist.py": {
"attr-defined": 1,
"no-untyped-call": 2
"attr-defined": 1
},
"app/api/endpoints/bangumi.py": {
"attr-defined": 1,
"no-untyped-call": 3,
"operator": 12
},
"app/api/endpoints/dashboard.py": {
@@ -302,12 +291,10 @@
"arg-type": 20,
"attr-defined": 1,
"no-redef": 1,
"no-untyped-call": 5,
"operator": 2
},
"app/api/endpoints/douban.py": {
"attr-defined": 1,
"no-untyped-call": 2
"attr-defined": 1
},
"app/api/endpoints/download.py": {
"arg-type": 6,
@@ -325,7 +312,7 @@
"arg-type": 2,
"assignment": 7,
"attr-defined": 3,
"no-untyped-call": 5,
"no-untyped-call": 2,
"no-untyped-def": 1
},
"app/api/endpoints/mediaserver.py": {
@@ -392,23 +379,21 @@
"type-arg": 5
},
"app/api/endpoints/subscribe.py": {
"arg-type": 11,
"assignment": 3,
"arg-type": 5,
"assignment": 1,
"attr-defined": 2,
"no-any-return": 1,
"no-untyped-call": 1,
"no-untyped-def": 1,
"type-arg": 2
},
"app/api/endpoints/system.py": {
"arg-type": 1,
"no-untyped-call": 5,
"no-untyped-call": 4,
"no-untyped-def": 24,
"type-arg": 6
},
"app/api/endpoints/tmdb.py": {
"attr-defined": 1,
"no-untyped-call": 2,
"operator": 4,
"type-arg": 3
},
@@ -522,7 +507,6 @@
"arg-type": 1,
"attr-defined": 26,
"no-any-return": 6,
"no-untyped-call": 1,
"no-untyped-def": 2,
"type-arg": 4
},
@@ -603,7 +587,6 @@
"app/chain/subscribe/completion.py": {
"arg-type": 2,
"assignment": 1,
"no-untyped-call": 1,
"operator": 3,
"type-var": 1,
"union-attr": 8,
@@ -624,7 +607,6 @@
"union-attr": 7
},
"app/chain/subscribe/notify.py": {
"no-untyped-call": 2,
"union-attr": 6
},
"app/chain/subscribe/query.py": {
@@ -747,11 +729,10 @@
},
"app/domain/context.py": {
"assignment": 86,
"no-any-return": 1,
"no-untyped-call": 4,
"no-untyped-def": 23,
"no-untyped-call": 2,
"no-untyped-def": 4,
"operator": 1,
"type-arg": 36
"type-arg": 24
},
"app/domain/meta/metaanime.py": {
"arg-type": 1,
@@ -856,23 +837,12 @@
"union-attr": 18
},
"app/modules/douban/__init__.py": {
"arg-type": 1,
"assignment": 27,
"assignment": 24,
"empty-body": 1,
"no-any-return": 1,
"no-untyped-call": 3,
"no-untyped-def": 7,
"return-value": 2,
"type-arg": 13,
"union-attr": 2
},
"app/modules/douban/apiv2.py": {
"misc": 6,
"no-any-return": 4,
"no-untyped-def": 132,
"return-value": 1,
"type-arg": 22,
"var-annotated": 1
"type-arg": 8
},
"app/modules/emby/__init__.py": {
"arg-type": 3,
@@ -1167,7 +1137,6 @@
},
"app/modules/musicbrainz/cache.py": {
"no-any-return": 1,
"no-untyped-call": 2,
"no-untyped-def": 3,
"type-arg": 3,
"union-attr": 1
@@ -1292,7 +1261,6 @@
},
"app/modules/themoviedb/cache.py": {
"no-any-return": 3,
"no-untyped-call": 2,
"no-untyped-def": 4,
"type-arg": 5,
"union-attr": 5
@@ -1461,15 +1429,10 @@
"var-annotated": 1
},
"app/runtime/cache.py": {
"arg-type": 8,
"assignment": 1,
"attr-defined": 12,
"misc": 2,
"no-any-return": 1,
"no-untyped-def": 54,
"override": 17,
"type-arg": 3,
"unused-coroutine": 3
"no-untyped-def": 4,
"override": 17
},
"app/runtime/compat/imports.py": {
"assignment": 1,