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

@@ -4,6 +4,7 @@ using StellaOps.Scanner.Analyzers.Lang;
using StellaOps.Scanner.Analyzers.Lang.Ruby;
using StellaOps.Scanner.Analyzers.Lang.Tests.TestUtilities;
using StellaOps.TestKit;
namespace StellaOps.Scanner.Analyzers.Lang.Ruby.Tests;
/// <summary>
@@ -18,7 +19,8 @@ public sealed class RubyBenchmarks
private const int BenchmarkIterations = 10;
private const int MaxAnalysisTimeMs = 1000;
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task SimpleApp_MeetsPerformanceTargetAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "simple-app");
@@ -47,7 +49,8 @@ public sealed class RubyBenchmarks
avgMs.Should().BeLessThan(MaxAnalysisTimeMs, $"Simple app analysis should complete in <{MaxAnalysisTimeMs}ms including policy scanning (actual: {avgMs:F2}ms)");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ComplexApp_MeetsPerformanceTargetAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "complex-app");
@@ -76,7 +79,8 @@ public sealed class RubyBenchmarks
avgMs.Should().BeLessThan(MaxAnalysisTimeMs, $"Complex app analysis should complete in <{MaxAnalysisTimeMs}ms including policy scanning (actual: {avgMs:F2}ms)");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task RailsApp_MeetsPerformanceTargetAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "rails-app");
@@ -105,7 +109,8 @@ public sealed class RubyBenchmarks
avgMs.Should().BeLessThan(MaxAnalysisTimeMs, $"Rails app analysis should complete in <{MaxAnalysisTimeMs}ms including policy scanning (actual: {avgMs:F2}ms)");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task SinatraApp_MeetsPerformanceTargetAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "sinatra-app");
@@ -134,7 +139,8 @@ public sealed class RubyBenchmarks
avgMs.Should().BeLessThan(MaxAnalysisTimeMs, $"Sinatra app analysis should complete in <{MaxAnalysisTimeMs}ms including policy scanning (actual: {avgMs:F2}ms)");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ContainerApp_MeetsPerformanceTargetAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "container-app");
@@ -163,7 +169,8 @@ public sealed class RubyBenchmarks
avgMs.Should().BeLessThan(MaxAnalysisTimeMs, $"Container app analysis should complete in <{MaxAnalysisTimeMs}ms including policy scanning (actual: {avgMs:F2}ms)");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task LegacyApp_MeetsPerformanceTargetAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "legacy-app");
@@ -192,7 +199,8 @@ public sealed class RubyBenchmarks
avgMs.Should().BeLessThan(MaxAnalysisTimeMs, $"Legacy app analysis should complete in <{MaxAnalysisTimeMs}ms including policy scanning (actual: {avgMs:F2}ms)");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task CliApp_MeetsPerformanceTargetAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "cli-app");
@@ -221,7 +229,8 @@ public sealed class RubyBenchmarks
avgMs.Should().BeLessThan(MaxAnalysisTimeMs, $"CLI app analysis should complete in <{MaxAnalysisTimeMs}ms including policy scanning (actual: {avgMs:F2}ms)");
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task MultipleRuns_ProduceDeterministicResultsAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "simple-app");

View File

@@ -5,11 +5,14 @@ using StellaOps.Scanner.Analyzers.Lang.Tests.Harness;
using StellaOps.Scanner.Analyzers.Lang.Tests.TestUtilities;
using StellaOps.Scanner.Core.Contracts;
using StellaOps.TestKit;
namespace StellaOps.Scanner.Analyzers.Lang.Ruby.Tests;
public sealed class RubyLanguageAnalyzerTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task SimpleWorkspaceProducesDeterministicOutputAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "simple-app");
@@ -23,7 +26,8 @@ public sealed class RubyLanguageAnalyzerTests
TestContext.Current.CancellationToken);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task AnalyzerEmitsObservationPayloadWithSummaryAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "simple-app");
@@ -73,7 +77,8 @@ public sealed class RubyLanguageAnalyzerTests
Assert.Equal("2.4.22", root.GetProperty("bundledWith").GetString());
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ComplexWorkspaceProducesDeterministicOutputAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "complex-app");
@@ -87,7 +92,8 @@ public sealed class RubyLanguageAnalyzerTests
TestContext.Current.CancellationToken);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task CliWorkspaceProducesDeterministicOutputAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "cli-app");
@@ -101,7 +107,8 @@ public sealed class RubyLanguageAnalyzerTests
TestContext.Current.CancellationToken);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task RailsWorkspaceProducesDeterministicOutputAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "rails-app");
@@ -115,7 +122,8 @@ public sealed class RubyLanguageAnalyzerTests
TestContext.Current.CancellationToken);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task SinatraWorkspaceProducesDeterministicOutputAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "sinatra-app");
@@ -129,7 +137,8 @@ public sealed class RubyLanguageAnalyzerTests
TestContext.Current.CancellationToken);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ContainerWorkspaceProducesDeterministicOutputAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "container-app");
@@ -143,7 +152,8 @@ public sealed class RubyLanguageAnalyzerTests
TestContext.Current.CancellationToken);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ContainerWorkspaceDetectsRubyVersionAndNativeExtensionsAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "container-app");
@@ -185,7 +195,8 @@ public sealed class RubyLanguageAnalyzerTests
Assert.True(nativeExtensions.GetArrayLength() >= 2);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task LegacyWorkspaceProducesDeterministicOutputAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "legacy-app");
@@ -199,7 +210,8 @@ public sealed class RubyLanguageAnalyzerTests
TestContext.Current.CancellationToken);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task LegacyWorkspaceDetectsCapabilitiesWithoutBundlerAsync()
{
var fixturePath = TestPaths.ResolveFixture("lang", "ruby", "legacy-app");

View File

@@ -35,6 +35,7 @@
<ProjectReference Include="../../__Libraries/StellaOps.Scanner.Analyzers.Lang/StellaOps.Scanner.Analyzers.Lang.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.Scanner.Analyzers.Lang.Ruby/StellaOps.Scanner.Analyzers.Lang.Ruby.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.Scanner.Core/StellaOps.Scanner.Core.csproj" />
<ProjectReference Include="../../../__Libraries/StellaOps.TestKit/StellaOps.TestKit.csproj" />
</ItemGroup>
<ItemGroup>