Skip to content

fix: enforce generated analyzer config ordering#130

Merged
ancplua-automerge[bot] merged 29 commits intomainfrom
fix/refix-codestyle-policy-pass
May 10, 2026
Merged

fix: enforce generated analyzer config ordering#130
ancplua-automerge[bot] merged 29 commits intomainfrom
fix/refix-codestyle-policy-pass

Conversation

@ANcpLua
Copy link
Copy Markdown
Owner

@ANcpLua ANcpLua commented May 9, 2026

Summary\n- dogfood generated analyzer configs through this repo's own projects\n- assign deterministic global_level values for generated analyzer config files\n- pin NetAnalyzers config generation to the repo's DotNetSdkVersion when available\n\n## Verification\n- dotnet test --project tests/ANcpLua.Sdk.Tests/ANcpLua.Sdk.Tests.csproj --filter-class 'TemplatesTests' --filter-class 'MtpDetectionTests' --filter-class 'SdkTests' --filter-class 'SourceGeneratorDefaultsTests'


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Summary by CodeRabbit

  • Chores

    • Safer default build/analyzer options applied only when not already set; warnings-as-errors enforced in CI/Release.
    • Add repo toggle to conditionally inject broader editorconfigs and set CI marker only when appropriate.
    • Rebalance global analyzer precedence and make analyzer-config generation deterministic; enforce pinned analyzer versions.
  • Tests

    • Improve reliability: ordinal string comparisons, safer disposal and suppressions for disposal warnings, and more robust retry logic.

Copilot AI review requested due to automatic review settings May 9, 2026 10:23
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

@coderabbitai autofix

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5d1e70f9-6ef4-465c-a1dc-85787830702d

📥 Commits

Reviewing files that changed from the base of the PR and between d517b7e and cb4e6cb.

📒 Files selected for processing (2)
  • Directory.Build.props
  • tools/ConfigFilesGenerator/Program.cs
📜 Recent review details
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: test (macos-latest)
  • GitHub Check: test (ubuntu-latest)
  • GitHub Check: test (windows-latest)
  • GitHub Check: lint_config
🧰 Additional context used
📓 Path-based instructions (2)
tools/**

⚙️ CodeRabbit configuration file

tools/**: Internal tooling — config file generators, build helpers. Lower bar than
production src/, but still flag obvious bugs (missing null check that
crashes the build, hardcoded paths, swallowed exceptions).

Files:

  • tools/ConfigFilesGenerator/Program.cs
**/*.props

⚙️ CodeRabbit configuration file

**/*.props: MSBuild property files. Review for: condition guards on every override
(consumer must be able to opt out), no <RemoveAttributes> on items
that consumers may have set, and that defaults are sensible without
forcing a downstream cascade.

Files:

  • Directory.Build.props
🪛 GitHub Actions: Claude Code Review / 0_claude-review.txt
tools/ConfigFilesGenerator/Program.cs

[error] 62-62: lint_config failure: Cannot use local variable 'CompilerAnalyzerConfigGlobalLevel' before it is declared (tools/ConfigFilesGenerator/Program.cs, line 62).


[warning] 377-377: lint_config warning: Unreachable code detected at Program.cs:377.

🪛 GitHub Actions: Claude Code Review / claude-review
tools/ConfigFilesGenerator/Program.cs

[error] 62-62: lint_config failure: Cannot use local variable 'CompilerAnalyzerConfigGlobalLevel' before it is declared.


[warning] 377-377: lint_config warning: Unreachable code detected.

🔇 Additional comments (12)
Directory.Build.props (3)

8-10: CI marker handling is correctly ordered and consumer-overridable.

This now sets the CI marker early while still allowing downstream override via the empty-check guard.

As per coding guidelines, **/*.props: “condition guards on every override (consumer must be able to opt out) ... and that defaults are sensible without forcing a downstream cascade.”


16-23: Build/analyzer defaults now satisfy the opt-out contract.

The guarded defaults and CI/Release warning enforcement conditions are correctly composed and no longer force downstream overrides.

As per coding guidelines, **/*.props: “condition guards on every override (consumer must be able to opt out) ... and that defaults are sensible without forcing a downstream cascade.”


41-47: EditorConfig dogfooding switch is implemented correctly.

EnableEditorConfigDogfooding defaults safely and the EditorConfigFiles injection is now explicitly gated for consumer opt-out.

As per coding guidelines, **/*.props: “condition guards on every override (consumer must be able to opt out) ... and that defaults are sensible without forcing a downstream cascade.”

tools/ConfigFilesGenerator/Program.cs (9)

23-47: LGTM — const placement and analyzer injection contract are correct.

The CompilerAnalyzerConfigGlobalLevel const is now declared before use. Injected analyzer resolution fails fast with actionable messages when Version.props doesn't provide expected properties.

Note: Pipeline failures referencing line 62 appear stale — they don't match the current code where the const is at line 23.


407-423: LGTM — text normalization helpers are clean.

Pure functions with correct null handling. NormalizeHelpLink properly fixes analyzer URLs missing the rule slug.


425-487: LGTM — deterministic global_level assignment is correct.

FNV-1a over uppercased UTF-8 produces process-stable hashes (unlike randomized GetHashCode). Reserved levels prevent churn for core analyzer packs. Linear probing handles collisions.

Theoretical risk: infinite loop if >9000 packages collide into the same range. Acceptable for internal tooling with a known small package set.


489-538: LGTM — MSBuild property loader correctly honors conditional defaults.

Only the standard '$(Name)' == '' guard is evaluated; unknown Condition shapes are skipped rather than assumed true. This prevents silent mishandling of guards the loader doesn't understand.


