Skip to content

chore(naming): align editorconfig with dotnet/runtime, single source#99

Merged
github-actions[bot] merged 2 commits intomainfrom
chore/naming-runtime-aligned-2026
May 4, 2026
Merged

chore(naming): align editorconfig with dotnet/runtime, single source#99
github-actions[bot] merged 2 commits intomainfrom
chore/naming-runtime-aligned-2026

Conversation

@ANcpLua
Copy link
Copy Markdown
Owner

@ANcpLua ANcpLua commented May 4, 2026

Summary

  • src/Config/NamingConvention.editorconfig is now the canonical naming-rule source. Removed the bogus static_readonly_fields → PascalCase rule (dotnet/runtime doesn't have it; static_fields rule already covers private/internal static incl. readonly with s_ prefix).
  • Stripped duplicate naming-rule sections from /.editorconfig and tools/.editorconfig — they conflicted with the SDK config and forced private static readonly fields to _camelCase in this repo's own builds.
  • Directory.Build.props injects NamingConvention.editorconfig via EditorConfigFiles so this repo's own projects (which use Microsoft.NET.Sdk directly) eat their own dog food.
  • Renamed 7 private static readonly fields _xxxs_xxx in tests.

Result aligns with dotnet/runtime coding-style and Microsoft Learn naming guidance: const → PascalCase, private/internal static (incl. readonly) → s_camelCase, private/internal instance → _camelCase. Public/protected falls through to the PascalCase fallback.

Test plan

  • dotnet build clean (0 warnings, 0 errors)
  • CI green

NamingConvention.editorconfig is the single canonical source for naming
rules. Removed the bogus static_readonly_fields → PascalCase rule
(dotnet/runtime doesn't have it; static_fields rule already covers
private/internal static incl. readonly with s_ prefix).

Stripped duplicate naming-rule sections from /.editorconfig and
tools/.editorconfig — they conflicted with the SDK config and forced
private static readonly fields to _camelCase. Directory.Build.props now
injects NamingConvention.editorconfig via EditorConfigFiles so this
repo's own projects (which use Microsoft.NET.Sdk directly) consume the
same rules SDK consumers get.

Renamed 7 private static readonly fields _xxx → s_xxx in tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 4, 2026 19:46
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: bad8f0cf-4ae6-4abe-bd71-f673c57f95d1

📥 Commits

Reviewing files that changed from the base of the PR and between e281ea5 and 16937b8.

⛔ Files ignored due to path filters (2)
  • .editorconfig is excluded by none and included by none
  • tools/.editorconfig is excluded by none and included by none
📒 Files selected for processing (5)
  • Directory.Build.props
  • src/Config/NamingConvention.editorconfig
  • tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs
  • tests/ANcpLua.Sdk.Tests/SdkTests.cs
  • tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs
📜 Recent review details
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: create_nuget
🧰 Additional context used
📓 Path-based instructions (2)
tests/**/*.cs

⚙️ CodeRabbit configuration file

xUnit.v3 test projects using xunit.v3.mtp-v2 with AwesomeAssertions and NSubstitute. Follow Arrange-Act-Assert pattern. Use descriptive test names: MethodName_Scenario_ExpectedResult. Test async methods with async Task, not async void. Flag hardcoded test data that should come from the seeded DuckDB file (the single source of truth for demo/test data). Prefer [Theory] with [InlineData] or [MemberData] over duplicated [Fact] methods testing variations of the same behavior. Flag tests that depend on test execution order.

Files:

  • tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs
  • tests/ANcpLua.Sdk.Tests/SdkTests.cs
  • tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs
**/*.props

⚙️ CodeRabbit configuration file

MSBuild property files (Directory.Build.props, Directory.Packages.props, Version.props). Review for: Central Package Management correctness, version consistency, and that new packages are added with explicit version pins. Flag transitive dependency promotions that aren't justified. Verify TFM targeting is correct (.NET 10).

Files:

  • Directory.Build.props
🔇 Additional comments (5)
tests/ANcpLua.Sdk.Tests/SdkTests.cs (1)

26-26: Static recorded-properties rename is consistent and safe.

The rename to s_recordedProperties and the updated RecordProperties(...) usage are aligned and behavior-preserving.

Also applies to: 43-43

tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs (1)

25-25: Rename and usage update are correct.

_recordedPropertiess_recordedProperties is applied consistently at declaration and use.

Also applies to: 35-35

Directory.Build.props (1)

24-31: EditorConfig canonical-source injection is correctly wired.

Adding NamingConvention.editorconfig via EditorConfigFiles in Directory.Build.props matches the PR objective and keeps rule consumption centralized.

tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs (1)

21-37: Static-field naming migration is complete and internally consistent.

All s_ declarations and downstream usages are updated coherently with no functional drift in the MTP matrix tests.

Also applies to: 48-48, 55-56, 81-82, 109-110, 135-136, 158-159, 187-188, 216-217, 245-246, 273-274, 303-304, 331-332

src/Config/NamingConvention.editorconfig (1)

14-17: Naming-rule precedence documentation is clear and aligned with the policy shift.

The updated comments accurately describe the intended static vs instance-field naming behavior and fallback expectations.

Also applies to: 27-29


Summary by CodeRabbit

Release Notes

  • Chores

    • Updated repository-wide build configuration to enforce consistent code naming conventions across the project.
  • Refactor

    • Standardized static field naming conventions throughout the codebase to align with repository style guidelines.

Walkthrough

Directory.Build.props now injects the repository's NamingConvention.editorconfig to enforce naming conventions across projects. The editorconfig is updated to clarify that const fields use PascalCase while private/internal static readonly fields use the s_-prefix pattern. Test files are refactored to conform by renaming static fields from underscore to s_ prefixes.

Changes

Static Field Naming Convention Enforcement

Layer / File(s) Summary
EditorConfig Rule Clarification
src/Config/NamingConvention.editorconfig
Removed the static_readonly_fields_should_be_pascal_case rule and clarified via comments that const fields remain PascalCase while private/internal static readonly fields must use the s_-prefix static field rule instead.
Repository Configuration
Directory.Build.props
Added EditorConfigFiles ItemGroup to inject NamingConvention.editorconfig for all Microsoft.NET.Sdk projects, ensuring the repo's own conventions are enforced.
Test Conformance
tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs, tests/ANcpLua.Sdk.Tests/SdkTests.cs, tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs
All private static fields renamed from underscore prefix (e.g., _recordedProperties, _xUnit3MtpV2Packages) to s_ prefix to comply with the corrected convention; all usages updated accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

area:infra

🚥 Pre-merge checks | ✅ 8
✅ Passed checks (8 passed)
Check name Status Explanation
Title check ✅ Passed Title follows conventional commit format with 'chore' type and '(naming)' scope, is under 72 characters, and accurately summarizes the main change: aligning editorconfig naming conventions with dotnet/runtime standards.
Description check ✅ Passed Description is well-related to the changeset, providing clear context for the naming convention consolidation, rule removals, MSBuild injection, and field renames across multiple 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.
Otel Instrumentation Required ✅ Passed No new injectable service classes detected; changes limited to configuration and test file naming updates.
No Unbounded Mcp Responses ✅ Passed PR contains no modifications to MCP tool definitions under src/qyl.mcp/, satisfying the pass condition.
Duckdb Backpressure On Write Paths ✅ Passed PR contains no DuckDB references or write operations; changes limited to naming conventions and configuration updates.
Cancellationtoken Threading ✅ Passed The custom check applies only to new public async methods in src/**/*.cs. This PR modifies only .editorconfig and Directory.Build.props—no C# source code. All C# changes are in tests/ (private field renames), which falls outside the check's scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Review rate limit: 3/5 reviews remaining, refill in 23 minutes and 6 seconds.

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

@coderabbitai autofix

@claude
Copy link
Copy Markdown

claude Bot commented May 4, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions github-actions Bot merged commit 3894a06 into main May 4, 2026
15 of 16 checks passed
@ANcpLua ANcpLua deleted the chore/naming-runtime-aligned-2026 branch May 5, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants