Skip to content

stylecop fix followup, enforce SA1503 #432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -8,4 +8,8 @@
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)\stylecop.json" Visible="false" />
</ItemGroup>
</Project>
4 changes: 3 additions & 1 deletion examples/attach/Attach.cs
Original file line number Diff line number Diff line change
@@ -23,7 +23,9 @@ private static async Task Main(string[] args)

private async static Task AttachToPod(IKubernetes client, V1Pod pod)
{
var webSocket = await client.WebSocketNamespacedPodAttachAsync(pod.Metadata.Name, "default", pod.Spec.Containers[0].Name);
var webSocket =
await client.WebSocketNamespacedPodAttachAsync(pod.Metadata.Name, "default",
pod.Spec.Containers[0].Name);

var demux = new StreamDemuxer(webSocket);
demux.Start();
4 changes: 3 additions & 1 deletion examples/exec/Exec.cs
Original file line number Diff line number Diff line change
@@ -20,7 +20,9 @@ private static async Task Main(string[] args)

private async static Task ExecInPod(IKubernetes client, V1Pod pod)
{
var webSocket = await client.WebSocketNamespacedPodExecAsync(pod.Metadata.Name, "default", "ls", pod.Spec.Containers[0].Name);
var webSocket =
await client.WebSocketNamespacedPodExecAsync(pod.Metadata.Name, "default", "ls",
pod.Spec.Containers[0].Name);

var demux = new StreamDemuxer(webSocket);
demux.Start();
1 change: 1 addition & 0 deletions examples/httpClientFactory/PodListHostedService.cs
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ public async Task StartAsync(CancellationToken cancellationToken)
{
_logger.LogInformation(item.Metadata.Name);
}

if (list.Items.Count == 0)
{
_logger.LogInformation("Empty!");
5 changes: 1 addition & 4 deletions examples/httpClientFactory/Program.cs
Original file line number Diff line number Diff line change
@@ -12,10 +12,7 @@ public static async Task Main(string[] args)
{
// Learn more about generic hosts at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host
using (var host = new HostBuilder()
.ConfigureLogging((logging) =>
{
logging.AddConsole();
})
.ConfigureLogging((logging) => { logging.AddConsole(); })
.ConfigureServices((hostBuilderContext, services) =>
{
// Ideally this config would be read from the .net core config constructs,
4 changes: 4 additions & 0 deletions examples/labels/PodList.cs
Original file line number Diff line number Diff line change
@@ -21,22 +21,26 @@ private static void Main(string[] args)
{
continue;
}

var labels = new List<string>();
foreach (var key in item.Spec.Selector)
{
labels.Add(key.Key + "=" + key.Value);
}

var labelStr = string.Join(",", labels.ToArray());
Console.WriteLine(labelStr);
var podList = client.ListNamespacedPod("default", labelSelector: labelStr);
foreach (var pod in podList.Items)
{
Console.WriteLine(pod.Metadata.Name);
}

if (podList.Items.Count == 0)
{
Console.WriteLine("Empty!");
}

Console.WriteLine();
}
}
4 changes: 3 additions & 1 deletion examples/logs/Logs.cs
Original file line number Diff line number Diff line change
@@ -19,9 +19,11 @@ private static async Task Main(string[] args)
Console.WriteLine("No pods!");
return;
}

var pod = list.Items[0];

var response = await client.ReadNamespacedPodLogWithHttpMessagesAsync(pod.Metadata.Name, pod.Metadata.NamespaceProperty, follow: true);
var response = await client.ReadNamespacedPodLogWithHttpMessagesAsync(pod.Metadata.Name,
pod.Metadata.NamespaceProperty, follow: true);
var stream = response.Body;
stream.CopyTo(Console.OpenStandardOutput());
}
11 changes: 4 additions & 7 deletions examples/namespace/Namespace.cs
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ static void ListNamespaces(IKubernetes client)
{
Console.WriteLine(item.Metadata.Name);
}

if (list.Items.Count == 0)
{
Console.WriteLine("Empty!");
@@ -41,6 +42,7 @@ static async Task DeleteAsync(IKubernetes client, string name, int delayMillis)
{
return;
}

throw ex;
}
}
@@ -51,6 +53,7 @@ static async Task DeleteAsync(IKubernetes client, string name, int delayMillis)
{
return;
}

throw ex;
}
}
@@ -68,13 +71,7 @@ private static void Main(string[] args)

ListNamespaces(client);

var ns = new V1Namespace
{
Metadata = new V1ObjectMeta
{
Name = "test"
}
};
var ns = new V1Namespace { Metadata = new V1ObjectMeta { Name = "test" } };

var result = client.CreateNamespace(ns);
Console.WriteLine(result);
6 changes: 2 additions & 4 deletions examples/patch/Program.cs
Original file line number Diff line number Diff line change
@@ -20,10 +20,7 @@ private static void Main(string[] args)
var name = pod.Metadata.Name;
PrintLabels(pod);

var newlabels = new Dictionary<string, string>(pod.Metadata.Labels)
{
["test"] = "test"
};
var newlabels = new Dictionary<string, string>(pod.Metadata.Labels) { ["test"] = "test" };
var patch = new JsonPatchDocument<V1Pod>();
patch.Replace(e => e.Metadata.Labels, newlabels);
client.PatchNamespacedPod(new V1Patch(patch), name, "default");
@@ -38,6 +35,7 @@ private static void PrintLabels(V1Pod pod)
{
Console.WriteLine($"{k} : {v}");
}

Console.WriteLine("=-=-=-=-=-=-=-=-=-=-=");
}
}
1 change: 1 addition & 0 deletions examples/simple/PodList.cs
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ private static void Main(string[] args)
{
Console.WriteLine(item.Metadata.Name);
}

if (list.Items.Count == 0)
{
Console.WriteLine("Empty!");
Loading