540-601: LGTM — dedup logic and pinned version handling are correct.

visitedPackages now uses PackageIdentityComparer.Default for O(1) lookups (fixes the covariance-induced O(n) Contains bug). Pinned analyzer versions are strictly enforced during dedup, and missing pinned packages fail loudly rather than silently dropping from generation.


647-689: LGTM — yield logic correctly sequences resolution before seen-tracking.

emittedIds.Add happens only after version resolution succeeds, so injected analyzer fallbacks at lines 686-688 can still fire when property-based versions don't resolve. Two-tier tracking (tuples for dedup, ids for fallback) is the right design.


691-720: LGTM — property resolver has correct cycle guard and depth bound.

Bounded recursion (16 levels) and cycle detection via visited set prevent runaway expansion. Returns gracefully on unresolvable properties rather than throwing.


966-981: LGTM — VersionedPackageKeyComparer is correctly implemented.

Case-insensitive id comparison (NuGet semantics) with ordinal version comparison. Null version is handled correctly in GetHashCode.


722-737: LGTM — worktree support is correct.

Checking both Directory.Exists and File.Exists for .git handles the worktree case where .git is a pointer file rather than a directory.


📝 Walkthrough

Walkthrough

Directory.Build.props now applies .NET SDK defaults only when unset (ImplicitUsings=enable, Deterministic=true, EnableNETAnalyzers=true, AnalysisLevel=latest-all), sets ContinuousIntegrationBuild=true only when empty and CI==true, and enables MSBuildTreatWarningsAsErrors/TreatWarningsAsErrors/EnforceCodeStyleInBuild only for CI or Release when unset. It adds EnableEditorConfigDogfooding (default true) to conditionally include src\Config*.editorconfig (excluding src\Config\ANcpLua.NET.Sdk*.editorconfig). Multiple src/Config/*.editorconfig files had global_level adjustments. tools/ConfigFilesGenerator was made deterministic and enforces pinned analyzer versions from src/Build/Common/Version.props (which adds NetAnalyzersVersion). Tests and helpers use StringComparison.Ordinal; Directory.Build.props injection now parses XML.


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
No Datetime.Now/Utcnow ❌ Error Found 3 usages of DateTime.Now in SdkTests.cs (lines 227, 272, 288) as string literals in test fixtures. Per check: test fixture exception requires "explicit reason commented inline" — none present. Add inline comments to each DateTime.Now usage in test fixtures explaining the legitimate reason (e.g., testing banned symbol detection for RS0030).
No Suppression Of Fixable Diagnostics ⚠️ Warning Three CA2000 SuppressMessage attributes added to test helpers (MtpDetectionTests, SdkTests, SourceGeneratorDefaultsTests). CA2000 is not on the allowlist. PR objectives state these should be removed. Remove CA2000 SuppressMessage attributes from CreateProject helpers. Disposal is already handled by 'await using var project = CreateProject(...)' in all callers per PR reviewer guidance.
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows conventional commits format (fix prefix) and is under 72 characters, but the change scope spans multiple layers—SDK build props, analyzer configs, test updates, and tooling—making it overly broad for a single semantic descriptor.
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.
No .Result/.Wait() Blocking Async ✅ Passed No blocking async patterns detected. All C# modifications properly use async/await without .Result, .Wait(), or .GetAwaiter().GetResult().
No Null-Forgiving Operator Without Justification ✅ Passed No null-forgiving operators (!) detected in modified C# files. All ! instances are logical negation operators (boolean NOT checks), which are acceptable per policy.

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 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.

@ancplua-automerge ancplua-automerge Bot enabled auto-merge (squash) May 9, 2026 10:23
@claude
Copy link
Copy Markdown

claude Bot commented May 9, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

@coderabbitai autofix

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 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.

@claude
Copy link
Copy Markdown

claude Bot commented May 9, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

@coderabbitai autofix

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 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.

@claude
Copy link
Copy Markdown

claude Bot commented May 9, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

@coderabbitai autofix

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 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.

Pull request overview

This PR makes analyzer configuration generation and consumption more deterministic by introducing stable global_level precedence across SDK-shipped global AnalyzerConfig files, and by dogfooding those configs in the repo’s own projects. It also tightens repo build analysis settings and updates tests to be explicit about string-comparison semantics.

Changes:

  • Assign deterministic, distinct global_level values across generated and SDK-shipped global .editorconfig analyzer config files.
  • Update config-generation tooling to compute stable global levels and attempt to pin Microsoft.CodeAnalysis.NetAnalyzers generation to the repo’s declared .NET SDK version.
  • Enable/strengthen analyzers + warnings-as-errors for CI/Release and adjust tests to be explicit about StringComparison and disposal warnings.

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/ConfigFilesGenerator/Program.cs Adds deterministic global_level assignment, reads DotNetSdkVersion from repo, and pins NetAnalyzers generation when available.
tests/ANcpLua.Sdk.Tests/TemplatesTests.cs Makes string assertions explicit with StringComparison.Ordinal.
tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs Suppresses CA2000 for a builder factory method disposed by tests.
tests/ANcpLua.Sdk.Tests/SdkTests.cs Suppresses CA2000 for builder creation, makes string comparisons explicit, and ensures PEReader disposal.
tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs Suppresses CA2000 for builder creation and makes CLI arg assertions ordinal.
tests/ANcpLua.Sdk.Tests/Helpers/SdkProjectBuilder.cs Uses ordinal Replace, improves retry constant naming, and makes SDK resolution checks ordinal.
src/Config/NamingConvention.editorconfig Sets a non-zero global_level for deterministic precedence.
src/Config/Global.editorconfig Raises global_level to define highest precedence among SDK globals.
src/Config/Compiler.editorconfig Updates header comment and assigns a deterministic global_level.
src/Config/CodingStyle.editorconfig Assigns global_level, removes editor-only formatting settings, and updates/normalizes style options.
src/Config/ANcpLua.NET.Sdk.Web.editorconfig Raises global_level to ensure it overrides base SDK-shipped globals.
src/Config/ANcpLua.NET.Sdk.SingleFileApp.editorconfig Raises global_level to ensure it overrides base SDK-shipped globals.
src/Config/Analyzer.Microsoft.CodeAnalysis.NetAnalyzers.editorconfig Sets deterministic global_level and updates generated content ordering/contents.
src/Config/Analyzer.Microsoft.CodeAnalysis.BannedApiAnalyzers.editorconfig Sets deterministic global_level and updates header/trailing formatting.
src/Config/Analyzer.Microsoft.CodeAnalysis.Analyzers.editorconfig Sets deterministic global_level and updates header/trailing formatting.
src/Config/Analyzer.ANcpLua.Analyzers.editorconfig Sets deterministic global_level and updates header/trailing formatting.
Directory.Build.props Enables implicit usings + analyzers, enforces warnings-as-errors in CI/Release, and includes SDK config files for dogfooding.
.editorconfig Changes C# file charset from UTF-8 BOM to UTF-8.
Comments suppressed due to low confidence (1)

tools/ConfigFilesGenerator/Program.cs:240

  • GetAllReferencedNuGetPackages() can return multiple entries for the same package ID at different versions (the set is keyed by ID+version, and dependency traversal uses dependency.VersionRange.MinVersion). Since the generator writes to a path derived only from packageId (Analyzer.{packageId}.editorconfig) while iterating in Parallel.ForEachAsync, two versions of the same ID could race and produce nondeterministic output. Consider deduplicating to a single version per package ID (e.g., pick the highest resolved version) before running the parallel loop, or otherwise ensure only one writer per output file.
async Task GenerateEditorConfigForAnalyzers()
{
    var packages = await GetAllReferencedNuGetPackages().ConfigureAwait(false);
    var globalLevelsByPackageId = GetAnalyzerConfigGlobalLevels(packages.Select(static p => p.Id));
    await Parallel.ForEachAsync(packages, async (item, cancellationToken) =>
    {
        var (packageId, packageVersion) = item;

        Console.WriteLine(packageId + "@" + packageVersion);

Comment thread tools/ConfigFilesGenerator/Program.cs Outdated
Comment on lines +387 to +393
.Distinct(StringComparer.Ordinal)
.OrderBy(static id => id, StringComparer.Ordinal)
.ToArray();

// Stable, deterministic, collision-free within the referenced package set.
// Low range is reserved for known "core" analyzer packs.
var result = new Dictionary<string, int>(StringComparer.Ordinal);
Comment thread tools/ConfigFilesGenerator/Program.cs Outdated
Comment on lines +498 to +503

if (item.Type is DependencyType.NuGet && item.Name is not null &&
(item.Version is null || !item.Version.Contains("$(")))
(item.Version is null || !item.Version.Contains("$(", StringComparison.Ordinal)))
yield return (item.Name, item.Version);

foreach (var package in new[]
{
"Microsoft.CodeAnalysis.NetAnalyzers"
})
yield return (package, null);
// Pin analyzer package versions to the repo's declared .NET SDK version to keep
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Implemented in 5b85e59: the generator now resolves $(NetAnalyzersVersion) from src/Build/Common/Version.props (including property indirection like $(DotNetSdkVersion)) and fails fast if unresolved, so NetAnalyzers pinning is explicit/reproducible instead of drifting to latest. No UI changes in this PR (screenshot: N/A).

@claude
Copy link
Copy Markdown

claude Bot commented May 9, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

coderabbitai[bot]
coderabbitai Bot previously requested changes May 9, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/ANcpLua.Sdk.Tests/Helpers/SdkProjectBuilder.cs (1)

335-344: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Replace string-based XML mutation with proper XDocument parsing—silent injection failure when <Project> has attributes.

The content.Replace("<Project>", ...) pattern fails when the root element is <Project Sdk="..."> or any variant with attributes. Evidence in codebase shows <Project Sdk="{rootSdkName}"> is used, meaning DisableVersionAnalyzer injection silently skips for such content, breaking analyzer suppression guarantees in test projects.

Suggested refactor
 public new SdkProjectBuilder WithDirectoryBuildProps(string content)
 {
-    // Inject DisableVersionAnalyzer to prevent AL0017-AL0019 errors in test projects
-    var modifiedContent = content.Replace(
-        "<Project>",
-        """
-        <Project>
-            <PropertyGroup>
-                <DisableVersionAnalyzer>true</DisableVersionAnalyzer>
-            </PropertyGroup>
-        """,
-        StringComparison.Ordinal);
-    base.WithDirectoryBuildProps(modifiedContent);
+    var doc = XDocument.Parse(content, LoadOptions.PreserveWhitespace);
+    if (doc.Root is null || doc.Root.Name.LocalName != "Project")
+        throw new InvalidOperationException("Directory.Build.props must have a <Project> root element.");
+
+    doc.Root.AddFirst(
+        new XElement("PropertyGroup",
+            new XElement("DisableVersionAnalyzer", "true")));
+
+    base.WithDirectoryBuildProps(doc.ToString(SaveOptions.DisableFormatting));
     return this;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/ANcpLua.Sdk.Tests/Helpers/SdkProjectBuilder.cs` around lines 335 - 344,
The code currently does a string Replace on "<Project>" which fails when the
root <Project> has attributes (e.g., Sdk="..."); change the mutation in
SdkProjectBuilder.cs to parse the XML with XDocument.Parse(content), locate the
root XElement (doc.Root, typically named "Project"), create a new
XElement("PropertyGroup") containing XElement("DisableVersionAnalyzer", "true"),
insert it (use root.AddFirst(propertyGroup) to ensure it precedes other
content), then serialize the XDocument back to a string and pass that to
base.WithDirectoryBuildProps(modifiedContent); this guarantees injection even
when the <Project> element has attributes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Directory.Build.props`:
- Around line 6-13: The repo-level property overrides (ImplicitUsings,
Deterministic, EnableNETAnalyzers, AnalysisLevel) and the policy flags
(MSBuildTreatWarningsAsErrors, TreatWarningsAsErrors, EnforceCodeStyleInBuild)
must be made opt-out by adding Condition guards so they only set a value when
the project hasn’t already provided one; update each property to include a
Condition testing for an empty/undefined value (e.g.,
Condition="'$(ImplicitUsings)' == ''") and update each policy flag to combine
its existing release/CI condition with a check that the project hasn’t set it
(e.g., Condition="('$(MSBuildTreatWarningsAsErrors)' == '') AND
('$(ContinuousIntegrationBuild)' == 'true' OR '$(Configuration)' ==
'Release')"), referencing the exact property names ImplicitUsings,
Deterministic, EnableNETAnalyzers, AnalysisLevel, MSBuildTreatWarningsAsErrors,
TreatWarningsAsErrors, and EnforceCodeStyleInBuild.
- Around line 37-38: Add a condition guard and opt-out property so editorconfig
injection can be disabled by consumers: introduce a PropertyGroup with a
property like EnableEditorConfigDogfooding that defaults to true when unset
(Condition="'$(EnableEditorConfigDogfooding)'==''" set to "true"), then wrap the
existing ItemGroup/EditorConfigFiles entry with a Condition that checks
EnableEditorConfigDogfooding == 'true' so downstream projects can set that
property to false to opt out.

In `@tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs`:
- Line 130: The test currently checks for the forbidden flag with a trailing
space which can miss occurrences at end-of-string; update the assertion in
MtpDetectionTests (the Assert.DoesNotContain call that checks cliArgs) to look
for the token "--report-trx" (no trailing space) so the forbidden flag is
detected whether it appears mid-string or at the end; leave the
StringComparison.Ordinal argument unchanged.

In `@tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs`:
- Around line 33-36: Remove the CA2000 SuppressMessage attribute applied to the
helper (the attribute shown above) and instead make disposal ownership explicit
where SdkProjectBuilder.Create(...) is called: update each caller (e.g., tests
MtpDetectionTests, SdkTests, and SourceGeneratorDefaultsTests) to use "await
using var project = SdkProjectBuilder.Create(...);" so the returned builder is
disposed by the test; ensure no helper-level suppressions remain and adjust call
sites to own the async disposal.

In `@tools/ConfigFilesGenerator/Program.cs`:
- Around line 59-62: Move the const CompilerAnalyzerConfigGlobalLevel so it is
declared before any use: place the const declaration above the first method that
references it (i.e., before GenerateEditorConfigForCompilerAnalyzers) and remove
the later duplicate declaration at line 377; ensure callers that reference
CompilerAnalyzerConfigGlobalLevel (e.g., in
GenerateEditorConfigForCompilerAnalyzers where it's used to append
"global_level") still compile against the single, earlier declaration.
- Around line 420-423: The bare catch that returns null in Program.cs is
swallowing XML parsing exceptions (the try/catch that returns null when reading
Version.props); change it to catch (Exception ex) instead and log a warning with
the exception details before returning null (use the existing logger if
available or Console.Error/Console.WriteLine) so malformed Version.props parsing
failures are visible to build authors.

---

Outside diff comments:
In `@tests/ANcpLua.Sdk.Tests/Helpers/SdkProjectBuilder.cs`:
- Around line 335-344: The code currently does a string Replace on "<Project>"
which fails when the root <Project> has attributes (e.g., Sdk="..."); change the
mutation in SdkProjectBuilder.cs to parse the XML with XDocument.Parse(content),
locate the root XElement (doc.Root, typically named "Project"), create a new
XElement("PropertyGroup") containing XElement("DisableVersionAnalyzer", "true"),
insert it (use root.AddFirst(propertyGroup) to ensure it precedes other
content), then serialize the XDocument back to a string and pass that to
base.WithDirectoryBuildProps(modifiedContent); this guarantees injection even
when the <Project> element has attributes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9e7a7085-b132-4f46-82f2-94c51151258f

📥 Commits

Reviewing files that changed from the base of the PR and between 150ce94 and e250b9f.

⛔ Files ignored due to path filters (1)
  • .editorconfig is excluded by none and included by none
📒 Files selected for processing (17)
  • Directory.Build.props
  • src/Config/ANcpLua.NET.Sdk.SingleFileApp.editorconfig
  • src/Config/ANcpLua.NET.Sdk.Web.editorconfig
  • src/Config/Analyzer.ANcpLua.Analyzers.editorconfig
  • src/Config/Analyzer.Microsoft.CodeAnalysis.Analyzers.editorconfig
  • src/Config/Analyzer.Microsoft.CodeAnalysis.BannedApiAnalyzers.editorconfig
  • src/Config/Analyzer.Microsoft.CodeAnalysis.NetAnalyzers.editorconfig
  • src/Config/CodingStyle.editorconfig
  • src/Config/Compiler.editorconfig
  • src/Config/Global.editorconfig
  • src/Config/NamingConvention.editorconfig
  • tests/ANcpLua.Sdk.Tests/Helpers/SdkProjectBuilder.cs
  • tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs
  • tests/ANcpLua.Sdk.Tests/SdkTests.cs
  • tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs
  • tests/ANcpLua.Sdk.Tests/TemplatesTests.cs
  • tools/ConfigFilesGenerator/Program.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: test (ubuntu-latest)
  • GitHub Check: test (windows-latest)
  • GitHub Check: test (macos-latest)
  • GitHub Check: Agent
🧰 Additional context used
📓 Path-based instructions (3)
**/*.props

