From f4966d8d73c6b82cfd9f3c1b7a2712d0a587ca87 Mon Sep 17 00:00:00 2001 From: Andre Hofmeister <9199345+HofmeisterAn@users.noreply.github.com> Date: Thu, 3 Oct 2024 20:11:08 +0200 Subject: [PATCH] fix: Remove Sonar code smells --- src/Testcontainers.Neo4j/Neo4jBuilder.cs | 4 ++-- src/Testcontainers/Clients/DockerImageOperations.cs | 2 +- tests/Testcontainers.Platform.Linux.Tests/Usings.cs | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Testcontainers.Neo4j/Neo4jBuilder.cs b/src/Testcontainers.Neo4j/Neo4jBuilder.cs index 14013d278..0dc610619 100644 --- a/src/Testcontainers.Neo4j/Neo4jBuilder.cs +++ b/src/Testcontainers.Neo4j/Neo4jBuilder.cs @@ -78,10 +78,10 @@ public Neo4jBuilder WithEnterpriseEdition(bool acceptLicenseAgreement) { tag = image.Tag; } - else if (image.MatchVersion(v => operatingSystems.Any(v.Contains))) + else if (image.MatchVersion(v => Array.Exists(operatingSystems, v.Contains))) { MatchEvaluator evaluator = match => $"{enterpriseSuffix}-{match.Value}"; - tag = Regex.Replace(image.Tag, string.Join("|", operatingSystems), evaluator); + tag = Regex.Replace(image.Tag, string.Join("|", operatingSystems), evaluator, RegexOptions.None, TimeSpan.FromSeconds(1)); } else { diff --git a/src/Testcontainers/Clients/DockerImageOperations.cs b/src/Testcontainers/Clients/DockerImageOperations.cs index fb54c75b9..1b55f6b4a 100644 --- a/src/Testcontainers/Clients/DockerImageOperations.cs +++ b/src/Testcontainers/Clients/DockerImageOperations.cs @@ -59,7 +59,7 @@ public async Task CreateAsync(IImage image, IDockerRegistryAuthenticationConfigu { var createParameters = new ImagesCreateParameters { - FromImage = image.FullName + FromImage = image.FullName, }; var authConfig = new AuthConfig diff --git a/tests/Testcontainers.Platform.Linux.Tests/Usings.cs b/tests/Testcontainers.Platform.Linux.Tests/Usings.cs index ea641a068..526c18ed7 100644 --- a/tests/Testcontainers.Platform.Linux.Tests/Usings.cs +++ b/tests/Testcontainers.Platform.Linux.Tests/Usings.cs @@ -8,7 +8,6 @@ global using System.Text; global using System.Threading; global using System.Threading.Tasks; -global using Docker.DotNet; global using Docker.DotNet.Models; global using DotNet.Testcontainers; global using DotNet.Testcontainers.Builders;