Skip to content

docs(diagnostic): 更新诊断消息描述文本#124

Merged
GeWuYou merged 2 commits into
mainfrom
feat/diagnostic-message-punctuation
Mar 21, 2026
Merged

docs(diagnostic): 更新诊断消息描述文本#124
GeWuYou merged 2 commits into
mainfrom
feat/diagnostic-message-punctuation

Conversation

@GeWuYou
Copy link
Copy Markdown
Owner

@GeWuYou GeWuYou commented Mar 21, 2026

  • 为 Priority 特性错误消息添加句号结尾
  • 为接口实现警告消息添加句号结尾
  • 为 partial 类要求错误消息添加句号结尾
  • 为整数值验证错误消息添加句号结尾
  • 为嵌套类限制错误消息添加句号结尾
  • 为服务获取建议消息添加句号结尾
  • 在测试项目配置中添加警告级别设置

Summary by Sourcery

标准化诊断消息描述,并调整测试项目的编译器警告配置。

增强内容:

  • 统一与 Priority 相关的诊断描述文本中的标点符号,使错误、警告和信息消息在表述上保持一致性。

测试:

  • 更新测试项目配置,显式设置编译器警告级别。
Original summary in English

Summary by Sourcery

Standardize diagnostic message descriptions and adjust test project compiler warning configuration.

Enhancements:

  • Unify punctuation in Priority-related diagnostic description texts for consistency across error, warning, and info messages.

Tests:

  • Update the test project configuration to explicitly set the compiler warning level.

- 为 Priority 特性错误消息添加句号结尾
- 为接口实现警告消息添加句号结尾
- 为 partial 类要求错误消息添加句号结尾
- 为整数值验证错误消息添加句号结尾
- 为嵌套类限制错误消息添加句号结尾
- 为服务获取建议消息添加句号结尾
- 在测试项目配置中添加警告级别设置
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Mar 21, 2026

审阅者指南(在小型 PR 上折叠显示)

审阅者指南

为与 Priority 相关的分析器统一诊断描述文本的标点符号,并调整测试项目配置以包含警告级别设置。

文件级变更

变更 详情 文件
统一与 Priority 相关诊断描述的标点符号。
  • 为在非类符号上误用 Priority 特性时的错误描述添加了句末标点
  • 为手动实现 IPrioritized 并跳过生成时的警告描述添加了句末标点
  • 为要求使用 partial 类以进行 IPrioritized 生成的错误描述添加了句末标点
  • 为验证 Priority 特性整数值的错误描述添加了句末标点
  • 为禁止在嵌套类上使用 Priority 并建议移动到命名空间级别的错误描述添加了句末标点
  • 为在解析 IPrioritized 服务时推荐使用 GetAllByPriority 的提示性描述添加了句末标点
GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs
调整测试项目配置以包含编译器警告配置。
  • 更新测试项目配置,显式设置与警告级别相关的配置项,使其与测试中的诊断期望保持一致
GFramework.Core.Tests/GFramework.Core.Tests.csproj

技巧与命令

与 Sourcery 交互

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

自定义你的使用体验

访问你的 控制面板 以:

  • 启用或禁用诸如 Sourcery 生成的 pull request 总结、审阅者指南等审阅功能。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Standardizes diagnostic description text punctuation for Priority-related analyzers and adjusts test project configuration to include a warning-level setting.

File-Level Changes

Change Details Files
Standardize punctuation for Priority-related diagnostic descriptions.
  • Added trailing punctuation to the error description for misuse of the Priority attribute on non-class symbols
  • Added trailing punctuation to the warning description when IPrioritized is manually implemented and generation is skipped
  • Added trailing punctuation to the error description requiring partial classes for IPrioritized generation
  • Added trailing punctuation to the error description validating Priority attribute integer values
  • Added trailing punctuation to the error description forbidding use of Priority on nested classes and suggesting moving to namespace level
  • Added trailing punctuation to the informational description recommending GetAllByPriority when resolving IPrioritized services
GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs
Adjust test project configuration to include compiler warning configuration.
  • Updated the test project configuration to explicitly set warning-level related settings to align with the diagnostics expectations in tests
GFramework.Core.Tests/GFramework.Core.Tests.csproj

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

@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented Mar 21, 2026

DeepSource Code Review

