diff --git a/.editorconfig b/.editorconfig index f1b2ec00..41e3fe09 100644 --- a/.editorconfig +++ b/.editorconfig @@ -521,10 +521,6 @@ dotnet_diagnostic.SA1024.severity = suggestion # SA1101: Prefix local calls with this dotnet_diagnostic.SA1101.severity = suggestion -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1124.md -# SA1124: Do not use regions -dotnet_diagnostic.SA1124.severity = suggestion - # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md # SA1200: Using directive should appear within a namespace declaration dotnet_diagnostic.SA1200.severity = suggestion diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d7efb25..bd34b31d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: MINVERBUILDMETADATA: build.${{github.run_number}} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-depth: 0 @@ -43,6 +43,6 @@ jobs: run: dotnet test --collect:"XPlat Code Coverage" - name: Upload code coverage - uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1 + uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d41b757b..2df249c3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -23,15 +23,15 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Initialize CodeQL - uses: github/codeql-action/init@379614612a29c9e28f31f39a59013eb8012a51f0 # v3.24.3 + uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 with: languages: csharp - name: Autobuild - uses: github/codeql-action/autobuild@379614612a29c9e28f31f39a59013eb8012a51f0 # v3.24.3 + uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@379614612a29c9e28f31f39a59013eb8012a51f0 # v3.24.3 + uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11 diff --git a/.github/workflows/gen-docs.yml b/.github/workflows/gen-docs.yml index e2162198..606dc96c 100644 --- a/.github/workflows/gen-docs.yml +++ b/.github/workflows/gen-docs.yml @@ -16,7 +16,7 @@ jobs: gen-docs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - name: Setup .NET uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0 diff --git a/src/Microsoft.Sbom.Api/Manifest/Configuration/SBOMConfig.cs b/src/Microsoft.Sbom.Api/Manifest/Configuration/SBOMConfig.cs index da293ecc..aee31d73 100644 --- a/src/Microsoft.Sbom.Api/Manifest/Configuration/SBOMConfig.cs +++ b/src/Microsoft.Sbom.Api/Manifest/Configuration/SBOMConfig.cs @@ -87,8 +87,6 @@ public void StartJsonSerialization() JsonSerializer = new ManifestToolJsonSerializer(fileStream); } - #region Disposable implementation - public void Dispose() { Dispose(disposing: true); @@ -138,6 +136,4 @@ protected virtual async ValueTask DisposeAsyncCore() fileStream = null; JsonSerializer = null; } - - #endregion } diff --git a/src/Microsoft.Sbom.Api/Manifest/Configuration/SbomConfigProvider.cs b/src/Microsoft.Sbom.Api/Manifest/Configuration/SbomConfigProvider.cs index ea6d370a..0d5ebb03 100644 --- a/src/Microsoft.Sbom.Api/Manifest/Configuration/SbomConfigProvider.cs +++ b/src/Microsoft.Sbom.Api/Manifest/Configuration/SbomConfigProvider.cs @@ -136,8 +136,6 @@ public void ApplyToEachConfig(Action action) } } - #region IInternalMetadataProvider implementation - public object GetMetadata(MetadataKey key) { if (MetadataDictionary.TryGetValue(key, out var value)) @@ -207,10 +205,6 @@ public string GetSBOMNamespaceUri() throw new Exception($"Unable to find any provider to generate the namespace."); } - #endregion - - #region Disposable implementation - public void Dispose() { Dispose(disposing: true); @@ -240,6 +234,4 @@ protected virtual async ValueTask DisposeAsyncCore() await config.Value.DisposeAsync().ConfigureAwait(false); } } - - #endregion } diff --git a/src/Microsoft.Sbom.Api/Utils/Constants.cs b/src/Microsoft.Sbom.Api/Utils/Constants.cs index 3a8d4c3a..5771039f 100644 --- a/src/Microsoft.Sbom.Api/Utils/Constants.cs +++ b/src/Microsoft.Sbom.Api/Utils/Constants.cs @@ -46,9 +46,5 @@ public static class Constants public const string CatalogFileName = "manifest.cat"; public const string BsiFileName = "bsi.json"; - #region Configuration switches - public const string DeleteManifestDirBoolVariableName = "DeleteManifestDirIfPresent"; - - #endregion } diff --git a/src/Microsoft.Sbom.Api/Utils/Events.cs b/src/Microsoft.Sbom.Api/Utils/Events.cs index 84d370d3..80f14cc3 100644 --- a/src/Microsoft.Sbom.Api/Utils/Events.cs +++ b/src/Microsoft.Sbom.Api/Utils/Events.cs @@ -5,7 +5,6 @@ namespace Microsoft.Sbom.Api.Utils; internal static class Events { - #region Generation internal const string SBOMGenerationWorkflow = "Total generation time"; internal const string SBOMParseMetadata = "Total metadata parsing time"; internal const string FilesGeneration = "Files generation time"; @@ -14,6 +13,5 @@ internal static class Events internal const string MetadataBuilder = "Metadata build time for {0} format"; internal const string ExternalDocumentReferenceGeneration = "External document reference generation time"; - #endregion internal const string SBOMValidationWorkflow = "Total validation time"; } diff --git a/src/Microsoft.Sbom.Extensions/MetadataKey.cs b/src/Microsoft.Sbom.Extensions/MetadataKey.cs index 3d139a79..0ebee803 100644 --- a/src/Microsoft.Sbom.Extensions/MetadataKey.cs +++ b/src/Microsoft.Sbom.Extensions/MetadataKey.cs @@ -50,8 +50,6 @@ public enum MetadataKey /// these variables, go to /// https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services /// - #region Azure DevOps Pipelines metadata - Build_BuildId, Build_DefinitionName, Build_Repository_Uri, @@ -62,6 +60,4 @@ public enum MetadataKey ImageVersion, OrganizationId, ProjectId - - #endregion } diff --git a/src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Constants.cs b/src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Constants.cs index e591fe00..ec7f877e 100644 --- a/src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Constants.cs +++ b/src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Constants.cs @@ -14,7 +14,6 @@ internal static class Constants internal const string SPDXDocumentIdValue = "SPDXRef-DOCUMENT"; internal const string RootPackageIdValue = "SPDXRef-RootPackage"; internal const string SPDXRefFile = "SPDXRef-File"; - #region Headers internal const string SPDXVersionHeaderName = "spdxVersion"; internal const string DataLicenseHeaderName = "dataLicense"; @@ -29,17 +28,11 @@ internal static class Constants internal const string RelationshipsArrayHeaderName = "relationships"; internal const string ExternalDocumentRefArrayHeaderName = "externalDocumentRefs"; - #endregion - internal const int ReadBufferSize = 4096; - #region Value format strings - internal const string SPDXDocumentNameFormatString = "{0} {1}"; internal const string PackageSupplierFormatString = "Organization: {0}"; - #endregion - /// /// Use if there is no available information for a field. /// diff --git a/src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Entities/Enums/ExternalRepositoryType.cs b/src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Entities/Enums/ExternalRepositoryType.cs index 4841a1e8..5b3b60cc 100644 --- a/src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Entities/Enums/ExternalRepositoryType.cs +++ b/src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Entities/Enums/ExternalRepositoryType.cs @@ -17,31 +17,13 @@ namespace Microsoft.Sbom.Parsers.Spdx22SbomParser.Entities.Enums; Justification = "These are enum types that are case sensitive and defined by external code.")] public enum ExternalRepositoryType { - #region Security cpe22, cpe23, - - #endregion - - #region Persistent-Id - swh, - - #endregion - - #region Package-Manager - maven_central, npm, nuget, bower, purl, - - #endregion - - #region Other - idstring - - #endregion } diff --git a/test/Microsoft.Sbom.Api.Tests/Config/ConfigurationBuilderTestsBase.cs b/test/Microsoft.Sbom.Api.Tests/Config/ConfigurationBuilderTestsBase.cs index 73c48d5c..13640dad 100644 --- a/test/Microsoft.Sbom.Api.Tests/Config/ConfigurationBuilderTestsBase.cs +++ b/test/Microsoft.Sbom.Api.Tests/Config/ConfigurationBuilderTestsBase.cs @@ -62,6 +62,6 @@ object Ctor(Type type) mapper = mapperConfiguration.CreateMapper(); } - protected const string JSONConfigWithManifestPath = "{ \"ManifestDirPath\": \"manifestDirPath\"}"; - protected const string JSONConfigGoodWithManifestInfo = "{ \"ManifestInfo\": [{ \"Name\":\"manifest\", \"Version\":\"1\"}]}"; + protected const string JSONConfigWithManifestPath = $"{{ \"ManifestDirPath\": \"manifestDirPath\"}}"; + protected const string JSONConfigGoodWithManifestInfo = $"{{ \"ManifestInfo\": [{{ \"Name\":\"manifest\", \"Version\":\"1\"}}]}}"; }