Skip to content

refactor(godot): 将异步方法重命名为遵循Async约定的方法名#71

Merged
GeWuYou merged 1 commit into
mainfrom
refactor/godot-async-naming-convention
Mar 5, 2026
Merged

refactor(godot): 将异步方法重命名为遵循Async约定的方法名#71
GeWuYou merged 1 commit into
mainfrom
refactor/godot-async-naming-convention

Conversation

@GeWuYou

@GeWuYou GeWuYou commented Mar 5, 2026

Copy link
Copy Markdown
Owner
  • 将WaitUntilReady方法重命名为WaitUntilReadyAsync
  • 将AddChildX方法重命名为AddChildXAsync
  • 更新所有相关文档中的方法调用引用
  • 修改架构层锚点等待方法调用为异步版本
  • 更新测试代码中的方法调用以匹配新的方法名
  • 调整函数式异步扩展方法命名约定
  • 统一所有异步扩展方法的命名规范

由 Sourcery 提供的总结

标准化异步扩展方法的命名,统一使用 Async 后缀,并在核心代码、Godot 集成以及文档中更新所有用法。

增强内容:

  • 将核心异步工具方法(WithTimeoutWithRetryWithFallbackWaitUntilReadyAddChildX)重命名为带有 Async 后缀的变体,以保持一致的命名规范。
  • 调整 Godot 架构锚点安装逻辑,使用 await 调用新的带有 Async 后缀的就绪方法。

文档:

  • 更新中文 Godot 扩展和集成文档,使其引用新的带有 Async 后缀的方法名和示例。

测试:

  • 更新异步扩展测试以使用带有 Async 后缀的方法名,从而与新的命名约定保持一致。
Original summary in English

Summary by Sourcery

Standardize async extension method naming to use the Async suffix and update usages across core, Godot integration, and docs.

Enhancements:

  • Rename core async utility methods (WithTimeout, WithRetry, WithFallback, WaitUntilReady, AddChildX) to Async-suffixed variants for consistent naming conventions.
  • Adjust Godot architecture anchor installation to await the new Async-suffixed readiness method.

Documentation:

  • Update Chinese Godot extension and integration docs to reference the new Async-suffixed method names and examples.

Tests:

  • Update async extension tests to use Async-suffixed method names to align with the new naming convention.

- 将WaitUntilReady方法重命名为WaitUntilReadyAsync
- 将AddChildX方法重命名为AddChildXAsync
- 更新所有相关文档中的方法调用引用
- 修改架构层锚点等待方法调用为异步版本
- 更新测试代码中的方法调用以匹配新的方法名
- 调整函数式异步扩展方法命名约定
- 统一所有异步扩展方法的命名规范
@deepsource-io

deepsource-io Bot commented Mar 5, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 8db379c...1bad8f0 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
C# Mar 5, 2026 4:49a.m. Review ↗
Secrets Mar 5, 2026 4:49a.m. Review ↗

@sourcery-ai

sourcery-ai Bot commented Mar 5, 2026

Copy link
Copy Markdown

审阅者指南

重构与 Godot 相关的异步 API 和核心异步工具,使其一致地使用 *Async 后缀,并更新扩展方法、函数式异步辅助方法、测试、架构代码和文档以匹配新的命名约定。

AddChildXAsync 与 WaitUntilReadyAsync 交互的时序图

sequenceDiagram
    actor GameCode
    participant ParentNode as ParentNode
    participant ChildNode as ChildNode
    participant NodeExtensions as NodeExtensions

    GameCode->>NodeExtensions: AddChildXAsync(ParentNode, ChildNode)
    activate NodeExtensions
    NodeExtensions->>ParentNode: AddChild(ChildNode)
    NodeExtensions->>NodeExtensions: WaitUntilReadyAsync(ChildNode)
    activate ChildNode
    ChildNode->>ChildNode: IsInsideTree()
    alt not inside tree
        ChildNode->>ChildNode: ToSignal(ChildNode, Ready)
        ChildNode-->>NodeExtensions: Ready signal awaited
    else already inside tree
        ChildNode-->>NodeExtensions: return immediately
    end
    deactivate ChildNode
    NodeExtensions-->>GameCode: Task completed
    deactivate NodeExtensions
Loading

更新后的异步扩展 API 类图