We reviewed changes in 51492b1...c00c4bd 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 21, 2026 12:47p.m. Review ↗
Secrets Mar 21, 2026 12:47p.m. Review ↗

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - 我发现了 5 个问题,并给出了一些总体反馈:

  • 更新后的诊断描述现在以中文句号加英文句号结尾(。.),看起来像是无意的重复标点;建议在所有消息中统一只使用一种标点风格。
AI 代理使用的提示词
Please address the comments from this code review:

## Overall Comments
- The updated diagnostic descriptions now end with a Chinese full stop followed by an English period (。.), which looks like accidental double punctuation; consider using only one style consistently across all messages.

## Individual Comments

### Comment 1
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="19-25" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Error,
         isEnabledByDefault: true,
-        description: "Priority 特性设计用于类级别的优先级标记,不支持其他类型。"
+        description: "Priority 特性设计用于类级别的优先级标记,不支持其他类型。."
     );

</code_context>
<issue_to_address>
**issue (typo):** 描述字符串在全角中文句号后面似乎多了一个英文句号。

当前描述以 `。.` 结尾。请移除最后的 `.`,让它只以一个句号结尾(例如:`不支持其他类型。`)。

```suggestion
        category: Category,
        defaultSeverity: DiagnosticSeverity.Error,
        isEnabledByDefault: true,
        description: "Priority 特性设计用于类级别的优先级标记,不支持其他类型。"
    );

    /// <summary>
        category: Category,
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

    /// <summary>
```
</issue_to_address>

### Comment 2
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="35" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Warning,
         isEnabledByDefault: true,
-        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
+        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。."
     );

</code_context>
<issue_to_address>
**issue (typo):** 该描述末尾的重复标点 `。.` 看起来像是拼写错误。

请移除末尾的 ASCII `.`,只以中文句号结尾,以在面向用户的诊断消息中保持一致性。

建议实现:

```csharp
        isEnabledByDefault: true,
        description: "Priority 特性设计用于类级别的优先级标记,不支持其他类型。"
    );

```

```csharp
        category: Category,
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```
</issue_to_address>

### Comment 3
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="48" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Error,
         isEnabledByDefault: true,
-        description: "源生成器需要在 partial 类中生成 IPrioritized 接口实现。"
+        description: "源生成器需要在 partial 类中生成 IPrioritized 接口实现。."
     );

</code_context>
<issue_to_address>
**issue (typo):** 描述字符串以 `。.` 结尾,看起来并非有意为之。

请只使用一种句子结束符(```.` 二选一),以与其他诊断消息保持一致。

建议实现:

```csharp
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```

```csharp
        category: Category,
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```
</issue_to_address>

### Comment 4
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="61" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Error,
         isEnabledByDefault: true,
-        description: "Priority 特性必须提供一个有效的整数值。"
+        description: "Priority 特性必须提供一个有效的整数值。."
     );

</code_context>
<issue_to_address>
**issue (typo):** 消息末尾出现 `。.`,可能是标点错误。

请移除末尾的 `.`,让诊断文本仅以 `` 字符结尾。

建议实现:

```csharp
        isEnabledByDefault: true,
        description: "源生成器需要在 partial 类中生成 IPrioritized 接口实现。"
    );

```

```csharp
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```
</issue_to_address>

### Comment 5
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="74" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Error,
         isEnabledByDefault: true,
-        description: "Priority 特性仅支持顶层类,不支持嵌套类。请将嵌套类移至命名空间级别。"
+        description: "Priority 特性仅支持顶层类,不支持嵌套类。请将嵌套类移至命名空间级别。."
     );

</code_context>
<issue_to_address>
**issue (typo):** 该较长描述中末尾的 `。.` 序列很可能是无意的。

请在最后一个全角中文句号 `` 之后移除 ASCII `.`,以避免在工具中显示为多余句点、像是拼写错误。

建议实现:

```csharp
        isEnabledByDefault: true,
        description: "Priority 特性必须提供一个有效的整数值。"
    );

```

```csharp
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```
</issue_to_address>

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

Hey - I've found 5 issues, and left some high level feedback:

  • The updated diagnostic descriptions now end with a Chinese full stop followed by an English period (。.), which looks like accidental double punctuation; consider using only one style consistently across all messages.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The updated diagnostic descriptions now end with a Chinese full stop followed by an English period (。.), which looks like accidental double punctuation; consider using only one style consistently across all messages.

## Individual Comments

### Comment 1
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="19-25" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Error,
         isEnabledByDefault: true,
