Conversation
📝 WalkthroughWalkthrough首页推荐接口改为返回推荐分类列表,并新增按分类分页获取内容的方法;API 客户端根据分类类型请求不同数据源,解析器同步支持分类与分页响应,HTML 客户端保留不支持状态。 Changes首页推荐接口
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant JmClient
participant JmApiClient
participant ApiParser
JmClient->>JmApiClient: getPromote()
JmApiClient->>ApiParser: parsePromote(response)
ApiParser-->>JmApiClient: List<JmPromoteCategory>
JmClient->>JmApiClient: getPromoteList(category, page)
JmApiClient->>ApiParser: parsePromoteList(response, page)
ApiParser-->>JmApiClient: JmSearchPage
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/parser/ApiParser.java (1)
546-548: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win异常信息文案未同步更新
方法已从
parseLatestOrPromoteList重命名/收窄为仅处理 latest 的parseLatestList,但捕获异常时的提示信息仍写作"Failed to parse latest/promote list API JSON",与新语义不符,容易在排查问题时产生误导。✏️ 建议的修复
} catch (Exception e) { - throw new ParseResponseException("Failed to parse latest/promote list API JSON", e); + throw new ParseResponseException("Failed to parse latest list API JSON", e); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/parser/ApiParser.java` around lines 546 - 548, 更新 ApiParser 中 parseLatestList 的异常提示文案,将 “latest/promote list” 改为仅描述 latest list,保持异常类型、原因链和其他错误处理逻辑不变。
🧹 Nitpick comments (2)
jmcomic-api/src/main/java/io/github/jukomu/jmcomic/api/client/JmClient.java (1)
317-324: 📐 Maintainability & Code Quality | 🔵 Trivial建议补充
getPromoteList的异常说明从
JmApiClient的实现看,当category.getType()为未知类型,或category_id类型的slug无法映射到已知分类时,会抛出UnsupportedOperationException。接口 Javadoc 目前未提及这一行为,建议补充@throws说明,方便调用方在不查看具体实现的情况下了解该方法的边界情况。📝 建议的文档补充
/** * 获取首页推荐栏分类详情(分页) * * `@param` category 推荐栏分类 * `@param` page 页码(从1开始) * `@return` 分页结果 + * `@throws` UnsupportedOperationException 若分类类型不受支持,或分类的 slug 无法解析 */ JmSearchPage getPromoteList(JmPromoteCategory category, int page);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@jmcomic-api/src/main/java/io/github/jukomu/jmcomic/api/client/JmClient.java` around lines 317 - 324, Update the Javadoc for JmClient.getPromoteList to add an `@throws` UnsupportedOperationException entry describing that it is raised when the category type is unknown or a category_id slug cannot be mapped to a supported category.jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/client/impl/JmApiClient.java (1)
730-771: 📐 Maintainability & Code Quality | 🔵 Trivial建议用枚举/常量替代裸字符串分支
switch直接匹配"promote"、"category_id"、"not_in_category_id"字符串字面量。这类魔法字符串一旦与解析层(ApiParser.parsePromote中type字段的取值)出现拼写不一致或后续新增类型时,只能在运行期落入default抛出UnsupportedOperationException,而非编译期发现。建议为这些取值定义常量或枚举,集中管理并配合解析层复用。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/client/impl/JmApiClient.java` around lines 730 - 771, 将 getPromoteList 中基于字符串字面量的分支改为使用统一定义的常量或枚举,并让 ApiParser.parsePromote 复用同一组类型值。集中管理 promote、category_id 和 not_in_category_id,更新 switch 的匹配逻辑,保留现有各分支行为及未知类型抛出 UnsupportedOperationException 的处理。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/parser/ApiParser.java`:
- Around line 546-548: 更新 ApiParser 中 parseLatestList 的异常提示文案,将 “latest/promote
list” 改为仅描述 latest list,保持异常类型、原因链和其他错误处理逻辑不变。
---
Nitpick comments:
In `@jmcomic-api/src/main/java/io/github/jukomu/jmcomic/api/client/JmClient.java`:
- Around line 317-324: Update the Javadoc for JmClient.getPromoteList to add an
`@throws` UnsupportedOperationException entry describing that it is raised when
the category type is unknown or a category_id slug cannot be mapped to a
supported category.
In
`@jmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/client/impl/JmApiClient.java`:
- Around line 730-771: 将 getPromoteList 中基于字符串字面量的分支改为使用统一定义的常量或枚举,并让
ApiParser.parsePromote 复用同一组类型值。集中管理 promote、category_id 和 not_in_category_id,更新
switch 的匹配逻辑,保留现有各分支行为及未知类型抛出 UnsupportedOperationException 的处理。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a2150ccb-ec08-4fc8-a153-436a3bc98a1a
📒 Files selected for processing (4)
jmcomic-api/src/main/java/io/github/jukomu/jmcomic/api/client/JmClient.javajmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/client/impl/JmApiClient.javajmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/client/impl/JmHtmlClient.javajmcomic-core/src/main/java/io/github/jukomu/jmcomic/core/parser/ApiParser.java
There was a problem hiding this comment.
🧹 Nitpick comments (1)
jmcomic-api/src/main/java/io/github/jukomu/jmcomic/api/model/JmPromoteCategory.java (1)
34-36: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win避免使用原始
Map类型。
List<Map>丢失键和值的类型信息,会削弱编译期检查并引入 unchecked 操作。至少改为List<Map<String, Object>>;如果不同type的内容结构稳定,建议进一步定义对应的 DTO,并同步确认解析器的反序列化类型。建议修改
- List<Map> content + List<Map<String, Object>> content ... - public List<Map> getContent() { + public List<Map<String, Object>> getContent() {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@jmcomic-api/src/main/java/io/github/jukomu/jmcomic/api/model/JmPromoteCategory.java` around lines 34 - 36, Update the content field in JmPromoteCategory from raw List<Map> to a parameterized map type, at minimum List<Map<String, Object>>, to preserve key/value type information and eliminate unchecked usage. If the content structures for each type are stable, use appropriate DTOs and update the parser’s deserialization types accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@jmcomic-api/src/main/java/io/github/jukomu/jmcomic/api/model/JmPromoteCategory.java`:
- Around line 34-36: Update the content field in JmPromoteCategory from raw
List<Map> to a parameterized map type, at minimum List<Map<String, Object>>, to
preserve key/value type information and eliminate unchecked usage. If the
content structures for each type are stable, use appropriate DTOs and update the
parser’s deserialization types accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5684ff86-dfd8-4ae4-b978-7e419f898830
📒 Files selected for processing (1)
jmcomic-api/src/main/java/io/github/jukomu/jmcomic/api/model/JmPromoteCategory.java
Summary by CodeRabbit