Skip to content

Commit

Permalink
Style fix final (kubernetes-client#523)
Browse files Browse the repository at this point in the history
* all net5

* var

* SA1310

* SA1310

* allow 1031

* SA1805

* fix SA1642

* remove unused code

* allow sa1405

* isempty

* fix CA1714

* fix CA1806

* remove always false if

* fix format

* fix CA1062

* allow SA0001

* fix CA1062

* allow ca1034 and temp allow ca1835

* fix 16XX doc related warnings

* elm SA16XX

* elm SA16XX

* fix CA2213

* revert to pass all test

* move unclear rule to ruleset

* follow up of moving ruleset

* remove this

* fix test flaky
  • Loading branch information
tg123 authored Nov 22, 2020
1 parent 8003ab0 commit 5be3cff
Show file tree
Hide file tree
Showing 74 changed files with 841 additions and 628 deletions.
7 changes: 3 additions & 4 deletions examples/attach/attach.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>7.1</LangVersion>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

</Project>
3 changes: 1 addition & 2 deletions examples/exec/exec.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<LangVersion>7.1</LangVersion>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

</Project>
3 changes: 1 addition & 2 deletions examples/httpClientFactory/httpClientFactory.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>latest</LangVersion>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions examples/labels/labels.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

</Project>
5 changes: 2 additions & 3 deletions examples/logs/logs.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<LangVersion>7.1</LangVersion>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions examples/metrics/metrics.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions examples/namespace/namespace.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions examples/patch/patch.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions examples/simple/simple.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\..\src\KubernetesClient\KubernetesClient.csproj" />
</ItemGroup>

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

</Project>
4 changes: 2 additions & 2 deletions examples/watch/watch.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion gen/KubernetesWatchGenerator/Kubernetes.Watch.cs.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace k8s
public partial class Kubernetes
{
{{#.}}
/// <inheritdoc>
/// <inheritdoc/>
public Task<Watcher<{{GetClassName operation}}>> {{GetMethodName operation}}(
{{#operation.actualParameters}}
{{#isRequired}}
Expand Down
3 changes: 1 addition & 2 deletions gen/KubernetesWatchGenerator/KubernetesWatchGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<TargetFramework>net5</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
12 changes: 6 additions & 6 deletions gen/KubernetesWatchGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private static async Task Main(string[] args)
.ToHashSet();

_classNameToPluralMap = swagger.Operations
.Where(x => x.Operation.OperationId.StartsWith("list"))
.Where(x => x.Operation.OperationId.StartsWith("list", StringComparison.InvariantCulture))
.Select(x =>
{
return new
Expand All @@ -82,7 +82,7 @@ private static async Task Main(string[] args)

// dictionary only contains "list" plural maps. assign the same plural names to entities those lists support
_classNameToPluralMap = _classNameToPluralMap
.Where(x => x.Key.EndsWith("List"))
.Where(x => x.Key.EndsWith("List", StringComparison.InvariantCulture))
.Select(x =>
new { ClassName = x.Key.Remove(x.Key.Length - 4), PluralName = x.Value })
.ToDictionary(x => x.ClassName, x => x.PluralName)
Expand Down Expand Up @@ -171,9 +171,9 @@ private static void ToXmlDoc(RenderContext context, IList<object> arguments, IDi
{
if (arguments != null && arguments.Count > 0 && arguments[0] != null && arguments[0] is string)
{
bool first = true;
var first = true;

using (StringReader reader = new StringReader(arguments[0] as string))
using (var reader = new StringReader(arguments[0] as string))
{
string line = null;
while ((line = reader.ReadLine()) != null)
Expand Down Expand Up @@ -496,9 +496,9 @@ private static void GetPathExpression(RenderContext context, IList<object> argum

private static string GetPathExpression(SwaggerOperationDescription operation)
{
string pathExpression = operation.Path;
var pathExpression = operation.Path;

if (pathExpression.StartsWith("/"))
if (pathExpression.StartsWith("/", StringComparison.InvariantCulture))
{
pathExpression = pathExpression.Substring(1);
}
Expand Down
16 changes: 12 additions & 4 deletions kubernetes-client.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Rule Id="SA1402" Action="Error" />

<!-- A call to Debug.Assert in C# code does not include a descriptive message. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1405.md -->
<Rule Id="SA1405" Action="Warning" />
<Rule Id="SA1405" Action="None" />

<!-- The last statement in a multi-line C# initializer or list is missing a trailing comma. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1413.md -->
<Rule Id="SA1413" Action="Error" />
Expand Down Expand Up @@ -187,7 +187,7 @@
<Rule Id="SA1028" Action="Warning" />

<!-- All diagnostics of XML documentation comments has been disabled due to the current project configuration. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA0001.md -->
<Rule Id="SA0001" Action="Warning" />
<Rule Id="SA0001" Action="None" />

<!-- Call GC.SuppressFinalize correctly https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1816 -->
<Rule Id="CA1816" Action="Error" />
Expand Down Expand Up @@ -220,10 +220,10 @@
<Rule Id="CA1028" Action="Warning" />

<!-- Do not catch general exception types https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1031 -->
<Rule Id="CA1031" Action="Warning" />
<Rule Id="CA1031" Action="None" />

<!-- Nested types should not be visible https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1034 -->
<Rule Id="CA1034" Action="Warning" />
<Rule Id="CA1034" Action="None" />

<!-- Do not declare visible instance fields https://docs.microsoft.com/en-us/visualstudio/code-quality/CA1051 -->
<Rule Id="CA1051" Action="Warning" />
Expand Down Expand Up @@ -293,5 +293,13 @@
<!-- TODO -->
<Rule Id="CA2008" Action="None" />

<!-- TODO only in netcore2.1+-->
<Rule Id="CA1835" Action="Info" />

<!-- TODO missing doc-->
<Rule Id="CS1591" Action="None" />
<Rule Id="CS1573" Action="None" />
<Rule Id="CS1574" Action="None" />

</Rules>
</RuleSet>
Loading

0 comments on commit 5be3cff

Please sign in to comment.