-        description: "Priority 特性设计用于类级别的优先级标记,不支持其他类型。"
+        description: "Priority 特性设计用于类级别的优先级标记,不支持其他类型。."
     );

</code_context>
<issue_to_address>
**issue (typo):** The description string appears to have an extra period after the full-width Chinese full stop.

The description now ends with `。.`. Please remove the trailing `.` so it ends with a single full stop (e.g., `不支持其他类型。`).

```suggestion
        category: Category,
        defaultSeverity: DiagnosticSeverity.Error,
        isEnabledByDefault: true,
        description: "Priority 特性设计用于类级别的优先级标记,不支持其他类型。"
    );

    /// <summary>
        category: Category,
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

    /// <summary>
```
</issue_to_address>

### Comment 2
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="35" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Warning,
         isEnabledByDefault: true,
-        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
+        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。."
     );

</code_context>
<issue_to_address>
**issue (typo):** Double punctuation `。.` at the end of this description likely reads as a typo.

Please remove the trailing ASCII `.` and end the sentence with just the Chinese full stop for consistency in user-facing diagnostics.

Suggested implementation:

```csharp
        isEnabledByDefault: true,
        description: "Priority 特性设计用于类级别的优先级标记,不支持其他类型。"
    );

```

```csharp
        category: Category,
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```
</issue_to_address>

### Comment 3
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="48" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Error,
         isEnabledByDefault: true,
-        description: "源生成器需要在 partial 类中生成 IPrioritized 接口实现。"
+        description: "源生成器需要在 partial 类中生成 IPrioritized 接口实现。."
     );

</code_context>
<issue_to_address>
**issue (typo):** Description string ends with `。.`, which seems unintended.

Please use only one sentence terminator here (either `` or `.`) to be consistent with the other diagnostics.

Suggested implementation:

```csharp
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```

```csharp
        category: Category,
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```
</issue_to_address>

### Comment 4
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="61" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Error,
         isEnabledByDefault: true,
-        description: "Priority 特性必须提供一个有效的整数值。"
+        description: "Priority 特性必须提供一个有效的整数值。."
     );

</code_context>
<issue_to_address>
**issue (typo):** Potential punctuation typo with `。.` at the end of the message.

Remove the trailing `.` so the message ends with just the `` character in the diagnostic text.

Suggested implementation:

```csharp
        isEnabledByDefault: true,
        description: "源生成器需要在 partial 类中生成 IPrioritized 接口实现。"
    );

```

```csharp
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```
</issue_to_address>

### Comment 5
<location path="GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs" line_range="74" />
<code_context>
         defaultSeverity: DiagnosticSeverity.Error,
         isEnabledByDefault: true,
-        description: "Priority 特性仅支持顶层类,不支持嵌套类。请将嵌套类移至命名空间级别。"
+        description: "Priority 特性仅支持顶层类,不支持嵌套类。请将嵌套类移至命名空间级别。."
     );

</code_context>
<issue_to_address>
**issue (typo):** The final `。.` sequence in this longer description is likely accidental.

Please remove the trailing ASCII `.` after the final full-width `` to avoid an unintended double period that may appear as a typo in tooling.

Suggested implementation:

```csharp
        isEnabledByDefault: true,
        description: "Priority 特性必须提供一个有效的整数值。"
    );

```

```csharp
        defaultSeverity: DiagnosticSeverity.Warning,
        isEnabledByDefault: true,
        description: "当类已经手动实现 IPrioritized 接口时,源生成器将跳过代码生成以避免冲突。"
    );

```
</issue_to_address>

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.

Comment thread GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs
Comment thread GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs Outdated
Comment thread GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs Outdated
Comment thread GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs Outdated
Comment thread GFramework.SourceGenerators/Diagnostics/PriorityDiagnostic.cs Outdated
- 移除了 Priority 特性描述中的多余句号
- 移除了 IPrioritized 接口实现跳过警告中的多余句号
- 移除了 partial 类要求错误中的多余句号
- 移除了 Priority 特性值验证错误中的多余句号
- 移除了嵌套类限制错误中的多余句号
- 移除了服务获取建议信息中的多余句号
@GeWuYou GeWuYou merged commit 86645d3 into main Mar 21, 2026
7 checks passed
@GeWuYou GeWuYou deleted the feat/diagnostic-message-punctuation branch March 21, 2026 12:51
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