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,
|
||||
"tools": {
|
||||
"dotnet-grpc": {
|
||||
"version": "2.46.0",
|
||||
"version": "2.57.0",
|
||||
"commands": [
|
||||
"dotnet-grpc"
|
||||
]
|
||||
},
|
||||
"nuke.globaltool": {
|
||||
"version": "6.1.2",
|
||||
"version": "7.0.5",
|
||||
"commands": [
|
||||
"nuke"
|
||||
]
|
||||
},
|
||||
"gitversion.tool": {
|
||||
"version": "5.10.3",
|
||||
"version": "5.12.0",
|
||||
"commands": [
|
||||
"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
|
||||
insert_final_newline = true
|
||||
max_line_length = 120
|
||||
indent_size = 4
|
||||
|
||||
[*.xml]
|
||||
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_method = 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_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
|
||||
.editorconfig = .editorconfig
|
||||
.gitignore = .gitignore
|
||||
.pre-commit-config.yaml = .pre-commit-config.yaml
|
||||
README.md = README.md
|
||||
global.json = global.json
|
||||
EndProjectSection
|
||||
|
|
|
@ -37,8 +37,5 @@ public sealed class GenericReader : IEventReader
|
|||
|
||||
public ValueTask DisposeAsync() => _reader.DisposeAsync();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_reader.Dispose();
|
||||
}
|
||||
public void Dispose() => _reader.Dispose();
|
||||
}
|
||||
|
|
|
@ -76,13 +76,7 @@ public sealed class TypedReader<T> : IEventReader<T> where T : EventDetails, new
|
|||
} while (true);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_reader.Dispose();
|
||||
}
|
||||
public void Dispose() => _reader.Dispose();
|
||||
|
||||
public ValueTask DisposeAsync()
|
||||
{
|
||||
return _reader.DisposeAsync();
|
||||
}
|
||||
public ValueTask DisposeAsync() => _reader.DisposeAsync();
|
||||
}
|
||||
|
|
|
@ -48,8 +48,5 @@ public class INetMockFixture : IAsyncLifetime
|
|||
INetMockSocketPath = $"http://{_inetmockContainer.Hostname}:{_inetmockContainer.GetMappedPublicPort(6767)}";
|
||||
}
|
||||
|
||||
public async Task DisposeAsync()
|
||||
{
|
||||
await _inetmockContainer.StopAsync();
|
||||
}
|
||||
public async Task DisposeAsync() => await _inetmockContainer.StopAsync();
|
||||
}
|
||||
|
|
|
@ -5,11 +5,9 @@ namespace INetMock.Client.Test.Hex;
|
|||
|
||||
public static class Converter
|
||||
{
|
||||
public static byte[] HexToByteArray(this string hex)
|
||||
{
|
||||
return Enumerable.Range(0, hex.Length)
|
||||
public static byte[] HexToByteArray(this string hex) =>
|
||||
Enumerable.Range(0, hex.Length)
|
||||
.Where(x => x % 2 == 0)
|
||||
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||
<PackageReference Include="xunit" Version="2.5.0" />
|
||||
|
@ -19,9 +17,11 @@
|
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\INetMock.Client\INetMock.Client.csproj" />
|
||||
</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>
|
Loading…
Reference in a new issue