Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* add auto generate header

* run gen

* introduce first style analyizer

* fix tab
  • Loading branch information
tg123 authored Apr 22, 2020
1 parent c1de779 commit 8e7bf0b
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 19 deletions.
6 changes: 6 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -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>
5 changes: 5 additions & 0 deletions gen/KubernetesWatchGenerator/IKubernetes.Watch.cs.template
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 5 additions & 0 deletions gen/KubernetesWatchGenerator/Kubernetes.Watch.cs.template
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
5 changes: 5 additions & 0 deletions gen/KubernetesWatchGenerator/ModelExtensions.cs.template
Original file line number Diff line number Diff line change
@@ -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
{
{{#.}}
Expand Down
8 changes: 8 additions & 0 deletions kubernetes-client.ruleset
Original file line number Diff line number Diff line change
@@ -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>
5 changes: 5 additions & 0 deletions src/KubernetesClient/generated/IKubernetes.Watch.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/KubernetesClient/generated/Kubernetes.Watch.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/KubernetesClient/generated/ModelExtensions.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions stylecop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
"settings": {
}
}
32 changes: 16 additions & 16 deletions tests/KubernetesClient.Tests/Logging/TestOutputLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
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.
Expand All @@ -21,7 +21,7 @@ sealed class TestOutputLogger
/// 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)
{
Expand All @@ -47,27 +47,27 @@ public TestOutputLogger(ITestOutputHelper testOutput, string loggerCategory, Log
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)
{
Expand All @@ -89,24 +89,24 @@ public void Log<TState>(LogLevel level, EventId eventId, TState state, Exception
}

/// <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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ sealed class TestOutputLoggerProvider
: 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)
{
Expand All @@ -41,7 +41,7 @@ public void Dispose()
ITestOutputHelper TestOutput { get; }

/// <summary>
/// The logger's minimum log level.
/// The logger's minimum log level.
/// </summary>
public LogLevel MinLogLevel { get; }

Expand Down

0 comments on commit 8e7bf0b

Please sign in to comment.