⚙️ CodeRabbit configuration file

**/*.props: MSBuild property files. Review for: condition guards on every override
(consumer must be able to opt out), no <RemoveAttributes> on items
that consumers may have set, and that defaults are sensible without
forcing a downstream cascade.

Files:

  • Directory.Build.props
tests/**/*.cs

⚙️ CodeRabbit configuration file

tests/**/*.cs: xUnit + FluentAssertions. AAA pattern. NSubstitute for mocks.
Flag: blocking-async patterns (Task.Run(() => x.Result)), missing
async Task (sync-void), Thread.Sleep instead of await Task.Delay,
tests asserting on private state via reflection.

Files:

  • tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs
  • tests/ANcpLua.Sdk.Tests/TemplatesTests.cs
  • tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs
  • tests/ANcpLua.Sdk.Tests/Helpers/SdkProjectBuilder.cs
  • tests/ANcpLua.Sdk.Tests/SdkTests.cs
tools/**

⚙️ CodeRabbit configuration file

tools/**: Internal tooling — config file generators, build helpers. Lower bar than
production src/, but still flag obvious bugs (missing null check that
crashes the build, hardcoded paths, swallowed exceptions).

Files:

  • tools/ConfigFilesGenerator/Program.cs
🪛 GitHub Check: lint_config
tools/ConfigFilesGenerator/Program.cs

[failure] 62-62:
Cannot use local variable 'CompilerAnalyzerConfigGlobalLevel' before it is declared


[warning] 377-377:
Unreachable code detected

🔇 Additional comments (16)
src/Config/NamingConvention.editorconfig (1)

2-2: LGTM.

Precedence value 20 slots correctly between generated analyzer configs (10–13) and CodingStyle (30).

src/Config/Global.editorconfig (1)

2-2: LGTM.

global_level = 50 correctly establishes this as the highest-precedence SDK-shipped global config.

src/Config/Analyzer.ANcpLua.Analyzers.editorconfig (1)

1-4: LGTM.

global_level = 13 aligns with the generator's stable mapping. Comment clarifies the conflict-avoidance rationale.

src/Config/Analyzer.Microsoft.CodeAnalysis.NetAnalyzers.editorconfig (1)

1-4: LGTM.

global_level = 11 is deterministic per the generator. Rule removals reflect the current analyzer assembly state.

src/Config/Analyzer.Microsoft.CodeAnalysis.BannedApiAnalyzers.editorconfig (1)

1-4: LGTM.

global_level = 12 matches the generator's stable assignment.

src/Config/Analyzer.Microsoft.CodeAnalysis.Analyzers.editorconfig (1)

1-4: LGTM.

global_level = 10 is the lowest in the analyzer-config tier, correct per generator mapping.

src/Config/CodingStyle.editorconfig (2)

2-6: LGTM.

global_level = 30 correctly slots between NamingConvention and Compiler configs. Comment clarifies the file's role as a global AnalyzerConfig.


67-67: LGTM.

Correct option name: csharp_style_prefer_local_over_anonymous_function is the canonical Roslyn property.

tools/ConfigFilesGenerator/Program.cs (3)

379-403: LGTM.

GetAnalyzerConfigGlobalLevels provides stable, deterministic precedence mapping. The fallback 1000 + i ensures unknown packages get unique levels without colliding with the reserved range.


405-424: SDK version extraction logic is sound.

Correctly reads <DotNetSdkVersion> from Version.props and gracefully degrades when unavailable.


498-508: LGTM.

Pinning Microsoft.CodeAnalysis.NetAnalyzers to the repo's SDK version eliminates "latest stable" drift and keeps generated configs reproducible.

src/Config/Compiler.editorconfig (1)

1-4: Deterministic global precedence looks correct.

The explicit precedence comment + global_level = 40 is clear and aligns with deterministic analyzer-config ordering.

src/Config/ANcpLua.NET.Sdk.Web.editorconfig (1)

1-3: Precedence bump is coherent and deterministic.

global_level = 60 with the explicit intent note is consistent with the repo-wide ordering strategy.

src/Config/ANcpLua.NET.Sdk.SingleFileApp.editorconfig (1)

1-3: Ordering update is good.

global_level = 61 cleanly establishes intended precedence for this config.

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

81-82: String-comparison hardening is solid.

Using explicit StringComparison.Ordinal on these content assertions improves determinism and avoids locale-sensitive drift in template validation tests.

Also applies to: 141-142, 153-155, 185-188, 211-211, 244-247

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

79-79: These correctness tweaks look good.

Ordinal comparison usage and the scoped PEReader disposal improve determinism/resource hygiene without changing test intent.

Also applies to: 1048-1048, 1340-1340

Comment thread Directory.Build.props Outdated
Comment thread Directory.Build.props
Comment thread tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs Outdated
Comment thread tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs Outdated
Comment thread tools/ConfigFilesGenerator/Program.cs
Comment thread tools/ConfigFilesGenerator/Program.cs Outdated
Copilot AI review requested due to automatic review settings May 9, 2026 10:36
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

@coderabbitai autofix

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 9, 2026

Note

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

The agent ran but didn't make any changes. The issues may already be fixed or require manual intervention.

@ANcpLua ANcpLua force-pushed the fix/refix-codestyle-policy-pass branch from d0411ea to b6e83a8 Compare May 9, 2026 10:36
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

@coderabbitai autofix

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.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Comment thread tools/ConfigFilesGenerator/Program.cs Outdated
Comment on lines +614 to +620
// Skip duplicate top-level package IDs we've already yielded; the same
// package showing up in multiple projects in src/ shouldn't fan out
// into repeated NuGet work. Don't mark the ID as seen yet — only after
// we've successfully resolved its version, so that a first sighting
// with an unresolved $(...) doesn't lock out the pinned fallback.
if (emittedIds.Contains(item.Name))
continue;
Comment on lines +435 to +453
var result = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
for (var i = 0; i < orderedIds.Length; i++)
{
var id = orderedIds[i];
result[id] = id switch
{
_ when string.Equals(id, "Microsoft.CodeAnalysis.Analyzers", StringComparison.OrdinalIgnoreCase) => 10,
_ when string.Equals(id, "Microsoft.CodeAnalysis.NetAnalyzers", StringComparison.OrdinalIgnoreCase) => 11,
_ when string.Equals(id, "Microsoft.CodeAnalysis.BannedApiAnalyzers", StringComparison.OrdinalIgnoreCase) => 12,
_ when string.Equals(id, "ANcpLua.Analyzers", StringComparison.OrdinalIgnoreCase) => 13,
_ when string.Equals(id, "AwesomeAssertions.Analyzers", StringComparison.OrdinalIgnoreCase) => 14,
// xunit.analyzers ships as a transitive of xunit.v3 (resolved via Version.props
// property expansion). Reserved so its config doesn't churn when the package set shifts.
_ when string.Equals(id, "xunit.analyzers", StringComparison.OrdinalIgnoreCase) => 15,
_ => 1000 + i
};
}

return result;
GetReferencedNuGetPackages was deduping by package id alone, so when
the same id appeared with different versions (e.g. Microsoft.CodeAnalysis.CSharp
without a version in src/*.csproj plus a VersionOverride in
SourceGenerators.targets) the first sighting won and later occurrences
got dropped before the downstream highest-version dedup could see them.
Switch the early-skip to an (id, resolved-version) tuple via a small
file-scoped comparer so identical (id, version) pairs are still pruned
but distinct versions of the same id flow through.

GetAnalyzerConfigGlobalLevels was assigning the non-reserved fallback
as 1000+i, where i indexed into the full alphabetically-sorted package
list. Adding or removing any unrelated package shifted i and re-numbered
every later entry's level, churning the regenerated configs. Derive the
fallback from a deterministic FNV-1a hash of the package id (uppercased
UTF-8) reduced into [1000,9999], with linear-probe collision resolution
that wraps inside the same range. Stable IDs keep their level when
unrelated packages join or leave; collisions only renumber the colliding
neighbor.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

@coderabbitai autofix

@claude
Copy link
Copy Markdown

claude Bot commented May 10, 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 10, 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.

coderabbitai[bot]
coderabbitai Bot previously requested changes May 10, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (4)
tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs (1)

1-1: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Blocking: this helper suppression still violates the no-suppressions path for CA2000.

CreateProject() is still hiding the ownership transfer instead of making it explicit. Inline SdkProjectBuilder.Create(...) at the await using sites in this file and remove the SuppressMessage/import, otherwise the CA2000 warning remains suppressed rather than fixed.

Also applies to: 33-36

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs` at line 1,
CreateProject() is hiding ownership transfer and keeps CA2000 suppressed;
replace calls to SdkProjectBuilder.Create(...) by inlining its object
construction directly at each await using site in SourceGeneratorDefaultsTests
(remove the helper CreateProject method and its using/import of
SuppressMessage), ensure each disposable resource is created in the await using
statement so ownership is explicit (e.g., await using var builder = new
SdkProjectBuilder(...)), and delete the SuppressMessage/using
System.Diagnostics.CodeAnalysis import so CA2000 is no longer suppressed.
tests/ANcpLua.Sdk.Tests/SdkTests.cs (1)

1-1: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Blocking: the shared test-builder helper is still suppressing CA2000.

This keeps the analyzer exception alive across the biggest test surface in the PR. To actually satisfy the objective, replace await using var project = CreateProject(...); with direct SdkProjectBuilder.Create(...).WithDotnetSdkVersion(...).RecordProperties(...) ownership at the test call sites in this file, then remove the helper suppression and System.Diagnostics.CodeAnalysis import.

Also applies to: 41-46

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/ANcpLua.Sdk.Tests/SdkTests.cs` at line 1, Tests still rely on the
shared helper that suppresses CA2000; replace each usage like "await using var
project = CreateProject(...);" in SdkTests.cs with explicit ownership by calling
SdkProjectBuilder.Create(...).WithDotnetSdkVersion(...).RecordProperties(...)
directly at the test call sites so the test owns disposal, then remove the
helper suppression and the System.Diagnostics.CodeAnalysis using. Update all
occurrences (including the ones around lines 41–46) to use the SdkProjectBuilder
fluent chain and delete the unnecessary suppression/import.
tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs (1)

1-1: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Blocking: remove the helper-level CA2000 suppression.

This still suppresses analyzer dogfooding in a test file the PR is supposed to harden. The fix needs to be at the ownership boundary: stop routing disposal through CreateProject(...) here, inline SdkProjectBuilder.Create(...).WithDotnetSdkVersion(...).RecordProperties(...) at the await using var project = ... call sites in this file, then drop the attribute and System.Diagnostics.CodeAnalysis import. The current suppression is also one of the pipeline warnings.

Also applies to: 46-49

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs` at line 1, Remove the
helper-level CA2000 suppression and the System.Diagnostics.CodeAnalysis using;
stop routing disposal through CreateProject(...) by inlining the builder chain
at each await using var project = ... call site in this file: replace calls that
use CreateProject(...) with
SdkProjectBuilder.Create(...).WithDotnetSdkVersion(...).RecordProperties(...)
directly so the project is created and disposed at the ownership boundary, then
delete the suppression attribute and unused import; ensure every location that
previously called CreateProject(...) now constructs the project inline so
analyzers see correct disposal.
tools/ConfigFilesGenerator/Program.cs (1)

489-498: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don’t let Version.props parse failures abort the generator.

XDocument.Load(versionPropsPath) is unguarded now. Any malformed XML or transient conflict in src/Build/Common/Version.props will throw and stop config generation, but the requested behavior here was “warn and fall back.” Wrap the load in catch (Exception ex), log to stderr, and return an empty property map instead of crashing the tool.

Proposed fix
 static IReadOnlyDictionary<string, string> LoadMsBuildProperties(FullPath rootFolder)
 {
     var versionPropsPath = rootFolder / "src" / "Build" / "Common" / "Version.props";
     if (!File.Exists(versionPropsPath))
         return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
-    var doc = XDocument.Load(versionPropsPath);
+    XDocument doc;
+    try
+    {
+        doc = XDocument.Load(versionPropsPath);
+    }
+    catch (Exception ex)
+    {
+        Console.Error.WriteLine($"Warning: failed to load '{versionPropsPath}': {ex}");
+        return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+    }
+
     var root = doc.Root;
     if (root is null)
         return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

As per coding guidelines, tools/**: "Internal tooling — config file generators, build helpers. Lower bar than production src/, but still flag obvious bugs (missing null check that crashes the build, hardcoded paths, swallowed exceptions)."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/ConfigFilesGenerator/Program.cs` around lines 489 - 498, In
LoadMsBuildProperties, guard the XDocument.Load(versionPropsPath) call so a
malformed or missing Version.props does not crash the generator: wrap the load
in a try/catch(Exception ex), on exception write a warning including ex.Message
to stderr (e.g., Console.Error) and return an empty
Dictionary<string,string>(StringComparer.OrdinalIgnoreCase); keep existing
null-root handling intact; this ensures failures in
XDocument.Load/versionPropsPath are logged and the method falls back safely.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Directory.Build.props`:
- Around line 41-47: The ItemGroup is guarded by the wrong MSBuild property;
change the property that defines the opt-out/default from
EnableRepoDogfoodEditorConfigs to the public contract
EnableEditorConfigDogfooding so downstream consumers can opt out as intended:
update the <PropertyGroup> default definition and the ItemGroup Condition that
currently reference EnableRepoDogfoodEditorConfigs to use
EnableEditorConfigDogfooding, keeping the same default value/logic and the
EditorConfigFiles Include/Exclude entries unchanged.

---

Duplicate comments:
In `@tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs`:
- Line 1: Remove the helper-level CA2000 suppression and the
System.Diagnostics.CodeAnalysis using; stop routing disposal through
CreateProject(...) by inlining the builder chain at each await using var project
= ... call site in this file: replace calls that use CreateProject(...) with
SdkProjectBuilder.Create(...).WithDotnetSdkVersion(...).RecordProperties(...)
directly so the project is created and disposed at the ownership boundary, then
delete the suppression attribute and unused import; ensure every location that
previously called CreateProject(...) now constructs the project inline so
analyzers see correct disposal.

In `@tests/ANcpLua.Sdk.Tests/SdkTests.cs`:
- Line 1: Tests still rely on the shared helper that suppresses CA2000; replace
each usage like "await using var project = CreateProject(...);" in SdkTests.cs
with explicit ownership by calling
SdkProjectBuilder.Create(...).WithDotnetSdkVersion(...).RecordProperties(...)
directly at the test call sites so the test owns disposal, then remove the
helper suppression and the System.Diagnostics.CodeAnalysis using. Update all
occurrences (including the ones around lines 41–46) to use the SdkProjectBuilder
fluent chain and delete the unnecessary suppression/import.

In `@tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs`:
- Line 1: CreateProject() is hiding ownership transfer and keeps CA2000
suppressed; replace calls to SdkProjectBuilder.Create(...) by inlining its
object construction directly at each await using site in
SourceGeneratorDefaultsTests (remove the helper CreateProject method and its
using/import of SuppressMessage), ensure each disposable resource is created in
the await using statement so ownership is explicit (e.g., await using var
builder = new SdkProjectBuilder(...)), and delete the SuppressMessage/using
System.Diagnostics.CodeAnalysis import so CA2000 is no longer suppressed.

In `@tools/ConfigFilesGenerator/Program.cs`:
- Around line 489-498: In LoadMsBuildProperties, guard the
XDocument.Load(versionPropsPath) call so a malformed or missing Version.props
does not crash the generator: wrap the load in a try/catch(Exception ex), on
exception write a warning including ex.Message to stderr (e.g., Console.Error)
and return an empty Dictionary<string,string>(StringComparer.OrdinalIgnoreCase);
keep existing null-root handling intact; this ensures failures in
XDocument.Load/versionPropsPath are logged and the method falls back safely.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2e74a574-0768-4d6d-b689-375af37d4aaf

📥 Commits

Reviewing files that changed from the base of the PR and between 67a10f2 and d517b7e.

📒 Files selected for processing (5)
  • Directory.Build.props
  • tests/ANcpLua.Sdk.Tests/MtpDetectionTests.cs
  • tests/ANcpLua.Sdk.Tests/SdkTests.cs
  • tests/ANcpLua.Sdk.Tests/SourceGeneratorDefaultsTests.cs
  • tools/ConfigFilesGenerator/Program.cs
📜 Review details
🧰 Additional context used
📓 Path-based instructions (3)
tests/**/*.cs

