Skip to content

fix(capability-hosting): 拆分装配方法降低认知复杂度 - #976

Merged
AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-12781-20261102T2300
Nov 3, 2026
Merged

AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-12781-20261102T2300

Conversation

@AlianBlank

@AlianBlank AlianBlank commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes GFX-1206
Closes #967

Summary by CodeRabbit

  • 重构
    • 调整模块收集与启用状态检查的处理方式;模块重复标识仍会报错,启用规则及依赖检查时机保持不变。

Build 认知复杂度 17 超过 Sonar S3776 阈值 15,把同 Id 查重
循环拆为私有 CollectModulesById、宿主豁免与过滤启用两循环
拆为私有 CollectEnabledModules,控制流逐条等价,公共 API
零变化。

Linear: GFX-1206
@linear-code

linear-code Bot commented Nov 2, 2026

Copy link
Copy Markdown

GFX-1206

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8a1c7691-0716-4255-b396-a79e54921e03
Commits

Reviewing files that changed from the base of the PR and between 17b8abb and 1ab6122.

Files selected for processing: 1
  • Capability/GameFrameX.Capability.Hosting.Core/CapabilityHostBuilder.cs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

CapabilityHostBuilder.Build 将模块 Id 查重和启用模块筛选提取到两个私有辅助方法。重复 Id 异常、宿主模块启用规则及依赖检查顺序保持不变。

Changes: Capability 模块收集

Layer / File(s) Summary
模块收集与 Build 接入
Capability/GameFrameX.Capability.Hosting.Core/CapabilityHostBuilder.cs
新增 CollectModulesById 和 CollectEnabledModules。Build 调用这两个方法,并继续使用收集结果执行依赖检查。

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

Merge Risk: Minimal · up to 1ab61

No material behavior change or actionable regression was found in this refactoring.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive 直接关联问题 #967 要求修复 CapabilityHostBuilder.Build 的 S3776 认知复杂度问题,并验证 Sonar 不再报告 AaGbDSatSfXs_0aOrNb4。本次差异将重复 ID 检查和启用模块收集提取到两个私有方法,且未修改公共 API。代码差异支持控制流拆分,但当前证据未包含质量工作流结果,也未证明 Sonar 已不再报告该键。因此无法确认全部验收条… 提供本次提交对应的仓库质量工作流结果,并提供 Sonar 对 AaGbDSatSfXs_0aOrNb4 不再报告的验证证据。
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed 标题准确描述了主要变更:拆分装配方法以降低认知复杂度。标题具体、简洁,并与变更内容一致。
Out of Scope Changes check Passed 变更仅限于 Capability/GameFrameX.Capability.Hosting.Core/CapabilityHostBuilder.cs。新增的私有辅助方法直接服务于 #967 的复杂度降低目标,且公共 API 未变更。未发现与该目标无关的功能或文件变更。
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 1 files.

Full details: Linked Issues check

Explanation

直接关联问题 #967 要求修复 CapabilityHostBuilder.Build 的 S3776 认知复杂度问题,并验证 Sonar 不再报告 AaGbDSatSfXs_0aOrNb4。本次差异将重复 ID 检查和启用模块收集提取到两个私有方法,且未修改公共 API。代码差异支持控制流拆分,但当前证据未包含质量工作流结果,也未证明 Sonar 已不再报告该键。因此无法确认全部验收条件已完成。

Resolution

提供本次提交对应的仓库质量工作流结果,并提供 Sonar 对 AaGbDSatSfXs_0aOrNb4 不再报告的验证证据。

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@AlianBlank
AlianBlank merged commit 09179be into main Nov 3, 2026
4 checks passed
@AlianBlank
AlianBlank deleted the feature/auto-server-source-worker-run-12781-20261102T2300 branch November 3, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

P1 [Sonar] Fix Capability/GameFrameX.Capability.Hosting.Core/CapabilityHostBuilder.cs (1 issue)

1 participant