Skip to content

Commit cfc4306

Browse files
authored
stylecop fix followup, enforce SA1503 (#432)
* enforce SA1503 * fix spacing * fix SA1413 * fix spacing * fix SA1013
1 parent 324a3e7 commit cfc4306

File tree

75 files changed

+1072
-786
lines changed

Some content is hidden

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

75 files changed

+1072
-786
lines changed

Directory.Build.targets

+4
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@
88
<PrivateAssets>All</PrivateAssets>
99
</PackageReference>
1010
</ItemGroup>
11+
12+
<ItemGroup>
13+
<AdditionalFiles Include="$(MSBuildThisFileDirectory)\stylecop.json" Visible="false" />
14+
</ItemGroup>
1115
</Project>

examples/attach/Attach.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ private static async Task Main(string[] args)
2323

2424
private async static Task AttachToPod(IKubernetes client, V1Pod pod)
2525
{
26-
var webSocket = await client.WebSocketNamespacedPodAttachAsync(pod.Metadata.Name, "default", pod.Spec.Containers[0].Name);
26+
var webSocket =
27+
await client.WebSocketNamespacedPodAttachAsync(pod.Metadata.Name, "default",
28+
pod.Spec.Containers[0].Name);
2729

2830
var demux = new StreamDemuxer(webSocket);
2931
demux.Start();

examples/exec/Exec.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ private static async Task Main(string[] args)
2020

2121
private async static Task ExecInPod(IKubernetes client, V1Pod pod)
2222
{
23-
var webSocket = await client.WebSocketNamespacedPodExecAsync(pod.Metadata.Name, "default", "ls", pod.Spec.Containers[0].Name);
23+
var webSocket =
24+
await client.WebSocketNamespacedPodExecAsync(pod.Metadata.Name, "default", "ls",
25+
pod.Spec.Containers[0].Name);
2426

2527
var demux = new StreamDemuxer(webSocket);
2628
demux.Start();

examples/httpClientFactory/PodListHostedService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
2828
{
2929
_logger.LogInformation(item.Metadata.Name);
3030
}
31+
3132
if (list.Items.Count == 0)
3233
{
3334
_logger.LogInformation("Empty!");

examples/httpClientFactory/Program.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ public static async Task Main(string[] args)
1212
{
1313
// Learn more about generic hosts at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host
1414
using (var host = new HostBuilder()
15-
.ConfigureLogging((logging) =>
16-
{
17-
logging.AddConsole();
18-
})
15+
.ConfigureLogging((logging) => { logging.AddConsole(); })
1916
.ConfigureServices((hostBuilderContext, services) =>
2017
{
2118
// Ideally this config would be read from the .net core config constructs,

examples/labels/PodList.cs

+4
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,26 @@ private static void Main(string[] args)
2121
{
2222
continue;
2323
}
24+
2425
var labels = new List<string>();
2526
foreach (var key in item.Spec.Selector)
2627
{
2728
labels.Add(key.Key + "=" + key.Value);
2829
}
30+
2931
var labelStr = string.Join(",", labels.ToArray());
3032
Console.WriteLine(labelStr);
3133
var podList = client.ListNamespacedPod("default", labelSelector: labelStr);
3234
foreach (var pod in podList.Items)
3335
{
3436
Console.WriteLine(pod.Metadata.Name);
3537
}
38+
3639
if (podList.Items.Count == 0)
3740
{
3841
Console.WriteLine("Empty!");
3942
}
43+
4044
Console.WriteLine();
4145
}
4246
}

examples/logs/Logs.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ private static async Task Main(string[] args)
1919
Console.WriteLine("No pods!");
2020
return;
2121
}
22+
2223
var pod = list.Items[0];
2324

24-
var response = await client.ReadNamespacedPodLogWithHttpMessagesAsync(pod.Metadata.Name, pod.Metadata.NamespaceProperty, follow: true);
25+
var response = await client.ReadNamespacedPodLogWithHttpMessagesAsync(pod.Metadata.Name,
26+
pod.Metadata.NamespaceProperty, follow: true);
2527
var stream = response.Body;
2628
stream.CopyTo(Console.OpenStandardOutput());
2729
}

examples/namespace/Namespace.cs

+4-7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ static void ListNamespaces(IKubernetes client)
1515
{
1616
Console.WriteLine(item.Metadata.Name);
1717
}
18+
1819
if (list.Items.Count == 0)
1920
{
2021
Console.WriteLine("Empty!");
@@ -41,6 +42,7 @@ static async Task DeleteAsync(IKubernetes client, string name, int delayMillis)
4142
{
4243
return;
4344
}
45+
4446
throw ex;
4547
}
4648
}
@@ -51,6 +53,7 @@ static async Task DeleteAsync(IKubernetes client, string name, int delayMillis)
5153
{
5254
return;
5355
}
56+
5457
throw ex;
5558
}
5659
}
@@ -68,13 +71,7 @@ private static void Main(string[] args)
6871

6972
ListNamespaces(client);
7073

71-
var ns = new V1Namespace
72-
{
73-
Metadata = new V1ObjectMeta
74-
{
75-
Name = "test"
76-
}
77-
};
74+
var ns = new V1Namespace { Metadata = new V1ObjectMeta { Name = "test" } };
7875

7976
var result = client.CreateNamespace(ns);
8077
Console.WriteLine(result);

examples/patch/Program.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ private static void Main(string[] args)
2020
var name = pod.Metadata.Name;
2121
PrintLabels(pod);
2222

23-
var newlabels = new Dictionary<string, string>(pod.Metadata.Labels)
24-
{
25-
["test"] = "test"
26-
};
23+
var newlabels = new Dictionary<string, string>(pod.Metadata.Labels) { ["test"] = "test" };
2724
var patch = new JsonPatchDocument<V1Pod>();
2825
patch.Replace(e => e.Metadata.Labels, newlabels);
2926
client.PatchNamespacedPod(new V1Patch(patch), name, "default");
@@ -38,6 +35,7 @@ private static void PrintLabels(V1Pod pod)
3835
{
3936
Console.WriteLine($"{k} : {v}");
4037
}
38+
4139
Console.WriteLine("=-=-=-=-=-=-=-=-=-=-=");
4240
}
4341
}

examples/simple/PodList.cs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ private static void Main(string[] args)
1616
{
1717
Console.WriteLine(item.Metadata.Name);
1818
}
19+
1920
if (list.Items.Count == 0)
2021
{
2122
Console.WriteLine("Empty!");

0 commit comments

Comments
 (0)