⚙️ CodeRabbit configuration file

tests/**/*.cs: xUnit + FluentAssertions. AAA pattern. NSubstitute for mocks.
Flag: blocking-async patterns (Task.Run(() => x.Result)), missing
async Task (sync-void), Thread.Sleep instead of await Task.Delay,
tests asserting on private state via reflection.

Files:

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

⚙️ CodeRabbit configuration file

**/*.props: MSBuild property files. Review for: condition guards on every override
(consumer must be able to opt out), no <RemoveAttributes> on items
that consumers may have set, and that defaults are sensible without
forcing a downstream cascade.

Files:

  • Directory.Build.props
tools/**

⚙️ CodeRabbit configuration file

tools/**: Internal tooling — config file generators, build helpers. Lower bar than
production src/, but still flag obvious bugs (missing null check that
crashes the build, hardcoded paths, swallowed exceptions).

Files:

  • tools/ConfigFilesGenerator/Program.cs
🪛 GitHub Actions: Claude Code Review / 0_claude-review.txt
tests/ANcpLua.Sdk.Tests/SdkTests.cs

[error] 1-1: No Datetime.Now/Utcnow check failed: three DateTime.Now instances lack required inline comments (policy RS0030).

tools/ConfigFilesGenerator/Program.cs

[error] 62-62: lint_config failed: Cannot use local variable 'CompilerAnalyzerConfigGlobalLevel' before it is declared.


[warning] 377-377: lint_config warning: Unreachable code detected.

🪛 GitHub Actions: Claude Code Review / claude-review
tests/ANcpLua.Sdk.Tests/SdkTests.cs

[error] 1-1: No Datetime.Now/Utcnow check failed: three DateTime.Now instances lack required inline comments (policy RS0030).


[warning] 1-1: No Suppression Of Fixable Diagnostics: 3 CA2000 suppressions added in test files not matching documented allowlist from .github/copilot-instructions.md.

tools/ConfigFilesGenerator/Program.cs

[error] 62-62: lint_config failed: Cannot use local variable 'CompilerAnalyzerConfigGlobalLevel' before it is declared.


[warning] 377-377: lint_config warning: Unreachable code detected.

Comment thread Directory.Build.props
The earlier reviewer guidance asked for the public opt-out switch to
be EnableEditorConfigDogfooding, but the PropertyGroup and ItemGroup
shipped with EnableRepoDogfoodEditorConfigs, so a consumer setting the
documented name to false still got the repo editorconfigs injected.
Rename both the default-definition and the ItemGroup Condition to the
contract name.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 10, 2026 06:31
@github-actions
Copy link
Copy Markdown

@coderabbitai autofix

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 10, 2026

Note

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

The agent ran but didn't make any changes. The issues may already be fixed or require manual intervention.

@claude
Copy link
Copy Markdown

claude Bot commented May 10, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

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.

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.

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.

Pull request overview

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

Comment on lines 602 to 603
static async Task ListAllPackageDependencies(
PackageIdentity package,
ListAllPackageDependencies's early-exit was 'dependencies.Contains(package)'
where dependencies is HashSet<SourcePackageDependencyInfo> and package is
PackageIdentity. The call did compile (IEnumerable<T> covariance lets the
LINQ Contains extension bind with TSource=PackageIdentity), but it
silently degraded to an O(n) linear scan because the set's hash bucket
lookup is keyed on SourcePackageDependencyInfo rather than PackageIdentity,
and intent was muddled. Add a separate HashSet<PackageIdentity> with
PackageIdentityComparer.Default; the early-exit is now an explicit O(1)
hash lookup with the right comparer, and the existing
HashSet<SourcePackageDependencyInfo> stays focused on accumulating the
resolved dependency infos for downstream use.

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

@coderabbitai autofix

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 10, 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.

@claude
Copy link
Copy Markdown

claude Bot commented May 10, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

@ANcpLua ANcpLua dismissed stale reviews from coderabbitai[bot], coderabbitai[bot], coderabbitai[bot], coderabbitai[bot], coderabbitai[bot], coderabbitai[bot], coderabbitai[bot], and coderabbitai[bot] May 10, 2026 08:45

Dismissing stale bot CHANGES_REQUESTED review: subsequent commits addressed the actionable items and the publish workflow is green (lint_config + tests).

@ancplua-automerge ancplua-automerge Bot merged commit 3d4704c into main May 10, 2026
16 checks passed
@ancplua-automerge ancplua-automerge Bot deleted the fix/refix-codestyle-policy-pass branch May 10, 2026 08:46
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.

3 participants