From 545a7a2f4eaf4ce79dbebf25f51fb02e9118de86 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Thu, 5 Mar 2026 21:02:31 -0800 Subject: [PATCH] refactor: make Common implementation details internal Make ~50 classes internal in the Common project: - Telemetry records (~34 concrete classes): NuGetProjectAssetsTelemetryRecord, PyPiCacheTelemetryRecord, LinuxScannerTelemetryRecord, etc. Kept BaseDetectionTelemetryRecord public for external subclassing. - Utility classes: Column, TabularStringFormat, ComponentComparer, DependencyScopeComparer, DirectoryItemFacade(Optimized) - Docker reference exceptions (11 classes) - Concrete service implementations: CommandLineInvocationService, EnvironmentVariableService, PathUtilityService, FileUtilityService, DirectoryUtilityService, DockerService, ConsoleWritingService, SafeFileEnumerableFactory, ComponentStreamEnumerableFactory, FastDirectoryWalkerFactory Kept public: FileWritingService, ComponentStream, LazyComponentStream, ComponentRecorder, CommandLineInvocationResult, CommandLineTelemetryService, BaseDetectionTelemetryRecord, and all interfaces. Part of #455 --- .../Column.cs | 2 +- .../CommandLineInvocationService.cs | 2 +- .../ComponentComparer.cs | 2 +- .../ComponentStreamEnumerableFactory.cs | 2 +- .../ConsoleWritingService.cs | 2 +- .../DependencyScopeComparer.cs | 2 +- .../DirectoryItemFacade.cs | 2 +- .../DirectoryItemFacadeOptimized.cs | 2 +- .../DirectoryUtilityService.cs | 2 +- .../DockerReferenceException.cs | 22 +++++++++--------- .../DockerService.cs | 2 +- .../EnvironmentVariableService.cs | 2 +- .../FastDirectoryWalkerFactory.cs | 2 +- .../FileUtilityService.cs | 2 +- ...Microsoft.ComponentDetection.Common.csproj | 3 +++ .../PathUtilityService.cs | 2 +- .../SafeFileEnumerableFactory.cs | 2 +- .../TabularStringFormat.cs | 2 +- .../Records/BcdeExecutionTelemetryRecord.cs | 2 +- .../CommandLineInvocationTelemetryRecord.cs | 2 +- .../DependencyGraphTranslationRecord.cs | 2 +- .../Records/DetectedComponentScopeRecord.cs | 2 +- .../DetectorExecutionTelemetryRecord.cs | 2 +- ...erviceImageExistsLocallyTelemetryRecord.cs | 2 +- ...ockerServiceInspectImageTelemetryRecord.cs | 2 +- .../DockerServiceSystemInfoTelemetryRecord.cs | 2 +- .../Records/DockerServiceTelemetryRecord.cs | 2 +- ...ockerServiceTryPullImageTelemetryRecord.cs | 2 +- .../Records/FailedParsingFileRecord.cs | 2 +- .../Records/GoReplaceTelemetryRecord.cs | 2 +- .../InvalidParseVersionTelemetryRecord.cs | 2 +- ...uxContainerDetectorImageDetectionFailed.cs | 2 +- .../LinuxContainerDetectorLayerAwareness.cs | 2 +- ...inerDetectorMissingRepoNameAndTagRecord.cs | 2 +- .../LinuxContainerDetectorMissingVersion.cs | 2 +- .../Records/LinuxContainerDetectorTimeout.cs | 2 +- .../LinuxContainerDetectorUnsupportedOs.cs | 2 +- .../LinuxScannerSyftTelemetryRecord.cs | 2 +- .../Records/LinuxScannerTelemetryRecord.cs | 2 +- .../LoadComponentDetectorsTelemetryRecord.cs | 2 +- .../NuGetProjectAssetsTelemetryRecord.cs | 2 +- .../PipReportFailureTelemetryRecord.cs | 2 +- .../Records/PipReportSkipTelemetryRecord.cs | 2 +- .../Records/PipReportTypeTelemetryRecord.cs | 2 +- .../Records/PyPiCacheTelemetryRecord.cs | 2 +- .../Records/PypiFailureTelemetryRecord.cs | 2 +- .../PypiMaxRetriesReachedTelemetryRecord.cs | 2 +- .../Records/PypiRetryTelemetryRecord.cs | 2 +- .../RustCrateDetectorTelemetryRecord.cs | 2 +- .../Records/RustDetectionTelemetryRecord.cs | 2 +- .../Records/RustGraphTelemetryRecord.cs | 2 +- .../Records/SimplePypiCacheTelemetryRecord.cs | 2 +- .../PyPiClientTests.cs | 3 +-- .../SimplePypiClientTests.cs | 23 +++++++++---------- 54 files changed, 76 insertions(+), 75 deletions(-) diff --git a/src/Microsoft.ComponentDetection.Common/Column.cs b/src/Microsoft.ComponentDetection.Common/Column.cs index d55f00044..aa9fda7a2 100644 --- a/src/Microsoft.ComponentDetection.Common/Column.cs +++ b/src/Microsoft.ComponentDetection.Common/Column.cs @@ -1,7 +1,7 @@ #nullable disable namespace Microsoft.ComponentDetection.Common; -public class Column +internal class Column { public int Width { get; set; } diff --git a/src/Microsoft.ComponentDetection.Common/CommandLineInvocationService.cs b/src/Microsoft.ComponentDetection.Common/CommandLineInvocationService.cs index 7dbf630f2..dc66db9ac 100644 --- a/src/Microsoft.ComponentDetection.Common/CommandLineInvocationService.cs +++ b/src/Microsoft.ComponentDetection.Common/CommandLineInvocationService.cs @@ -14,7 +14,7 @@ namespace Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts; /// -public class CommandLineInvocationService : ICommandLineInvocationService +internal class CommandLineInvocationService : ICommandLineInvocationService { private readonly IDictionary commandLocatableCache = new ConcurrentDictionary(); diff --git a/src/Microsoft.ComponentDetection.Common/ComponentComparer.cs b/src/Microsoft.ComponentDetection.Common/ComponentComparer.cs index f3417a13c..4fe7e8d3b 100644 --- a/src/Microsoft.ComponentDetection.Common/ComponentComparer.cs +++ b/src/Microsoft.ComponentDetection.Common/ComponentComparer.cs @@ -7,7 +7,7 @@ namespace Microsoft.ComponentDetection.Common; /// /// Compares two s by their . /// -public class ComponentComparer : EqualityComparer +internal class ComponentComparer : EqualityComparer { /// /// Determines whether the specified objects are equal. diff --git a/src/Microsoft.ComponentDetection.Common/ComponentStreamEnumerableFactory.cs b/src/Microsoft.ComponentDetection.Common/ComponentStreamEnumerableFactory.cs index 318394f23..4f74a9347 100644 --- a/src/Microsoft.ComponentDetection.Common/ComponentStreamEnumerableFactory.cs +++ b/src/Microsoft.ComponentDetection.Common/ComponentStreamEnumerableFactory.cs @@ -7,7 +7,7 @@ namespace Microsoft.ComponentDetection.Common; using Microsoft.Extensions.Logging; /// -public class ComponentStreamEnumerableFactory : IComponentStreamEnumerableFactory +internal class ComponentStreamEnumerableFactory : IComponentStreamEnumerableFactory { private readonly IPathUtilityService pathUtilityService; private readonly ILogger logger; diff --git a/src/Microsoft.ComponentDetection.Common/ConsoleWritingService.cs b/src/Microsoft.ComponentDetection.Common/ConsoleWritingService.cs index 1edec9fb4..8235d6148 100644 --- a/src/Microsoft.ComponentDetection.Common/ConsoleWritingService.cs +++ b/src/Microsoft.ComponentDetection.Common/ConsoleWritingService.cs @@ -2,7 +2,7 @@ namespace Microsoft.ComponentDetection.Common; using System; -public class ConsoleWritingService : IConsoleWritingService +internal class ConsoleWritingService : IConsoleWritingService { public void Write(string content) { diff --git a/src/Microsoft.ComponentDetection.Common/DependencyScopeComparer.cs b/src/Microsoft.ComponentDetection.Common/DependencyScopeComparer.cs index 79a0090a2..1b0ffe4a2 100644 --- a/src/Microsoft.ComponentDetection.Common/DependencyScopeComparer.cs +++ b/src/Microsoft.ComponentDetection.Common/DependencyScopeComparer.cs @@ -6,7 +6,7 @@ namespace Microsoft.ComponentDetection.Common; /// Merges dependnecy Scope in their order of Priority. /// Higher priority scope, as indicated by its lower enum value is given precendence. /// -public static class DependencyScopeComparer +internal static class DependencyScopeComparer { public static DependencyScope? GetMergedDependencyScope(DependencyScope? scope1, DependencyScope? scope2) { diff --git a/src/Microsoft.ComponentDetection.Common/DirectoryItemFacade.cs b/src/Microsoft.ComponentDetection.Common/DirectoryItemFacade.cs index e06863526..bdec06e23 100644 --- a/src/Microsoft.ComponentDetection.Common/DirectoryItemFacade.cs +++ b/src/Microsoft.ComponentDetection.Common/DirectoryItemFacade.cs @@ -6,7 +6,7 @@ namespace Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts; [DebuggerDisplay("{Name}")] -public class DirectoryItemFacade +internal class DirectoryItemFacade { public string Name { get; set; } diff --git a/src/Microsoft.ComponentDetection.Common/DirectoryItemFacadeOptimized.cs b/src/Microsoft.ComponentDetection.Common/DirectoryItemFacadeOptimized.cs index 85925b957..562435edf 100644 --- a/src/Microsoft.ComponentDetection.Common/DirectoryItemFacadeOptimized.cs +++ b/src/Microsoft.ComponentDetection.Common/DirectoryItemFacadeOptimized.cs @@ -5,7 +5,7 @@ namespace Microsoft.ComponentDetection.Common; using System.Diagnostics; [DebuggerDisplay("{Name}")] -public class DirectoryItemFacadeOptimized +internal class DirectoryItemFacadeOptimized { public string Name { get; set; } diff --git a/src/Microsoft.ComponentDetection.Common/DirectoryUtilityService.cs b/src/Microsoft.ComponentDetection.Common/DirectoryUtilityService.cs index f0ae8f9b9..d9279182b 100644 --- a/src/Microsoft.ComponentDetection.Common/DirectoryUtilityService.cs +++ b/src/Microsoft.ComponentDetection.Common/DirectoryUtilityService.cs @@ -5,7 +5,7 @@ namespace Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts; /// -public class DirectoryUtilityService : IDirectoryUtilityService +internal class DirectoryUtilityService : IDirectoryUtilityService { /// public void Delete(string path, bool recursive) => Directory.Delete(path, recursive); diff --git a/src/Microsoft.ComponentDetection.Common/DockerReference/DockerReferenceException.cs b/src/Microsoft.ComponentDetection.Common/DockerReference/DockerReferenceException.cs index 07341d336..1ef1fec97 100644 --- a/src/Microsoft.ComponentDetection.Common/DockerReference/DockerReferenceException.cs +++ b/src/Microsoft.ComponentDetection.Common/DockerReference/DockerReferenceException.cs @@ -3,7 +3,7 @@ namespace Microsoft.ComponentDetection.Common; using System; -public class DockerReferenceException : Exception +internal class DockerReferenceException : Exception { public DockerReferenceException(string reference, string exceptionErrorMessage) : base($"Error while parsing docker reference {reference} : {exceptionErrorMessage}") @@ -26,7 +26,7 @@ public DockerReferenceException(string message, Exception innerException) } // ReferenceInvalidFormat represents an error while trying to parse a string as a reference. -public class ReferenceInvalidFormatException : DockerReferenceException +internal class ReferenceInvalidFormatException : DockerReferenceException { private const string ErrorMessage = "invalid reference format"; @@ -46,7 +46,7 @@ public ReferenceInvalidFormatException(string message, Exception innerException) } // TagInvalidFormat represents an error while trying to parse a string as a tag. -public class ReferenceTagInvalidFormatException : DockerReferenceException +internal class ReferenceTagInvalidFormatException : DockerReferenceException { private const string ErrorMessage = "invalid tag format"; @@ -66,7 +66,7 @@ public ReferenceTagInvalidFormatException(string message, Exception innerExcepti } // DigestInvalidFormat represents an error while trying to parse a string as a tag. -public class ReferenceDigestInvalidFormatException : DockerReferenceException +internal class ReferenceDigestInvalidFormatException : DockerReferenceException { private const string ErrorMessage = "invalid digest format"; @@ -86,7 +86,7 @@ public ReferenceDigestInvalidFormatException(string message, Exception innerExce } // NameContainsUppercase is returned for invalid repository names that contain uppercase characters. -public class ReferenceNameContainsUppercaseException : DockerReferenceException +internal class ReferenceNameContainsUppercaseException : DockerReferenceException { private const string ErrorMessage = "repository name must be lowercase"; @@ -106,7 +106,7 @@ public ReferenceNameContainsUppercaseException(string message, Exception innerEx } // NameEmpty is returned for empty, invalid repository names. -public class ReferenceNameEmptyException : DockerReferenceException +internal class ReferenceNameEmptyException : DockerReferenceException { private const string ErrorMessage = "repository name must have at least one component"; @@ -126,7 +126,7 @@ public ReferenceNameEmptyException(string message, Exception innerException) } // ErrNameTooLong is returned when a repository name is longer than NameTotalLengthMax. -public class ReferenceNameTooLongException : DockerReferenceException +internal class ReferenceNameTooLongException : DockerReferenceException { private const string ErrorMessage = "repository name must not be more than 255 characters"; @@ -146,7 +146,7 @@ public ReferenceNameTooLongException(string message, Exception innerException) } // ErrNameNotCanonical is returned when a name is not canonical. -public class ReferenceNameNotCanonicalException : DockerReferenceException +internal class ReferenceNameNotCanonicalException : DockerReferenceException { private const string ErrorMessage = "repository name must be canonical"; @@ -165,7 +165,7 @@ public ReferenceNameNotCanonicalException(string message, Exception innerExcepti } } -public class InvalidDigestFormatError : DockerReferenceException +internal class InvalidDigestFormatError : DockerReferenceException { private const string ErrorMessage = "invalid digest format"; @@ -184,7 +184,7 @@ public InvalidDigestFormatError(string message, Exception innerException) } } -public class UnsupportedAlgorithmError : DockerReferenceException +internal class UnsupportedAlgorithmError : DockerReferenceException { private const string ErrorMessage = "unsupported digest algorithm"; @@ -203,7 +203,7 @@ public UnsupportedAlgorithmError(string message, Exception innerException) } } -public class InvalidDigestLengthError : DockerReferenceException +internal class InvalidDigestLengthError : DockerReferenceException { private const string ErrorMessage = "invalid checksum digest length"; diff --git a/src/Microsoft.ComponentDetection.Common/DockerService.cs b/src/Microsoft.ComponentDetection.Common/DockerService.cs index d9b47e05b..cb0ce2274 100644 --- a/src/Microsoft.ComponentDetection.Common/DockerService.cs +++ b/src/Microsoft.ComponentDetection.Common/DockerService.cs @@ -15,7 +15,7 @@ namespace Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts.BcdeModels; using Microsoft.Extensions.Logging; -public class DockerService : IDockerService +internal class DockerService : IDockerService { // Base image annotations from ADO dockerTask private const string BaseImageRefAnnotation = "image.base.ref.name"; diff --git a/src/Microsoft.ComponentDetection.Common/EnvironmentVariableService.cs b/src/Microsoft.ComponentDetection.Common/EnvironmentVariableService.cs index 188efb667..c89e47024 100644 --- a/src/Microsoft.ComponentDetection.Common/EnvironmentVariableService.cs +++ b/src/Microsoft.ComponentDetection.Common/EnvironmentVariableService.cs @@ -6,7 +6,7 @@ namespace Microsoft.ComponentDetection.Common; using System.Linq; using Microsoft.ComponentDetection.Contracts; -public class EnvironmentVariableService : IEnvironmentVariableService +internal class EnvironmentVariableService : IEnvironmentVariableService { public bool DoesEnvironmentVariableExist(string name) { diff --git a/src/Microsoft.ComponentDetection.Common/FastDirectoryWalkerFactory.cs b/src/Microsoft.ComponentDetection.Common/FastDirectoryWalkerFactory.cs index a6ce9c286..3dd13995f 100644 --- a/src/Microsoft.ComponentDetection.Common/FastDirectoryWalkerFactory.cs +++ b/src/Microsoft.ComponentDetection.Common/FastDirectoryWalkerFactory.cs @@ -16,7 +16,7 @@ namespace Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts.Internal; using Microsoft.Extensions.Logging; -public class FastDirectoryWalkerFactory : IObservableDirectoryWalkerFactory +internal class FastDirectoryWalkerFactory : IObservableDirectoryWalkerFactory { private readonly ConcurrentDictionary>> pendingScans = new ConcurrentDictionary>>(); private readonly IPathUtilityService pathUtilityService; diff --git a/src/Microsoft.ComponentDetection.Common/FileUtilityService.cs b/src/Microsoft.ComponentDetection.Common/FileUtilityService.cs index 6fc7857b5..d7ebbe7b9 100644 --- a/src/Microsoft.ComponentDetection.Common/FileUtilityService.cs +++ b/src/Microsoft.ComponentDetection.Common/FileUtilityService.cs @@ -8,7 +8,7 @@ namespace Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts; /// -public class FileUtilityService : IFileUtilityService +internal class FileUtilityService : IFileUtilityService { /// public string ReadAllText(string filePath) diff --git a/src/Microsoft.ComponentDetection.Common/Microsoft.ComponentDetection.Common.csproj b/src/Microsoft.ComponentDetection.Common/Microsoft.ComponentDetection.Common.csproj index efdcd5363..41489c99f 100644 --- a/src/Microsoft.ComponentDetection.Common/Microsoft.ComponentDetection.Common.csproj +++ b/src/Microsoft.ComponentDetection.Common/Microsoft.ComponentDetection.Common.csproj @@ -5,6 +5,9 @@ + + + diff --git a/src/Microsoft.ComponentDetection.Common/PathUtilityService.cs b/src/Microsoft.ComponentDetection.Common/PathUtilityService.cs index 27df98217..f55228b40 100644 --- a/src/Microsoft.ComponentDetection.Common/PathUtilityService.cs +++ b/src/Microsoft.ComponentDetection.Common/PathUtilityService.cs @@ -8,7 +8,7 @@ namespace Microsoft.ComponentDetection.Common; using Microsoft.Extensions.Logging; // We may want to consider breaking this class into Win/Mac/Linux variants if it gets bigger -public class PathUtilityService : IPathUtilityService +internal class PathUtilityService : IPathUtilityService { public const uint CreationDispositionRead = 0x3; diff --git a/src/Microsoft.ComponentDetection.Common/SafeFileEnumerableFactory.cs b/src/Microsoft.ComponentDetection.Common/SafeFileEnumerableFactory.cs index 64344c123..98ef62eb0 100644 --- a/src/Microsoft.ComponentDetection.Common/SafeFileEnumerableFactory.cs +++ b/src/Microsoft.ComponentDetection.Common/SafeFileEnumerableFactory.cs @@ -6,7 +6,7 @@ namespace Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts; using Microsoft.Extensions.Logging; -public class SafeFileEnumerableFactory : ISafeFileEnumerableFactory +internal class SafeFileEnumerableFactory : ISafeFileEnumerableFactory { private readonly IPathUtilityService pathUtilityService; private readonly ILogger logger; diff --git a/src/Microsoft.ComponentDetection.Common/TabularStringFormat.cs b/src/Microsoft.ComponentDetection.Common/TabularStringFormat.cs index aa6c314ab..2b2589747 100644 --- a/src/Microsoft.ComponentDetection.Common/TabularStringFormat.cs +++ b/src/Microsoft.ComponentDetection.Common/TabularStringFormat.cs @@ -6,7 +6,7 @@ namespace Microsoft.ComponentDetection.Common; using System.Linq; using System.Text; -public class TabularStringFormat +internal class TabularStringFormat { public const char DefaultVerticalLineChar = '|'; public const char DefaultHorizontalLineChar = '_'; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/BcdeExecutionTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/BcdeExecutionTelemetryRecord.cs index b7cab203b..7bf45e883 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/BcdeExecutionTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/BcdeExecutionTelemetryRecord.cs @@ -5,7 +5,7 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; using System.Threading; using System.Threading.Tasks; -public class BcdeExecutionTelemetryRecord : BaseDetectionTelemetryRecord +internal class BcdeExecutionTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "BcdeExecution"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/CommandLineInvocationTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/CommandLineInvocationTelemetryRecord.cs index dcb111a3e..c5730d20c 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/CommandLineInvocationTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/CommandLineInvocationTelemetryRecord.cs @@ -3,7 +3,7 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; using System; using Microsoft.ComponentDetection.Contracts; -public class CommandLineInvocationTelemetryRecord : BaseDetectionTelemetryRecord +internal class CommandLineInvocationTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "CommandLineInvocation"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DependencyGraphTranslationRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DependencyGraphTranslationRecord.cs index bd73c55e3..782dd3022 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DependencyGraphTranslationRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DependencyGraphTranslationRecord.cs @@ -2,7 +2,7 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; using System; -public class DependencyGraphTranslationRecord : BaseDetectionTelemetryRecord +internal class DependencyGraphTranslationRecord : BaseDetectionTelemetryRecord { public override string RecordName => "DependencyGraphTranslationRecord"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DetectedComponentScopeRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DetectedComponentScopeRecord.cs index 94c437277..4ec418c07 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DetectedComponentScopeRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DetectedComponentScopeRecord.cs @@ -2,7 +2,7 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; using System.Runtime.CompilerServices; -public class DetectedComponentScopeRecord : BaseDetectionTelemetryRecord +internal class DetectedComponentScopeRecord : BaseDetectionTelemetryRecord { public override string RecordName => "ComponentScopeRecord"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DetectorExecutionTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DetectorExecutionTelemetryRecord.cs index 03abd3daf..d2e1f47b4 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DetectorExecutionTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DetectorExecutionTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class DetectorExecutionTelemetryRecord : BaseDetectionTelemetryRecord +internal class DetectorExecutionTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "DetectorExecution"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceImageExistsLocallyTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceImageExistsLocallyTelemetryRecord.cs index 844f773a9..478622949 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceImageExistsLocallyTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceImageExistsLocallyTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class DockerServiceImageExistsLocallyTelemetryRecord : BaseDetectionTelemetryRecord +internal class DockerServiceImageExistsLocallyTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "DockerServiceImageExistsLocally"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceInspectImageTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceInspectImageTelemetryRecord.cs index c04d287d4..0041e002d 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceInspectImageTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceInspectImageTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class DockerServiceInspectImageTelemetryRecord : BaseDetectionTelemetryRecord +internal class DockerServiceInspectImageTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "DockerServiceInspectImage"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceSystemInfoTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceSystemInfoTelemetryRecord.cs index 7991cd40c..30f9066de 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceSystemInfoTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceSystemInfoTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class DockerServiceSystemInfoTelemetryRecord : BaseDetectionTelemetryRecord +internal class DockerServiceSystemInfoTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "DockerServiceSystemInfo"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceTelemetryRecord.cs index e93e25681..8357a967f 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class DockerServiceTelemetryRecord : BaseDetectionTelemetryRecord +internal class DockerServiceTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "DockerService"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceTryPullImageTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceTryPullImageTelemetryRecord.cs index 79e77779a..211f593eb 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceTryPullImageTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/DockerServiceTryPullImageTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class DockerServiceTryPullImageTelemetryRecord : BaseDetectionTelemetryRecord +internal class DockerServiceTryPullImageTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "DockerServiceTryPullImage"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/FailedParsingFileRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/FailedParsingFileRecord.cs index f5e210ff2..e6cfc8576 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/FailedParsingFileRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/FailedParsingFileRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class FailedParsingFileRecord : BaseDetectionTelemetryRecord +internal class FailedParsingFileRecord : BaseDetectionTelemetryRecord { public override string RecordName => "FailedParsingFile"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/GoReplaceTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/GoReplaceTelemetryRecord.cs index 0403f6c01..41ad6daad 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/GoReplaceTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/GoReplaceTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class GoReplaceTelemetryRecord : BaseDetectionTelemetryRecord +internal class GoReplaceTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "GoReplace"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/InvalidParseVersionTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/InvalidParseVersionTelemetryRecord.cs index 838fa52c8..f3f249d1a 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/InvalidParseVersionTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/InvalidParseVersionTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class InvalidParseVersionTelemetryRecord : BaseDetectionTelemetryRecord +internal class InvalidParseVersionTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "InvalidParseVersion"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorImageDetectionFailed.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorImageDetectionFailed.cs index 46aae7758..4e13c5d03 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorImageDetectionFailed.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorImageDetectionFailed.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class LinuxContainerDetectorImageDetectionFailed : BaseDetectionTelemetryRecord +internal class LinuxContainerDetectorImageDetectionFailed : BaseDetectionTelemetryRecord { public override string RecordName => "LinuxContainerDetectorImageDetectionFailed"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorLayerAwareness.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorLayerAwareness.cs index cf39c768f..e8c63b4fd 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorLayerAwareness.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorLayerAwareness.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class LinuxContainerDetectorLayerAwareness : BaseDetectionTelemetryRecord +internal class LinuxContainerDetectorLayerAwareness : BaseDetectionTelemetryRecord { public override string RecordName => "LinuxContainerDetectorLayerAwareness"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorMissingRepoNameAndTagRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorMissingRepoNameAndTagRecord.cs index 6d64ae1a0..e1269c862 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorMissingRepoNameAndTagRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorMissingRepoNameAndTagRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class LinuxContainerDetectorMissingRepoNameAndTagRecord : BaseDetectionTelemetryRecord +internal class LinuxContainerDetectorMissingRepoNameAndTagRecord : BaseDetectionTelemetryRecord { public override string RecordName => "MissingRepoNameAndTag"; } diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorMissingVersion.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorMissingVersion.cs index a28f2d990..2372bacf9 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorMissingVersion.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorMissingVersion.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class LinuxContainerDetectorMissingVersion : BaseDetectionTelemetryRecord +internal class LinuxContainerDetectorMissingVersion : BaseDetectionTelemetryRecord { public override string RecordName { get; } = "MissingVersion"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorTimeout.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorTimeout.cs index 4e91d6122..83108c0fd 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorTimeout.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorTimeout.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class LinuxContainerDetectorTimeout : BaseDetectionTelemetryRecord +internal class LinuxContainerDetectorTimeout : BaseDetectionTelemetryRecord { public override string RecordName => "LinuxContainerDetectorTimeout"; } diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorUnsupportedOs.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorUnsupportedOs.cs index 415615306..937e5eaac 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorUnsupportedOs.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxContainerDetectorUnsupportedOs.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class LinuxContainerDetectorUnsupportedOs : BaseDetectionTelemetryRecord +internal class LinuxContainerDetectorUnsupportedOs : BaseDetectionTelemetryRecord { public override string RecordName => "LinuxContainerDetectorUnsupportedOs"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxScannerSyftTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxScannerSyftTelemetryRecord.cs index e52b0f60f..9aa3de6f0 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxScannerSyftTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxScannerSyftTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class LinuxScannerSyftTelemetryRecord : BaseDetectionTelemetryRecord +internal class LinuxScannerSyftTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "LinuxScannerSyftTelemetry"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxScannerTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxScannerTelemetryRecord.cs index d3ad07ddd..502e689ba 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxScannerTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LinuxScannerTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class LinuxScannerTelemetryRecord : BaseDetectionTelemetryRecord +internal class LinuxScannerTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "LinuxScannerTelemetry"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LoadComponentDetectorsTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LoadComponentDetectorsTelemetryRecord.cs index ce68a8a76..64ce4ff06 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LoadComponentDetectorsTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/LoadComponentDetectorsTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class LoadComponentDetectorsTelemetryRecord : BaseDetectionTelemetryRecord +internal class LoadComponentDetectorsTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "LoadComponentDetectors"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/NuGetProjectAssetsTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/NuGetProjectAssetsTelemetryRecord.cs index 42dd490d6..b28422c0d 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/NuGetProjectAssetsTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/NuGetProjectAssetsTelemetryRecord.cs @@ -2,7 +2,7 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; using System; -public class NuGetProjectAssetsTelemetryRecord : IDetectionTelemetryRecord, IDisposable +internal class NuGetProjectAssetsTelemetryRecord : IDetectionTelemetryRecord, IDisposable { private bool disposedValue; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportFailureTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportFailureTelemetryRecord.cs index bb68174f1..d8a720721 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportFailureTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportFailureTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class PipReportFailureTelemetryRecord : BaseDetectionTelemetryRecord +internal class PipReportFailureTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "PipReportFailure"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportSkipTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportSkipTelemetryRecord.cs index 2032d314b..f3352eaee 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportSkipTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportSkipTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class PipReportSkipTelemetryRecord : BaseDetectionTelemetryRecord +internal class PipReportSkipTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "PipReportSkip"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportTypeTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportTypeTelemetryRecord.cs index dd393bed0..e7cee9d66 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportTypeTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PipReportTypeTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class PipReportTypeTelemetryRecord : BaseDetectionTelemetryRecord +internal class PipReportTypeTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "PipReportType"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PyPiCacheTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PyPiCacheTelemetryRecord.cs index ff0a5920e..18b621051 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PyPiCacheTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PyPiCacheTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class PypiCacheTelemetryRecord : BaseDetectionTelemetryRecord +internal class PypiCacheTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "PyPiCache"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiFailureTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiFailureTelemetryRecord.cs index bf70d5c7a..369766e04 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiFailureTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiFailureTelemetryRecord.cs @@ -2,7 +2,7 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; using System.Net; -public class PypiFailureTelemetryRecord : BaseDetectionTelemetryRecord +internal class PypiFailureTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "PypiFailure"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiMaxRetriesReachedTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiMaxRetriesReachedTelemetryRecord.cs index 089e2ab17..b7b95a89b 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiMaxRetriesReachedTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiMaxRetriesReachedTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class PypiMaxRetriesReachedTelemetryRecord : BaseDetectionTelemetryRecord +internal class PypiMaxRetriesReachedTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "PypiMaxRetriesReached"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiRetryTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiRetryTelemetryRecord.cs index a882f03f7..3de58830d 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiRetryTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/PypiRetryTelemetryRecord.cs @@ -2,7 +2,7 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; using System.Net; -public class PypiRetryTelemetryRecord : BaseDetectionTelemetryRecord +internal class PypiRetryTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "PypiRetry"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustCrateDetectorTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustCrateDetectorTelemetryRecord.cs index 8e795f587..2d919c612 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustCrateDetectorTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustCrateDetectorTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class RustCrateDetectorTelemetryRecord : BaseDetectionTelemetryRecord +internal class RustCrateDetectorTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "RustCrateMalformedDependencies"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustDetectionTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustDetectionTelemetryRecord.cs index 85ffe6b92..ff1561ba3 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustDetectionTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustDetectionTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class RustDetectionTelemetryRecord : BaseDetectionTelemetryRecord +internal class RustDetectionTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "RustDetection"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustGraphTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustGraphTelemetryRecord.cs index 2b2510287..4f3959949 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustGraphTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/RustGraphTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class RustGraphTelemetryRecord : BaseDetectionTelemetryRecord +internal class RustGraphTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "RustGraph"; diff --git a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/SimplePypiCacheTelemetryRecord.cs b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/SimplePypiCacheTelemetryRecord.cs index b615b82d7..9f56fdbcc 100644 --- a/src/Microsoft.ComponentDetection.Common/Telemetry/Records/SimplePypiCacheTelemetryRecord.cs +++ b/src/Microsoft.ComponentDetection.Common/Telemetry/Records/SimplePypiCacheTelemetryRecord.cs @@ -1,6 +1,6 @@ namespace Microsoft.ComponentDetection.Common.Telemetry.Records; -public class SimplePypiCacheTelemetryRecord : BaseDetectionTelemetryRecord +internal class SimplePypiCacheTelemetryRecord : BaseDetectionTelemetryRecord { public override string RecordName => "SimplePyPiCache"; diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/PyPiClientTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/PyPiClientTests.cs index ca30856a7..fc2b413f7 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/PyPiClientTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/PyPiClientTests.cs @@ -11,7 +11,6 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using System.Threading; using System.Threading.Tasks; using AwesomeAssertions; -using Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Detectors.Pip; using Microsoft.Extensions.Logging; @@ -25,7 +24,7 @@ public class PyPiClientTests private readonly PyPiClient pypiClient; public PyPiClientTests() => this.pypiClient = new PyPiClient( - new EnvironmentVariableService(), + new Mock().Object, new Mock>().Object); [TestMethod] diff --git a/test/Microsoft.ComponentDetection.Detectors.Tests/SimplePypiClientTests.cs b/test/Microsoft.ComponentDetection.Detectors.Tests/SimplePypiClientTests.cs index 0dc1c6386..1b75fb629 100644 --- a/test/Microsoft.ComponentDetection.Detectors.Tests/SimplePypiClientTests.cs +++ b/test/Microsoft.ComponentDetection.Detectors.Tests/SimplePypiClientTests.cs @@ -9,7 +9,6 @@ namespace Microsoft.ComponentDetection.Detectors.Tests; using System.Threading; using System.Threading.Tasks; using AwesomeAssertions; -using Microsoft.ComponentDetection.Common; using Microsoft.ComponentDetection.Contracts; using Microsoft.ComponentDetection.Detectors.Pip; using Microsoft.Extensions.Logging; @@ -50,7 +49,7 @@ public async Task GetSimplePypiProject_DuplicateEntries_CallsGetAsync_OnceAsync( var pythonProject = this.SampleValidApiJsonResponse("boto3", "0.0.1"); var mockHandler = this.MockHttpMessageHandler(pythonProject, HttpStatusCode.OK); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => await simplePypiClient.GetSimplePypiProjectAsync(pythonSpecs); await action.Should().NotThrowAsync(); @@ -74,7 +73,7 @@ public async Task GetSimplePypiProject_DifferentEntries_CallsGetAsync_TwiceAsync }; var mockHandler = this.MockHttpMessageHandler(JsonSerializer.Serialize(pythonProject), HttpStatusCode.OK); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => { @@ -108,7 +107,7 @@ public async Task GetSimplePypiProject_ReturnsValidSimplePypiProjectAsync() }; var mockHandler = this.MockHttpMessageHandler(sampleApiResponse, HttpStatusCode.OK); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var actualResult = await simplePypiClient.GetSimplePypiProjectAsync(pythonSpecs); actualResult.Should().BeEquivalentTo(expectedResult); @@ -120,7 +119,7 @@ public async Task GetSimplePypiProject_InvalidSpec_NotThrowAsync() var pythonSpecs = new PipDependencySpecification { DependencySpecifiers = ["==1.0.0"], Name = "randomName" }; var mockHandler = this.MockHttpMessageHandler("404 Not Found", HttpStatusCode.NotFound); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => await simplePypiClient.GetSimplePypiProjectAsync(pythonSpecs); @@ -134,7 +133,7 @@ public async Task GetSimplePypiProject_UnexpectedContentTypeReturnedByApi_NotThr var content = "\r\n\t

