Stylecop (#428)
* add auto generate header * run gen * introduce first style analyizer * fix tab
This commit is contained in:
6
Directory.Build.props
Normal file
6
Directory.Build.props
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)\kubernetes-client.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
11
Directory.Build.targets
Normal file
11
Directory.Build.targets
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||
<PrivateAssets>All</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,3 +1,8 @@
|
||||
// <auto-generated>
|
||||
// Code generated by gen/KubernetesWatchGenerator
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
// </auto-generated>
|
||||
using k8s.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
// <auto-generated>
|
||||
// Code generated by gen/KubernetesWatchGenerator
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
// </auto-generated>
|
||||
using k8s.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
// <auto-generated>
|
||||
// Code generated by gen/KubernetesWatchGenerator
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
// </auto-generated>
|
||||
namespace k8s.Models
|
||||
{
|
||||
{{#.}}
|
||||
|
||||
8
kubernetes-client.ruleset
Normal file
8
kubernetes-client.ruleset
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="kubernetes-client" ToolsVersion="10.0">
|
||||
|
||||
<!-- https://github.com/DotNetAnalyzers/StyleCopAnalyzers/tree/master/documentation -->
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
||||
<Rule Id="SA1027" Action="Error" />
|
||||
</Rules>
|
||||
</RuleSet>
|
||||
@@ -1,3 +1,8 @@
|
||||
// <auto-generated>
|
||||
// Code generated by gen/KubernetesWatchGenerator
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
// </auto-generated>
|
||||
using k8s.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
// <auto-generated>
|
||||
// Code generated by gen/KubernetesWatchGenerator
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
// </auto-generated>
|
||||
using k8s.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
// <auto-generated>
|
||||
// Code generated by gen/KubernetesWatchGenerator
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
// </auto-generated>
|
||||
namespace k8s.Models
|
||||
{
|
||||
[KubernetesEntity(Group="admissionregistration.k8s.io", Kind="MutatingWebhookConfiguration", ApiVersion="v1", PluralName="mutatingwebhookconfigurations")]
|
||||
|
||||
5
stylecop.json
Normal file
5
stylecop.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
|
||||
"settings": {
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@ using Xunit.Abstractions;
|
||||
namespace k8s.Tests.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// An implementation of <see cref="ILogger"/> that writes to the output of the current Xunit test.
|
||||
/// An implementation of <see cref="ILogger"/> that writes to the output of the current Xunit test.
|
||||
/// </summary>
|
||||
sealed class TestOutputLogger
|
||||
: ILogger
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new <see cref="TestOutputLogger"/>.
|
||||
/// Create a new <see cref="TestOutputLogger"/>.
|
||||
/// </summary>
|
||||
/// <param name="testOutput">
|
||||
/// The output for the current test.
|
||||
@@ -21,7 +21,7 @@ namespace k8s.Tests.Logging
|
||||
/// The logger's category name.
|
||||
/// </param>
|
||||
/// <param name="minLogLevel">
|
||||
/// The logger's minimum log level.
|
||||
/// The logger's minimum log level.
|
||||
/// </param>
|
||||
public TestOutputLogger(ITestOutputHelper testOutput, string loggerCategory, LogLevel minLogLevel)
|
||||
{
|
||||
@@ -47,27 +47,27 @@ namespace k8s.Tests.Logging
|
||||
public string LoggerCategory { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The logger's minimum log level.
|
||||
/// The logger's minimum log level.
|
||||
/// </summary>
|
||||
public LogLevel MinLogLevel { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Emit a log entry.
|
||||
/// Emit a log entry.
|
||||
/// </summary>
|
||||
/// <param name="level">
|
||||
/// The log entry's level.
|
||||
/// The log entry's level.
|
||||
/// </param>
|
||||
/// <param name="eventId">
|
||||
/// The log entry's associated event Id.
|
||||
/// The log entry's associated event Id.
|
||||
/// </param>
|
||||
/// <param name="state">
|
||||
/// The log entry to be written. Can be also an object.
|
||||
/// The log entry to be written. Can be also an object.
|
||||
/// </param>
|
||||
/// <param name="exception">
|
||||
/// The exception (if any) related to the log entry.
|
||||
/// The exception (if any) related to the log entry.
|
||||
/// </param>
|
||||
/// <param name="formatter">
|
||||
/// A function that creates a <c>string</c> log message from the <paramref name="state"/> and <paramref name="exception"/>.
|
||||
/// A function that creates a <c>string</c> log message from the <paramref name="state"/> and <paramref name="exception"/>.
|
||||
/// </param>
|
||||
public void Log<TState>(LogLevel level, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
|
||||
{
|
||||
@@ -89,24 +89,24 @@ namespace k8s.Tests.Logging
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the given <paramref name="logLevel"/> is enabled.
|
||||
/// Check if the given <paramref name="logLevel"/> is enabled.
|
||||
/// </summary>
|
||||
/// <param name="logLevel">
|
||||
/// The level to be checked.
|
||||
/// The level to be checked.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if enabled; otherwise, <c>false</c>.
|
||||
/// <c>true</c> if enabled; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
public bool IsEnabled(LogLevel logLevel) => logLevel >= MinLogLevel;
|
||||
|
||||
/// <summary>
|
||||
/// Begin a logical operation scope.
|
||||
/// Begin a logical operation scope.
|
||||
/// </summary>
|
||||
/// <param name="state">
|
||||
/// An identifier for the scope.
|
||||
/// An identifier for the scope.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// An <see cref="IDisposable"/> that ends the logical operation scope when disposed.
|
||||
/// An <see cref="IDisposable"/> that ends the logical operation scope when disposed.
|
||||
/// </returns>
|
||||
public IDisposable BeginScope<TState>(TState state) => Disposable.Empty;
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ namespace k8s.Tests.Logging
|
||||
: ILoggerProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new <see cref="TestOutputLoggerProvider"/>.
|
||||
/// Create a new <see cref="TestOutputLoggerProvider"/>.
|
||||
/// </summary>
|
||||
/// <param name="testOutput">
|
||||
/// The output for the current test.
|
||||
/// </param>
|
||||
/// <param name="minLogLevel">
|
||||
/// The logger's minimum log level.
|
||||
/// The logger's minimum log level.
|
||||
/// </param>
|
||||
public TestOutputLoggerProvider(ITestOutputHelper testOutput, LogLevel minLogLevel)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace k8s.Tests.Logging
|
||||
ITestOutputHelper TestOutput { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The logger's minimum log level.
|
||||
/// The logger's minimum log level.
|
||||
/// </summary>
|
||||
public LogLevel MinLogLevel { get; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user