Refactor code structure and optimize performance across multiple modules

This commit is contained in:
StellaOps Bot
2025-12-26 20:03:22 +02:00
parent c786faae84
commit b4fc66feb6
3353 changed files with 88254 additions and 1590657 deletions

View File

@@ -10,16 +10,19 @@ using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Testing;
using Microsoft.CodeAnalysis.Testing;
using StellaOps.Determinism.Analyzers;
using StellaOps.TestKit;
using Xunit;
namespace StellaOps.Determinism.Analyzers.Tests;
public class CanonicalizationBoundaryAnalyzerTests
{
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task JsonSerialize_InDigestMethod_ReportsDiagnostic()
{
var testCode = """
using System;
using System.Text.Json;
using System.Security.Cryptography;
using System.Text;
@@ -35,12 +38,13 @@ public class CanonicalizationBoundaryAnalyzerTests
""";
var expected = new DiagnosticResult(CanonicalizationBoundaryAnalyzer.DiagnosticId, DiagnosticSeverity.Warning)
.WithSpan(9, 24, 9, 54)
.WithSpan(10, 20, 10, 50)
.WithArguments("ComputeDigest");
await VerifyAsync(testCode, expected);
}
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task JsonSerialize_InRegularMethod_NoDiagnostic()
{
@@ -59,10 +63,12 @@ public class CanonicalizationBoundaryAnalyzerTests
await VerifyAsync(testCode);
}
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task JsonSerialize_WithCanonicalizerField_NoDiagnostic()
{
var testCode = """
using System;
using System.Text.Json;
using System.Security.Cryptography;
using System.Text;
@@ -87,10 +93,12 @@ public class CanonicalizationBoundaryAnalyzerTests
await VerifyAsync(testCode);
}
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task DictionaryForeach_InDigestMethod_ReportsDiagnostic()
{
var testCode = """
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
@@ -111,12 +119,13 @@ public class CanonicalizationBoundaryAnalyzerTests
""";
var expected = new DiagnosticResult(CanonicalizationBoundaryAnalyzer.CollectionDiagnosticId, DiagnosticSeverity.Warning)
.WithSpan(10, 30, 10, 35)
.WithSpan(11, 30, 11, 35)
.WithArguments("ComputeHash");
await VerifyAsync(testCode, expected);
}
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task DictionaryForeach_WithOrderBy_NoDiagnostic()
{
@@ -145,10 +154,12 @@ public class CanonicalizationBoundaryAnalyzerTests
await VerifyAsync(testCode);
}
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task FrozenDictionaryForeach_NoDiagnostic()
{
var testCode = """
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Security.Cryptography;
@@ -172,6 +183,7 @@ public class CanonicalizationBoundaryAnalyzerTests
await VerifyAsync(testCode);
}
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task JsonSerialize_InResolverClass_ReportsDiagnostic()
{
@@ -194,6 +206,7 @@ public class CanonicalizationBoundaryAnalyzerTests
await VerifyAsync(testCode, expected);
}
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task JsonSerialize_InAttestorClass_ReportsDiagnostic()
{

View File

@@ -7,6 +7,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<RootNamespace>StellaOps.Determinism.Analyzers.Tests</RootNamespace>
<UseConcelierTestInfra>false</UseConcelierTestInfra>
</PropertyGroup>
<ItemGroup>
@@ -22,5 +23,6 @@
<ItemGroup>
<ProjectReference Include="..\StellaOps.Determinism.Analyzers\StellaOps.Determinism.Analyzers.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.TestKit/StellaOps.TestKit.csproj" />
</ItemGroup>
</Project>