classDiagram
    class AsyncExtensions {
        <<static>>
        +Task~T~ WithTimeoutAsync~T~(Func~CancellationToken, Task~T~~ taskFactory, TimeSpan timeout, CancellationToken cancellationToken)
        +Task WithTimeoutAsync(Func~CancellationToken, Task~ taskFactory, TimeSpan timeout, CancellationToken cancellationToken)
        +Task~T~ WithFallbackAsync~T~(Task~T~ task, Func~Exception, T~ fallback)
    }

    class AsyncFunctionalExtensions {
        <<static>>
        +Task~T~ WithRetryAsync~T~(Func~Task~T~~ taskFactory, int maxRetries, TimeSpan delay, Func~Exception, bool~ shouldRetry)
    }

    class NodeExtensions {
        <<static>>
        +void FreeX(Node node)
        +Task WaitUntilReadyAsync(Node node)
        +Node GetRootNodeX(Node node)
        +T GetOrCreateNode~T~(Node node, string path)
        +Task AddChildXAsync(Node parent, Node child)
    }

    class Node {
        +bool IsInsideTree()
        +Task ToSignal(object target, string signal)
        +void AddChild(Node child)
    }

    NodeExtensions ..> Node : extends
    AsyncFunctionalExtensions ..> AsyncExtensions : uses
Loading

文件级变更

Change Details Files
将核心异步工具方法重命名为使用 Async 后缀,并相应更新测试。
  • 将 AsyncExtensions.WithTimeout<T> 重命名为 WithTimeoutAsync<T>,将 AsyncExtensions.WithTimeout 重命名为 WithTimeoutAsync,保持行为不变
  • 将函数式异步扩展 WithRetry<T> 重命名为 WithRetryAsync<T>,并更新其 XML 文档示例
  • 将 Task<T>.WithFallback 重命名为 WithFallbackAsync,并调整示例用法
  • 更新所有 AsyncExtensionsTests 的使用,使其调用 WithTimeoutAsync、WithRetryAsync 和 WithFallbackAsync,同时保持测试语义和预期不变
GFramework.Core/extensions/AsyncExtensions.cs
GFramework.Core/functional/async/AsyncFunctionalExtensions.cs
GFramework.Core.Tests/extensions/AsyncExtensionsTests.cs
将 Godot 节点异步扩展方法与 Async 命名约定对齐,并在架构和文档中传播这些变更。
  • 将 NodeExtensions.WaitUntilReady(this Node) 重命名为 WaitUntilReadyAsync,并更新其内部使用点
  • 将 NodeExtensions.AddChildX(this Node, Node) 重命名为 AddChildXAsync,并更新为等待 WaitUntilReadyAsync
  • 更新 AbstractArchitecture.InstallGodotModule 以等待 _anchor.WaitUntilReadyAsync
  • 更新 Godot 文档和教程,使所有代码示例都使用 WaitUntilReadyAsync 和 AddChildXAsync
GFramework.Godot/extensions/NodeExtensions.cs
GFramework.Godot/architecture/AbstractArchitecture.cs
docs/zh-CN/godot/extensions.md
docs/zh-CN/godot/index.md
docs/zh-CN/tutorials/godot-integration.md

提示与命令

与 Sourcery 交互

  • 触发新审阅: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 在审阅评论下回复,要求 Sourcery 从该评论创建一个 issue。你也可以在审阅评论中回复 @sourcery-ai issue 来从该评论创建 issue。
  • 生成拉取请求标题: 在拉取请求标题中的任意位置写上 @sourcery-ai,即可随时生成标题。你也可以在拉取请求中评论 @sourcery-ai title 来(重新)生成标题。
  • 生成拉取请求摘要: 在拉取请求正文任意位置写上 @sourcery-ai summary,即可在对应位置生成 PR 摘要。你也可以在拉取请求中评论 @sourcery-ai summary 来(重新)生成摘要。
  • 生成审阅者指南: 在拉取请求中评论 @sourcery-ai guide,即可(重新)生成审阅者指南。
  • 解决所有 Sourcery 评论: 在拉取请求中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理了所有评论且不希望再看到它们,这会很有用。
  • 撤销所有 Sourcery 审阅: 在拉取请求中评论 @sourcery-ai dismiss,即可撤销所有已有的 Sourcery 审阅。特别适用于你想从头开始一次新的审阅时——别忘了评论 @sourcery-ai review 以触发新审阅!

自定义你的体验

