Skip to content

Commit 16845ba

Browse files
authored
Style fix1 (#512)
* fix SA1505 and SA1508 * fix SA1116 * fix SA1009 * fix SA1019 * fix SA1127 * fix SA1128 * fix SA1134 * fix indent * allow CA2227 * fix CA1810 * using clean up * fix naming * fix CA1806 * fix await * Revert "fix CA1806" This reverts commit a3b4650. * fix dotnet format * allow SA1009
1 parent 82c8ae0 commit 16845ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+212
-179
lines changed

examples/logs/Logs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.IO;
32
using System.Threading.Tasks;
43
using k8s;
54

@@ -22,7 +21,8 @@ private static async Task Main(string[] args)
2221

2322
var pod = list.Items[0];
2423

25-
var response = await client.ReadNamespacedPodLogWithHttpMessagesAsync(pod.Metadata.Name,
24+
var response = await client.ReadNamespacedPodLogWithHttpMessagesAsync(
25+
pod.Metadata.Name,
2626
pod.Metadata.NamespaceProperty, follow: true).ConfigureAwait(false);
2727
var stream = response.Body;
2828
stream.CopyTo(Console.OpenStandardOutput());

kubernetes-client.ruleset

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
<Rule Id="SA1314" Action="None" />
107107

108108
<!-- A C# using directive is placed outside of a namespace element. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md -->
109-
<Rule Id="SA1200" Action="Warning" />
109+
<Rule Id="SA1200" Action="Error" />
110110

111111
<!-- An element within a C# code file is out of order in relation to the other elements in the code. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1201.md -->
112112
<Rule Id="SA1201" Action="None" />
@@ -175,7 +175,7 @@
175175
<Rule Id="SA1001" Action="Warning" />
176176

177177
<!-- A closing parenthesis within a C# statement is not spaced correctly. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1009.md -->
178-
<Rule Id="SA1009" Action="Warning" />
178+
<Rule Id="SA1009" Action="None" />
179179

180180
<!-- An opening brace within a C# element is not spaced correctly. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1012.md -->
181181
<Rule Id="SA1012" Action="Warning" />
@@ -205,10 +205,10 @@
205205
<Rule Id="CA2225" Action="None" />
206206

207207
<!-- Collection properties should be read only https://docs.microsoft.com/en-us/visualstudio/code-quality/CA2227 -->
208-
<Rule Id="CA2227" Action="Warning" />
208+
<Rule Id="CA2227" Action="None" />
209209

210210
<!-- Mark ISerializable types with SerializableAttribute https://docs.microsoft.com/en-us/visualstudio/code-quality/CA2237 -->
211-
<Rule Id="CA2237" Action="Warning" />
211+
<Rule Id="CA2237" Action="None" />
212212

213213
<!-- Do Not Disable Certificate Validation https://docs.microsoft.com/en-us/visualstudio/code-quality/CA5359 -->
214214
<Rule Id="CA5359" Action="None" />

src/KubernetesClient/Authentication/TokenFileAuth.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public TokenFileAuth(string tokenFile)
1818
TokenFile = tokenFile;
1919
}
2020

21-
public async Task<AuthenticationHeaderValue> GetAuthenticationHeaderAsync(CancellationToken cancellationToken)
21+
public Task<AuthenticationHeaderValue> GetAuthenticationHeaderAsync(CancellationToken cancellationToken)
2222
{
2323
if (TokenExpiresAt < DateTime.UtcNow)
2424
{
@@ -32,7 +32,7 @@ public async Task<AuthenticationHeaderValue> GetAuthenticationHeaderAsync(Cancel
3232
TokenExpiresAt = DateTime.UtcNow.AddMinutes(1);
3333
}
3434

35-
return new AuthenticationHeaderValue("Bearer", token);
35+
return Task.FromResult(new AuthenticationHeaderValue("Bearer", token));
3636
}
3737
}
3838
}

src/KubernetesClient/ByteBuffer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ private void Grow(int size)
282282
Array.Copy(this.buffer, 0, newBuffer, 0, this.WriteWaterMark);
283283

284284
int trailingDataLength = this.buffer.Length - this.ReadWaterMark;
285-
Array.Copy(this.buffer,
285+
Array.Copy(
286+
this.buffer,
286287
sourceIndex: this.ReadWaterMark,
287288
destinationArray: newBuffer,
288289
destinationIndex: newBuffer.Length - trailingDataLength,

src/KubernetesClient/CertUtils.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
using Org.BouncyCastle.Security;
66
using Org.BouncyCastle.X509;
77
using System;
8-
using System.Collections.Generic;
98
using System.IO;
109
using System.Security.Cryptography.X509Certificates;
11-
using System.Text.RegularExpressions;
1210

1311
namespace k8s
1412
{

src/KubernetesClient/Exceptions/KubeConfigException.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
using System;
2+
13
namespace k8s.Exceptions
24
{
3-
using System;
4-
55
/// <summary>
66
/// The exception that is thrown when the kube config is invalid
77
/// </summary>

src/KubernetesClient/Exceptions/KubernetesClientException.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
using System;
2+
13
namespace k8s.Exceptions
24
{
3-
using System;
4-
55
/// <summary>
66
/// The exception that is thrown when there is a client exception
77
/// </summary>

src/KubernetesClient/Extensions.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
using System;
2-
using System.Collections.Concurrent;
3-
using System.Linq;
4-
using System.Net;
5-
using System.Net.Http;
62
using System.Reflection;
73
using System.Text.RegularExpressions;
8-
using System.Threading.Tasks;
94
using k8s.Models;
10-
using Microsoft.Rest;
11-
using Microsoft.Rest.TransientFaultHandling;
12-
using Newtonsoft.Json.Converters;
13-
using VersionConverter = k8s.Versioning.VersionConverter;
145

156
namespace k8s
167
{
178
public static class Extensions
189
{
19-
public static KubernetesEntityAttribute GetKubernetesTypeMetadata<T>(this T obj) where T : IKubernetesObject =>
10+
public static KubernetesEntityAttribute GetKubernetesTypeMetadata<T>(this T obj)
11+
where T : IKubernetesObject
12+
=>
2013
obj.GetType().GetKubernetesTypeMetadata();
2114
public static KubernetesEntityAttribute GetKubernetesTypeMetadata(this Type currentType)
2215
{
@@ -29,7 +22,8 @@ public static KubernetesEntityAttribute GetKubernetesTypeMetadata(this Type curr
2922
return attr;
3023
}
3124

32-
public static T Initialize<T>(this T obj) where T : IKubernetesObject
25+
public static T Initialize<T>(this T obj)
26+
where T : IKubernetesObject
3327
{
3428
var metadata = obj.GetKubernetesTypeMetadata();
3529
obj.ApiVersion = !string.IsNullOrEmpty(metadata.Group) ? $"{metadata.Group}/{metadata.ApiVersion}" : metadata.ApiVersion;

src/KubernetesClient/IntstrIntOrString.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
using System;
22
using Newtonsoft.Json;
3-
using YamlDotNet.Core.Events;
4-
using YamlDotNet.Core.Tokens;
53

64
namespace k8s.Models
75
{

src/KubernetesClient/KubeConfigModels/AuthProvider.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
using System.Collections.Generic;
2+
using YamlDotNet.Serialization;
3+
14
namespace k8s.KubeConfigModels
25
{
3-
using System.Collections.Generic;
4-
using YamlDotNet.RepresentationModel;
5-
using YamlDotNet.Serialization;
6-
76
/// <summary>
87
/// Contains information that describes identity information. This is use to tell the kubernetes cluster who you are.
98
/// </summary>

0 commit comments

Comments
 (0)