Skip to content

[GFX-203] feature/GFX-203 - #109

Open
AlianBlank wants to merge 1 commit into
mainfrom
feature/GFX-203
Open

[GFX-203] feature/GFX-203#109
AlianBlank wants to merge 1 commit into
mainfrom
feature/GFX-203

Conversation

@AlianBlank

@AlianBlank AlianBlank commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Linear: GFX-203

Summary by CodeRabbit

  • Bug 修复
    • 调整哈希算法对象不支持的哈希代码调用行为,改为抛出更准确的不可达异常类型。

把 public override int GetHashCode() 体内的 'throw new NotSupportedException();' 改为 'throw new UnreachableException();',并在顶部 using 区按字母序新增 'using System.Diagnostics;'。

[Obsolete("...", true)] 让任何调用方在编译期被 CS0619 拒绝,方法体 throw 实际不可达;改用 System.Diagnostics.UnreachableException(.NET 5+,构造函数标注 [DoesNotReturn]),Roslyn / Sonar 会识别这条 throw 为不可达,S3877 告警消除。

公共形态(method / [Obsolete(..., true)] / [EditorBrowsable] / #pragma CS0809 / XML 文档)零改动。

Linear: GFX-203
@linear-code

linear-code Bot commented Jul 29, 2026

Copy link
Copy Markdown

GFX-203

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Crc64哈希实现引入 System.Diagnostics,并将 NonCryptographicHashAlgorithm.GetHashCode() 的异常类型从 NotSupportedException 改为 UnreachableException

Changes

Crc64哈希异常更新

Layer / File(s) Summary
GetHashCode异常类型更新
GameFrameX.Foundation.Hash/CrcHelper.Crc64.cs
新增 System.Diagnostics 引用,并将 GetHashCode() 始终抛出的异常替换为 UnreachableException

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

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive 标题仅包含工单号和分支名,未说明实际变更内容,过于泛化。 请改为能概括核心改动的标题,例如“将 CrcHelper.Crc64.GetHashCode 的异常改为 UnreachableException”。
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/GFX-203

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

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@GameFrameX.Foundation.Hash/CrcHelper.Crc64.cs`:
- Line 679: 同步更新相关方法的 XML 文档,将异常声明从 NotSupportedException 改为实际抛出的
UnreachableException,并确保 returns 文档与该方法当前行为保持一致。
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 04f45774-35d9-450e-9009-7743cdbdd8d6

📥 Commits

Reviewing files that changed from the base of the PR and between 344f6d8 and c98abd1.

📒 Files selected for processing (1)
  • GameFrameX.Foundation.Hash/CrcHelper.Crc64.cs

#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
{
throw new NotSupportedException();
throw new UnreachableException();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

同步 XML 文档中的异常类型。

当前实现抛出 UnreachableException,但上方 Line 671-672 仍声明会抛出 NotSupportedException。请同步更新 <returns><exception cref> 文档,避免生成的 API 文档与实际行为不一致。

建议修改
-        /// <returns>此方法将始终抛出 <see cref="NotSupportedException"/> / This method will always throw a <see cref="NotSupportedException" /></returns>
-        /// <exception cref="NotSupportedException">在所有情况下抛出 / In all cases</exception>
+        /// <returns>此方法将始终抛出 <see cref="UnreachableException"/> / This method will always throw a <see cref="UnreachableException" /></returns>
+        /// <exception cref="UnreachableException">在所有情况下抛出 / In all cases</exception>
🤖 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 `@GameFrameX.Foundation.Hash/CrcHelper.Crc64.cs` at line 679, 同步更新相关方法的 XML
文档,将异常声明从 NotSupportedException 改为实际抛出的 UnreachableException,并确保 returns
文档与该方法当前行为保持一致。

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