Skip to content

Commit 13b6cf1

Browse files
committed
Revert "fix CA1825"
This reverts commit 17e03bc.
1 parent 3686641 commit 13b6cf1

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

src/KubernetesClient/CertUtils.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public static X509Certificate2 GeneratePfx(KubernetesClientConfiguration config)
104104

105105
using (var pkcs = new MemoryStream())
106106
{
107-
store.Save(pkcs, Array.Empty<char>(), new SecureRandom());
107+
store.Save(pkcs, new char[0], new SecureRandom());
108108

109109
if (config.ClientCertificateKeyStoreFlags.HasValue)
110110
{

src/KubernetesClient/KubeConfigModels/K8SConfiguration.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ public class K8SConfiguration
3333
/// Gets or sets a map of referencable names to context configs.
3434
/// </summary>
3535
[YamlMember(Alias = "contexts")]
36-
public IEnumerable<Context> Contexts { get; set; } = System.Array.Empty<Context>();
36+
public IEnumerable<Context> Contexts { get; set; } = new Context[0];
3737

3838
/// <summary>
3939
/// Gets or sets a map of referencable names to cluster configs.
4040
/// </summary>
4141
[YamlMember(Alias = "clusters")]
42-
public IEnumerable<Cluster> Clusters { get; set; } = System.Array.Empty<Cluster>();
42+
public IEnumerable<Cluster> Clusters { get; set; } = new Cluster[0];
4343

4444
/// <summary>
4545
/// Gets or sets a map of referencable names to user configs
4646
/// </summary>
4747
[YamlMember(Alias = "users")]
48-
public IEnumerable<User> Users { get; set; } = System.Array.Empty<User>();
48+
public IEnumerable<User> Users { get; set; } = new User[0];
4949

5050
/// <summary>
5151
/// Gets or sets additional information. This is useful for extenders so that reads and writes don't clobber unknown fields.

src/KubernetesClient/KubeConfigModels/UserCredentials.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class UserCredentials
4949
/// Gets or sets the groups to imperonate.
5050
/// </summary>
5151
[YamlMember(Alias = "as-groups", ApplyNamingConventions = false)]
52-
public IEnumerable<string> ImpersonateGroups { get; set; } = System.Array.Empty<string>();
52+
public IEnumerable<string> ImpersonateGroups { get; set; } = new string[0];
5353

5454
/// <summary>
5555
/// Gets or sets additional information for impersonated user.

tests/KubernetesClient.Tests/AuthTests.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ public void Token()
396396
private X509Certificate2 OpenCertificateStore(Stream stream)
397397
{
398398
Pkcs12Store store = new Pkcs12Store();
399-
store.Load(stream, Array.Empty<char>());
399+
store.Load(stream, new char[] { });
400400

401401
var keyAlias = store.Aliases.Cast<string>().SingleOrDefault(a => store.IsKeyEntry(a));
402402

@@ -441,7 +441,7 @@ private K8SConfiguration GetK8SConfiguration(string serverUri, string token, str
441441
command = "printf";
442442
}
443443

444-
var arguments = Array.Empty<string>();
444+
var arguments = new string[] { };
445445
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
446446
{
447447
arguments = $"/c echo {responseJson}".Split(" ");

tests/KubernetesClient.Tests/Kubernetes.Exec.Tests.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public async Task NamespacedPodExecAsync_ActionNull()
190190
muxedStream.Setup(m => m.GetStream(ChannelIndex.Error, null)).Returns(errorStream);
191191

192192
var kubernetesMock = new Moq.Mock<Kubernetes>(
193-
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), Array.Empty<DelegatingHandler>() });
193+
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } });
194194
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
195195

196196
kubernetesMock.Setup(m => m.MuxedStreamNamespacedPodExecAsync("pod-name", "pod-namespace", command,
@@ -211,7 +211,7 @@ await Assert.ThrowsAsync<ArgumentNullException>(() => client.NamespacedPodExecAs
211211
public async Task NamespacedPodExecAsync_HttpException_WithStatus()
212212
{
213213
var kubernetesMock = new Moq.Mock<Kubernetes>(
214-
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), Array.Empty<DelegatingHandler>() });
214+
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } });
215215
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
216216
var handler = new ExecAsyncCallback((stdIn, stdOut, stdError) => Task.CompletedTask);
217217

@@ -234,7 +234,7 @@ public async Task NamespacedPodExecAsync_HttpException_WithStatus()
234234
public async Task NamespacedPodExecAsync_HttpException_NoStatus()
235235
{
236236
var kubernetesMock = new Moq.Mock<Kubernetes>(
237-
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), Array.Empty<DelegatingHandler>() });
237+
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } });
238238
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
239239
var handler = new ExecAsyncCallback((stdIn, stdOut, stdError) => Task.CompletedTask);
240240

@@ -257,7 +257,7 @@ public async Task NamespacedPodExecAsync_HttpException_NoStatus()
257257
public async Task NamespacedPodExecAsync_GenericException()
258258
{
259259
var kubernetesMock = new Moq.Mock<Kubernetes>(
260-
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), Array.Empty<DelegatingHandler>() });
260+
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } });
261261
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
262262
var handler = new ExecAsyncCallback((stdIn, stdOut, stdError) => Task.CompletedTask);
263263

@@ -309,7 +309,7 @@ public async Task NamespacedPodExecAsync_ExitCode_NonZero()
309309
muxedStream.Setup(m => m.GetStream(ChannelIndex.Error, null)).Returns(errorStream);
310310

311311
var kubernetesMock = new Moq.Mock<Kubernetes>(
312-
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), Array.Empty<DelegatingHandler>() });
312+
new object[] { Moq.Mock.Of<ServiceClientCredentials>(), new DelegatingHandler[] { } });
313313
var command = new string[] { "/bin/bash", "-c", "echo Hello, World!" };
314314

315315
var exception = new Exception();

tests/KubernetesClient.Tests/Mock/MockWebSocket.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public override Task CloseAsync(WebSocketCloseStatus closeStatus, string statusD
6060
this.closeStatusDescription = statusDescription;
6161
this.receiveBuffers.Enqueue(new MessageData()
6262
{
63-
Buffer = new ArraySegment<byte>(Array.Empty<byte>()),
63+
Buffer = new ArraySegment<byte>(new byte[] { }),
6464
EndOfMessage = true,
6565
MessageType = WebSocketMessageType.Close,
6666
});

0 commit comments

Comments
 (0)