Skip to content

fix(network): EndpointParser.ParseAuthority 拆为单一职责派发以消除 Sonar S3776 - #496

Merged
AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-7777-20260922T0720
Sep 22, 2026
Merged

AlianBlank merged 1 commit into
mainfrom
feature/auto-server-source-worker-run-7777-20260922T0720

Conversation

@AlianBlank

@AlianBlank AlianBlank commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Linear: GFX-860

Summary by CodeRabbit

  • 重构
    • 优化网络端点权限解析的内部代码结构。
    • 保持方括号 IPv6 地址、域名、容器名、服务名及 IPv4 地址的解析行为不变。

把 ParseAuthority(Cognitive Complexity 17)按方括号 IPv6 vs 末冒号 host:port
两路径拆为 ParseBracketedIpv6Authority + ParseHostPortAuthority 两个 private 辅助
方法;主方法仅保留空 authority 拒收 + 按 authority[0] 派发。对外签名 / 行为 /
异常消息文本完全等价;端口解析复用既有 ParsePort,DNS 校验复用既有
ValidateDnsHost。EndpointParserTests 38/38 通过。

Linear: GFX-860
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: bb7c1a01-0a7b-4c5e-8613-7580f1247199

📥 Commits

Reviewing files that changed from the base of the PR and between bdda090 and 7a3cfdd.

📒 Files selected for processing (1)
  • GameFrameX.NetWork.RemoteMessaging/Discovery/EndpointParser.cs

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


📝 Walkthrough

Walkthrough

ParseAuthority 现在根据 authority 是否以 [ 开头选择不同的私有解析方法。方括号 IPv6、主机端口、域名和 IPv4 的既有校验逻辑保持不变。

Changes

Authority 解析

Layer / File(s) Summary
拆分 authority 解析方法
GameFrameX.NetWork.RemoteMessaging/Discovery/EndpointParser.cs
ParseAuthority 分派到 ParseBracketedIpv6AuthorityParseHostPortAuthority。两个方法分别承载方括号 IPv6 和非方括号 authority 的原有校验与结果构造逻辑。

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Refactor

Merge Risk: ⚪ Minimal · up to 7a3cf

Authority parsing is split into focused helpers while retaining existing validation and exception behavior; the change is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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. Analyzed 3 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了主要变更:拆分 EndpointParser.ParseAuthority 的解析派发逻辑,以解决 Sonar S3776 认知复杂度问题。
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

@AlianBlank
AlianBlank merged commit e569bdd into main Sep 22, 2026
3 checks passed
@AlianBlank
AlianBlank deleted the feature/auto-server-source-worker-run-7777-20260922T0720 branch September 22, 2026 07:37
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.

1 participant