访问你的 控制面板 以:

  • 启用或禁用审阅功能,例如 Sourcery 自动生成的拉取请求摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide

Refactors Godot-related async APIs and core async utilities to consistently use the *Async suffix, updating extension methods, functional async helpers, tests, architecture code, and documentation to match the new naming convention.

Sequence diagram for AddChildXAsync and WaitUntilReadyAsync interaction

sequenceDiagram
    actor GameCode
    participant ParentNode as ParentNode
    participant ChildNode as ChildNode
    participant NodeExtensions as NodeExtensions

    GameCode->>NodeExtensions: AddChildXAsync(ParentNode, ChildNode)
    activate NodeExtensions
    NodeExtensions->>ParentNode: AddChild(ChildNode)
    NodeExtensions->>NodeExtensions: WaitUntilReadyAsync(ChildNode)
    activate ChildNode
    ChildNode->>ChildNode: IsInsideTree()
    alt not inside tree
        ChildNode->>ChildNode: ToSignal(ChildNode, Ready)
        ChildNode-->>NodeExtensions: Ready signal awaited
    else already inside tree
        ChildNode-->>NodeExtensions: return immediately
    end
    deactivate ChildNode
    NodeExtensions-->>GameCode: Task completed
    deactivate NodeExtensions
Loading

Class diagram for updated async extension APIs

classDiagram
    class AsyncExtensions {
        <<static>>
        +Task~T~ WithTimeoutAsync~T~(Func~CancellationToken, Task~T~~ taskFactory, TimeSpan timeout, CancellationToken cancellationToken)
        +Task WithTimeoutAsync(Func~CancellationToken, Task~ taskFactory, TimeSpan timeout, CancellationToken cancellationToken)
        +Task~T~ WithFallbackAsync~T~(Task~T~ task, Func~Exception, T~ fallback)
    }

    class AsyncFunctionalExtensions {
        <<static>>
        +Task~T~ WithRetryAsync~T~(Func~Task~T~~ taskFactory, int maxRetries, TimeSpan delay, Func~Exception, bool~ shouldRetry)
    }

    class NodeExtensions {
        <<static>>
        +void FreeX(Node node)
        +Task WaitUntilReadyAsync(Node node)
        +Node GetRootNodeX(Node node)
        +T GetOrCreateNode~T~(Node node, string path)
        +Task AddChildXAsync(Node parent, Node child)
    }

    class Node {
        +bool IsInsideTree()
        +Task ToSignal(object target, string signal)
        +void AddChild(Node child)
    }

    NodeExtensions ..> Node : extends
    AsyncFunctionalExtensions ..> AsyncExtensions : uses
Loading

File-Level Changes

Change Details Files
Rename core async utility methods to use Async suffix and update tests accordingly.
  • Rename AsyncExtensions.WithTimeout to WithTimeoutAsync and AsyncExtensions.WithTimeout to WithTimeoutAsync, keeping behavior unchanged
  • Rename functional async extension WithRetry to WithRetryAsync and update its XML documentation examples
  • Rename Task.WithFallback to WithFallbackAsync and adjust example usages
  • Update all AsyncExtensionsTests usages to call WithTimeoutAsync, WithRetryAsync, and WithFallbackAsync, keeping test semantics and expectations the same
GFramework.Core/extensions/AsyncExtensions.cs
GFramework.Core/functional/async/AsyncFunctionalExtensions.cs
GFramework.Core.Tests/extensions/AsyncExtensionsTests.cs
Align Godot node async extension methods with Async naming convention and propagate changes through architecture and docs.
  • Rename NodeExtensions.WaitUntilReady(this Node) to WaitUntilReadyAsync and update its internal usage sites
  • Rename NodeExtensions.AddChildX(this Node, Node) to AddChildXAsync and update it to await WaitUntilReadyAsync
  • Update AbstractArchitecture.InstallGodotModule to await _anchor.WaitUntilReadyAsync
  • Update Godot docs and tutorials to use WaitUntilReadyAsync and AddChildXAsync in all code samples
GFramework.Godot/extensions/NodeExtensions.cs
GFramework.Godot/architecture/AbstractArchitecture.cs
docs/zh-CN/godot/extensions.md
docs/zh-CN/godot/index.md
docs/zh-CN/tutorials/godot-integration.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

嗨——我已经审查了你的修改,看起来非常不错!


Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续评审。
Original comment in English

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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