diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 6515317..c3dece2 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -8,6 +8,13 @@ "dotnet-stryker" ], "rollForward": false + }, + "husky": { + "version": "0.7.1", + "commands": [ + "husky" + ], + "rollForward": false } } } \ No newline at end of file diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..c8c2dea --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# lint project based on editorconfig rules +dotnet husky run --group pre-commit diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100644 index 0000000..63f2594 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,5 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +# build project and run unit tests +dotnet husky run --group pre-push diff --git a/.husky/task-runner.json b/.husky/task-runner.json new file mode 100644 index 0000000..57978a0 --- /dev/null +++ b/.husky/task-runner.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://alirezanet.github.io/Husky.Net/schema.json", + "tasks": [ + { + "name": "dotnet-format", + "group": "pre-commit", + "command": "dotnet", + "args": [ + "format", + "--include", + "${staged}", + "--verbosity", + "diagnostic" + ], + "include": [ + "**/*.cs", + "**/*.ps1" + ] + }, + { + "name": "dotnet-build", + "group": "pre-push", + "command": "dotnet", + "args": [ + "build", + "/warnaserror" + ] + }, + { + "name": "dotnet-test", + "group": "pre-push", + "command": "dotnet", + "args": [ + "test", + "--nologo" + ] + } + ] +}