Links for boto3

\r\n\tboto3-0.0.1-py2.py3-none-any.whl
"; var mockHandler = this.MockHttpMessageHandler(content, HttpStatusCode.OK); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => await simplePypiClient.GetSimplePypiProjectAsync(pythonSpecs); @@ -147,7 +146,7 @@ public async Task GetSimplePypiProject_ShouldRetryAsync() var pythonSpecs = new PipDependencySpecification { DependencySpecifiers = ["==1.0.0"] }; var mockHandler = this.MockHttpMessageHandler(string.Empty, HttpStatusCode.InternalServerError); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => await simplePypiClient.GetSimplePypiProjectAsync(pythonSpecs); @@ -166,7 +165,7 @@ public async Task GetSimplePypiProject_ShouldNotRetryAsync() { var pythonSpecs = new PipDependencySpecification { DependencySpecifiers = ["==1.0.0"] }; var mockHandler = this.MockHttpMessageHandler("some content", HttpStatusCode.MultipleChoices); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => await simplePypiClient.GetSimplePypiProjectAsync(pythonSpecs); await action.Should().NotThrowAsync(); @@ -186,7 +185,7 @@ public async Task GetSimplePypiProject_AddsCorrectHeadersAsync() var pythonProject = this.SampleValidApiJsonResponse("boto3", "0.0.1"); var mockHandler = this.MockHttpMessageHandler(pythonProject, HttpStatusCode.OK); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => await simplePypiClient.GetSimplePypiProjectAsync(pythonSpecs); @@ -265,7 +264,7 @@ public async Task FetchPackageFileStream_MaxEntriesVariable_CreatesNewCacheAsync public async Task FetchPackageFileStream_DuplicateEntries_CallsGetAsync_OnceAsync() { var mockHandler = this.MockHttpMessageHandler(string.Empty, HttpStatusCode.OK); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => await simplePypiClient.FetchPackageFileStreamAsync(new Uri($"https://testurl")); @@ -284,7 +283,7 @@ public async Task FetchPackageFileStream_DuplicateEntries_CallsGetAsync_OnceAsyn public async Task FetchPackageFileStream_DifferentEntries_CallsGetAsync_TwiceAsync() { var mockHandler = this.MockHttpMessageHandler(string.Empty, HttpStatusCode.OK); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => await simplePypiClient.FetchPackageFileStreamAsync(new Uri($"https://{Guid.NewGuid()}")); @@ -303,7 +302,7 @@ public async Task FetchPackageFileStream_DifferentEntries_CallsGetAsync_TwiceAsy public async Task FetchPackageFileStream_UnableToRetrievePackageAsync() { var mockHandler = this.MockHttpMessageHandler(string.Empty, HttpStatusCode.InternalServerError); - var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); + var simplePypiClient = this.CreateSimplePypiClient(mockHandler.Object, new Mock().Object, new Mock>().Object); var action = async () => { return await simplePypiClient.FetchPackageFileStreamAsync(new Uri($"https://{Guid.NewGuid()}")); };