Skip to content

Commit 26ff773

Browse files
authored
Reintroduce CargoSBOM detector experiments (#1463)
1 parent e53a7eb commit 26ff773

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace Microsoft.ComponentDetection.Orchestrator.Experiments.Configs;
2+
3+
using Microsoft.ComponentDetection.Contracts;
4+
using Microsoft.ComponentDetection.Detectors.Rust;
5+
6+
/// <summary>
7+
/// Validating the Rust SBOM detector against the Rust CLI detector.
8+
/// </summary>
9+
public class RustSbomVsCliExperiment : IExperimentConfiguration
10+
{
11+
/// <inheritdoc />
12+
public string Name => "RustSbomVsCliExperiment";
13+
14+
/// <inheritdoc/>
15+
public bool IsInControlGroup(IComponentDetector componentDetector) => componentDetector is RustCliDetector;
16+
17+
/// <inheritdoc/>
18+
public bool IsInExperimentGroup(IComponentDetector componentDetector) => componentDetector is RustSbomDetector;
19+
20+
/// <inheritdoc />
21+
public bool ShouldRecord(IComponentDetector componentDetector, int numComponents) => true;
22+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace Microsoft.ComponentDetection.Orchestrator.Experiments.Configs;
2+
3+
using Microsoft.ComponentDetection.Contracts;
4+
using Microsoft.ComponentDetection.Detectors.Rust;
5+
6+
/// <summary>
7+
/// Validating the Rust SBOM detector against the Rust crate detector.
8+
/// </summary>
9+
public class RustSbomVsCrateExperiment : IExperimentConfiguration
10+
{
11+
/// <inheritdoc />
12+
public string Name => "RustSbomVsCrateExperiment";
13+
14+
/// <inheritdoc/>
15+
public bool IsInControlGroup(IComponentDetector componentDetector) => componentDetector is RustCrateDetector;
16+
17+
/// <inheritdoc/>
18+
public bool IsInExperimentGroup(IComponentDetector componentDetector) => componentDetector is RustSbomDetector;
19+
20+
/// <inheritdoc />
21+
public bool ShouldRecord(IComponentDetector componentDetector, int numComponents) => true;
22+
}

src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public static IServiceCollection AddComponentDetection(this IServiceCollection s
6565
services.AddSingleton<IExperimentService, ExperimentService>();
6666
services.AddSingleton<IExperimentProcessor, DefaultExperimentProcessor>();
6767
services.AddSingleton<IExperimentConfiguration, SimplePipExperiment>();
68+
services.AddSingleton<IExperimentConfiguration, RustSbomVsCliExperiment>();
69+
services.AddSingleton<IExperimentConfiguration, RustSbomVsCrateExperiment>();
6870
services.AddSingleton<IExperimentConfiguration, UvLockDetectorExperiment>();
6971

7072
// Detectors

0 commit comments

Comments
 (0)