Skip to content

Commit

Permalink
Setup pre-commit and pre-push hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanGreve committed Nov 9, 2024
1 parent ccceced commit 052ff45
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
"dotnet-stryker"
],
"rollForward": false
},
"husky": {
"version": "0.7.1",
"commands": [
"husky"
],
"rollForward": false
}
}
}
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# lint project based on editorconfig rules
dotnet husky run --group pre-commit
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# build project and run unit tests
dotnet husky run --group pre-push
39 changes: 39 additions & 0 deletions .husky/task-runner.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
]
}

0 comments on commit 052ff45

Please sign in to comment.