chore(naming): align with dotnet/runtime style - #95
Conversation
…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>
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (14)
Review rate limit: 0/5 reviews remaining, refill in 4 minutes and 26 seconds. Comment |
|
@coderabbitai autofix |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
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. |
There was a problem hiding this comment.
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
.editorconfigso this repo can enforce conventions without consumingANcpLua.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. |
| 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 |
Summary
.editorconfigunder[*.cs]. This repo doesn't consumeANcpLua.NET.Sdk, so the SDK's canonicalNamingConvention.editorconfigisn't auto-injected — the rules are mirrored here so renames have IDE/build-time enforcement without onboarding the SDK.s_camelCaseper dotnet/runtime style.Why
ANcpLua.NET.SdkPR #99 fixed theNamingConvention.editorconfigso that private/internal static (incl. readonly) fields require thes_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(under the existing[*.cs]section), withoutis_global=true. The SDK ships its NamingConvention asis_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).HttpClient(BCL type),KeyedAsyncLock<T>(generic type with same name as the field),References(vsNet100.ReferencesfromBasic.Reference.Assemblies), andPath.GetInvalidFileNameChars()(substring of the renamed field).<example>block inAnalysisContextExtensions.csshowedDiagnostic.Create(Rule, ...)— updated tos_rulefor consistency with the renamed analyzer field, modeling the correct convention to consumers.Renames
TestConfiguration.csLanguageVersionOverrides_languageVersionOverrideTestConfiguration.csReferenceAssembliesOverrides_referenceAssembliesOverrideTestConfiguration.csAdditionalReferencesOverrides_additionalReferencesOverrideForbiddenTypeAnalyzer.csForbiddenTypess_forbiddenTypesForbiddenTypeAnalyzer.csFieldCaches_fieldCacheBitNetFixture.csDefaultEndpoints_defaultEndpointDotNetSdkHelpers.csHttpClient(field)s_httpClientDotNetSdkHelpers.csValuess_valuesDotNetSdkHelpers.csKeyedAsyncLock(field)s_keyedAsyncLockSolutionRefactoringTest.csReferencess_referencesReportFormatter.csJsonOptionss_jsonOptionsStepClassification.csSinkStepPatternss_sinkStepPatternsStepClassification.csRoslynInternalStepPatternss_roslynInternalStepPatternsStepClassification.csInfrastructureFilePatternss_infrastructureFilePatternsBoxes.csCachedInt32s_cachedInt32Boxes.csCachedChars_cachedCharGuard.csInvalidFileNameCharss_invalidFileNameCharsGuard.csInvalidPathCharss_invalidPathCharsStringExtensions.csNewLineSeparators_newLineSeparatorStringExtensions.csWhitespaceRegexInstances_whitespaceRegexInstanceTimeConversions.csUnixEpochs_unixEpochByteSize.csSuffixess_suffixesMissingCancellationTokenAnalyzer.csRules_ruleTest plan
dotnet build— 0 warnings, 0 errors (Debug + Release)dotnet run --project tests/ANcpLua.Roslyn.Utilities.Testing.Tests— 23/23 passedCrefRegression.Tests— builds clean (build success IS the test)🤖 Generated with Claude Code