Skip to content

chore(naming): align with dotnet/runtime style - #95

Merged
github-actions[bot] merged 1 commit into
mainfrom
chore/naming-runtime-aligned-2026
May 4, 2026
Merged

chore(naming): align with dotnet/runtime style#95
github-actions[bot] merged 1 commit into
mainfrom
chore/naming-runtime-aligned-2026

Conversation

@ANcpLua

@ANcpLua ANcpLua commented May 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds local naming-rule enforcement to the root .editorconfig under [*.cs]. This repo doesn't consume ANcpLua.NET.Sdk, so the SDK's canonical NamingConvention.editorconfig isn't auto-injected — the rules are mirrored here so renames have IDE/build-time enforcement without onboarding the SDK.
  • Renames 23 private/internal static (readonly) fields to s_camelCase per dotnet/runtime style.

Why

ANcpLua.NET.Sdk PR #99 fixed the NamingConvention.editorconfig so that private/internal static (incl. readonly) fields require the s_ prefix instead of PascalCase. Without that fix flowing here (no SDK consumption), the codebase was drifting away from runtime style with 23 violations and zero local enforcement to catch new ones.

Approach

  • editorconfig: chose Option 2 with a twist — appended naming rules directly to the existing root .editorconfig (under the existing [*.cs] section), without is_global=true. The SDK ships its NamingConvention as is_global=true, but that requires MSBuild registration to take effect; without the SDK pipeline, a plain [*.cs] section is the most reliable way to get IDE-side enforcement (matches the user's task guidance).
  • Renames: 23 fields, file-by-file targeted edits to avoid sed false-positives. Type-name collisions handled explicitly: HttpClient (BCL type), KeyedAsyncLock<T> (generic type with same name as the field), References (vs Net100.References from Basic.Reference.Assemblies), and Path.GetInvalidFileNameChars() (substring of the renamed field).
  • Doc-comment fix: the <example> block in AnalysisContextExtensions.cs showed Diagnostic.Create(Rule, ...) — updated to s_rule for consistency with the renamed analyzer field, modeling the correct convention to consumers.

Renames

File Old New
TestConfiguration.cs LanguageVersionOverride s_languageVersionOverride
TestConfiguration.cs ReferenceAssembliesOverride s_referenceAssembliesOverride
TestConfiguration.cs AdditionalReferencesOverride s_additionalReferencesOverride
ForbiddenTypeAnalyzer.cs ForbiddenTypes s_forbiddenTypes
ForbiddenTypeAnalyzer.cs FieldCache s_fieldCache
BitNetFixture.cs DefaultEndpoint s_defaultEndpoint
DotNetSdkHelpers.cs HttpClient (field) s_httpClient
DotNetSdkHelpers.cs Values s_values
DotNetSdkHelpers.cs KeyedAsyncLock (field) s_keyedAsyncLock
SolutionRefactoringTest.cs References s_references
ReportFormatter.cs JsonOptions s_jsonOptions
StepClassification.cs SinkStepPatterns s_sinkStepPatterns
StepClassification.cs RoslynInternalStepPatterns s_roslynInternalStepPatterns
StepClassification.cs InfrastructureFilePatterns s_infrastructureFilePatterns
Boxes.cs CachedInt32 s_cachedInt32
Boxes.cs CachedChar s_cachedChar
Guard.cs InvalidFileNameChars s_invalidFileNameChars
Guard.cs InvalidPathChars s_invalidPathChars
StringExtensions.cs NewLineSeparator s_newLineSeparator
StringExtensions.cs WhitespaceRegexInstance s_whitespaceRegexInstance
TimeConversions.cs UnixEpoch s_unixEpoch
ByteSize.cs Suffixes s_suffixes
MissingCancellationTokenAnalyzer.cs Rule s_rule

Test plan

  • dotnet build — 0 warnings, 0 errors (Debug + Release)
  • dotnet run --project tests/ANcpLua.Roslyn.Utilities.Testing.Tests — 23/23 passed
  • CrefRegression.Tests — builds clean (build success IS the test)
  • Final violation count: 0 (regex sweep)

🤖 Generated with Claude Code

…untime style

Adds local NamingConvention rules under [*.cs] in the existing root
.editorconfig. This repo doesn't consume ANcpLua.NET.Sdk, so the SDK's
canonical NamingConvention.editorconfig is not auto-injected; mirroring
the rules locally enforces the style at IDE/build time without taking
on the SDK dependency.

Renames 23 private/internal static (readonly) fields to s_camelCase:
  TestConfiguration: LanguageVersionOverride, ReferenceAssembliesOverride,
    AdditionalReferencesOverride
  ForbiddenTypeAnalyzer: ForbiddenTypes, FieldCache
  BitNetFixture: DefaultEndpoint
  DotNetSdkHelpers: HttpClient, Values, KeyedAsyncLock
  SolutionRefactoringTestReferences: References
  ReportFormatter: JsonOptions
  StepClassification: SinkStepPatterns, RoslynInternalStepPatterns,
    InfrastructureFilePatterns
  Boxes: CachedInt32, CachedChar
  Guard: InvalidFileNameChars, InvalidPathChars
  StringExtensions: NewLineSeparator, WhitespaceRegexInstance
  TimeConversions: UnixEpoch
  ByteSize: Suffixes
  MissingCancellationTokenAnalyzer: Rule

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

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@ANcpLua has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 26 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3947e153-8f51-4f53-a373-b3196d2f9e8e

📥 Commits

Reviewing files that changed from the base of the PR and between c6973e6 and 3d26d3c.

⛔ Files ignored due to path filters (1)
  • .editorconfig is excluded by none and included by none
📒 Files selected for processing (14)
  • src/ANcpLua.Roslyn.Utilities.Examples.XunitCancellationAnalyzer/MissingCancellationTokenAnalyzer.cs
  • src/ANcpLua.Roslyn.Utilities.Testing/AI/BitNetFixture.cs
  • src/ANcpLua.Roslyn.Utilities.Testing/Analysis/StepClassification.cs
  • src/ANcpLua.Roslyn.Utilities.Testing/ForbiddenTypeAnalyzer.cs
  • src/ANcpLua.Roslyn.Utilities.Testing/Formatting/ReportFormatter.cs
  • src/ANcpLua.Roslyn.Utilities.Testing/MSBuild/DotNetSdkHelpers.cs
  • src/ANcpLua.Roslyn.Utilities.Testing/SolutionRefactoringTest.cs
  • src/ANcpLua.Roslyn.Utilities.Testing/TestConfiguration.cs
  • src/ANcpLua.Roslyn.Utilities/AnalysisContextExtensions.cs
  • src/ANcpLua.Roslyn.Utilities/Boxes.cs
  • src/ANcpLua.Roslyn.Utilities/Guard.cs
  • src/ANcpLua.Roslyn.Utilities/StringExtensions.cs
  • src/ANcpLua.Roslyn.Utilities/Text/ByteSize.cs
  • src/ANcpLua.Roslyn.Utilities/Time/TimeConversions.cs

Review rate limit: 0/5 reviews remaining, refill in 4 minutes and 26 seconds.

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

@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown

@coderabbitai autofix

@github-actions
github-actions Bot enabled auto-merge (squash) May 4, 2026 20:04
@claude

claude Bot commented May 4, 2026

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

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.

@github-actions
github-actions Bot merged commit f87cca7 into main May 4, 2026
13 of 15 checks passed

Copilot AI 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.

Pull request overview

This PR aligns the repository with dotnet/runtime-style field naming by adding local C# naming rules to the root .editorconfig and renaming existing private/internal static fields to use the s_ prefix. It mainly affects internal implementation details across the main library, testing helpers, and the example analyzer.

Changes:

  • Added C# naming-style rules to the root .editorconfig so this repo can enforce conventions without consuming ANcpLua.NET.Sdk.
  • Renamed private/internal static fields across utility, testing, and example projects to s_camelCase.
  • Updated one analyzer documentation example to match the renamed diagnostic descriptor field.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/ANcpLua.Roslyn.Utilities/Time/TimeConversions.cs Renames the cached Unix epoch field and updates its use.
src/ANcpLua.Roslyn.Utilities/Text/ByteSize.cs Renames the static suffix table and updates references.
src/ANcpLua.Roslyn.Utilities/StringExtensions.cs Renames static newline/regex helpers and updates call sites.
src/ANcpLua.Roslyn.Utilities/Guard.cs Renames cached invalid-path character arrays and updates validation loops.
src/ANcpLua.Roslyn.Utilities/Boxes.cs Renames boxed-value caches and updates accessors.
src/ANcpLua.Roslyn.Utilities/AnalysisContextExtensions.cs Updates XML-doc example text to use the renamed analyzer field style.
src/ANcpLua.Roslyn.Utilities.Testing/TestConfiguration.cs Renames AsyncLocal override fields used by test configuration scopes.
src/ANcpLua.Roslyn.Utilities.Testing/SolutionRefactoringTest.cs Renames shared metadata reference cache for refactoring tests.
src/ANcpLua.Roslyn.Utilities.Testing/MSBuild/DotNetSdkHelpers.cs Renames static HTTP/cache/lock fields used for SDK resolution.
src/ANcpLua.Roslyn.Utilities.Testing/Formatting/ReportFormatter.cs Renames cached JSON serializer options.
src/ANcpLua.Roslyn.Utilities.Testing/ForbiddenTypeAnalyzer.cs Renames static forbidden-type and reflection-cache fields.
src/ANcpLua.Roslyn.Utilities.Testing/Analysis/StepClassification.cs Renames static pattern arrays used for classification helpers.
src/ANcpLua.Roslyn.Utilities.Testing/AI/BitNetFixture.cs Renames the default endpoint field and updates initialization.
src/ANcpLua.Roslyn.Utilities.Examples.XunitCancellationAnalyzer/MissingCancellationTokenAnalyzer.cs Renames the diagnostic descriptor field and updates usages.
.editorconfig Adds repo-local naming rules intended to enforce the new field naming convention.

Comment thread .editorconfig
Comment on lines +19 to +21
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
@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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants