refactor: use Husky.NET instead of pre-commit
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
980414b794
commit
b642b7bc9b
12 changed files with 91 additions and 68 deletions
|
@ -3,22 +3,34 @@
|
||||||
"isRoot": true,
|
"isRoot": true,
|
||||||
"tools": {
|
"tools": {
|
||||||
"dotnet-grpc": {
|
"dotnet-grpc": {
|
||||||
"version": "2.46.0",
|
"version": "2.57.0",
|
||||||
"commands": [
|
"commands": [
|
||||||
"dotnet-grpc"
|
"dotnet-grpc"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"nuke.globaltool": {
|
"nuke.globaltool": {
|
||||||
"version": "6.1.2",
|
"version": "7.0.5",
|
||||||
"commands": [
|
"commands": [
|
||||||
"nuke"
|
"nuke"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"gitversion.tool": {
|
"gitversion.tool": {
|
||||||
"version": "5.10.3",
|
"version": "5.12.0",
|
||||||
"commands": [
|
"commands": [
|
||||||
"dotnet-gitversion"
|
"dotnet-gitversion"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"husky": {
|
||||||
|
"version": "0.6.1",
|
||||||
|
"commands": [
|
||||||
|
"husky"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"jetbrains.resharper.globaltools": {
|
||||||
|
"version": "2023.2.1",
|
||||||
|
"commands": [
|
||||||
|
"jb"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@ end_of_line = lf
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
max_line_length = 120
|
max_line_length = 120
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
[*.xml]
|
[*.xml]
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
@ -18,7 +19,7 @@ dotnet_style_qualification_for_field = false:warning
|
||||||
dotnet_style_qualification_for_property = false:warning
|
dotnet_style_qualification_for_property = false:warning
|
||||||
dotnet_style_qualification_for_method = false:warning
|
dotnet_style_qualification_for_method = false:warning
|
||||||
dotnet_style_qualification_for_event = false:warning
|
dotnet_style_qualification_for_event = false:warning
|
||||||
dotnet_style_require_accessibility_modifiers = never:warning
|
dotnet_style_require_accessibility_modifiers = omit_if_default:warning
|
||||||
|
|
||||||
csharp_style_expression_bodied_methods = true:silent
|
csharp_style_expression_bodied_methods = true:silent
|
||||||
csharp_style_expression_bodied_properties = true:warning
|
csharp_style_expression_bodied_properties = true:warning
|
||||||
|
|
4
.husky/pre-commit
Executable file
4
.husky/pre-commit
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
dotnet husky run --group pre-commit
|
34
.husky/task-runner.json
Normal file
34
.husky/task-runner.json
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"name": "dotnet-format",
|
||||||
|
"group": "pre-commit",
|
||||||
|
"command": "dotnet",
|
||||||
|
"args": [
|
||||||
|
"dotnet-format",
|
||||||
|
"--include",
|
||||||
|
"${staged}"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"**/*.cs",
|
||||||
|
"**/*.vb"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Run JB Clean Up Code",
|
||||||
|
"group": "pre-commit",
|
||||||
|
"command": "dotnet",
|
||||||
|
"pathMode": "relative",
|
||||||
|
"args": [
|
||||||
|
"jb",
|
||||||
|
"cleanupcode",
|
||||||
|
"INetMock.sln",
|
||||||
|
"--telemetry-optout"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"**/*.cs",
|
||||||
|
"**/*.vb"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,13 +0,0 @@
|
||||||
# See https://pre-commit.com for more information
|
|
||||||
# See https://pre-commit.com/hooks.html for more hooks
|
|
||||||
repos:
|
|
||||||
- repo: https://github.com/dotnet/format
|
|
||||||
rev: "v5.1.225507" # Specify a tag or sha here, or run "pre-commit autoupdate"
|
|
||||||
hooks:
|
|
||||||
- id: dotnet-format
|
|
||||||
args:
|
|
||||||
- ""
|
|
||||||
- --folder
|
|
||||||
- --check
|
|
||||||
- --verbosity=detailed
|
|
||||||
- --include
|
|
|
@ -7,7 +7,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.editorconfig = .editorconfig
|
.editorconfig = .editorconfig
|
||||||
.gitignore = .gitignore
|
.gitignore = .gitignore
|
||||||
.pre-commit-config.yaml = .pre-commit-config.yaml
|
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
global.json = global.json
|
global.json = global.json
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
|
|
|
@ -37,8 +37,5 @@ public sealed class GenericReader : IEventReader
|
||||||
|
|
||||||
public ValueTask DisposeAsync() => _reader.DisposeAsync();
|
public ValueTask DisposeAsync() => _reader.DisposeAsync();
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose() => _reader.Dispose();
|
||||||
{
|
|
||||||
_reader.Dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,13 +76,7 @@ public sealed class TypedReader<T> : IEventReader<T> where T : EventDetails, new
|
||||||
} while (true);
|
} while (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose() => _reader.Dispose();
|
||||||
{
|
|
||||||
_reader.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueTask DisposeAsync()
|
public ValueTask DisposeAsync() => _reader.DisposeAsync();
|
||||||
{
|
|
||||||
return _reader.DisposeAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,5 @@ public class INetMockFixture : IAsyncLifetime
|
||||||
INetMockSocketPath = $"http://{_inetmockContainer.Hostname}:{_inetmockContainer.GetMappedPublicPort(6767)}";
|
INetMockSocketPath = $"http://{_inetmockContainer.Hostname}:{_inetmockContainer.GetMappedPublicPort(6767)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task DisposeAsync()
|
public async Task DisposeAsync() => await _inetmockContainer.StopAsync();
|
||||||
{
|
|
||||||
await _inetmockContainer.StopAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,9 @@ namespace INetMock.Client.Test.Hex;
|
||||||
|
|
||||||
public static class Converter
|
public static class Converter
|
||||||
{
|
{
|
||||||
public static byte[] HexToByteArray(this string hex)
|
public static byte[] HexToByteArray(this string hex) =>
|
||||||
{
|
Enumerable.Range(0, hex.Length)
|
||||||
return Enumerable.Range(0, hex.Length)
|
|
||||||
.Where(x => x % 2 == 0)
|
.Where(x => x % 2 == 0)
|
||||||
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
|
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||||
<PackageReference Include="xunit" Version="2.5.0" />
|
<PackageReference Include="xunit" Version="2.5.0" />
|
||||||
|
@ -19,9 +17,11 @@
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\src\INetMock.Client\INetMock.Client.csproj" />
|
<ProjectReference Include="..\..\src\INetMock.Client\INetMock.Client.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<Target Name="Husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
|
||||||
|
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" />
|
||||||
|
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory="../.." />
|
||||||
|
</Target>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in a new issue