-
-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Version
0.5.4
Details
The tool doesn't care about the errors, the information attached into Steps to reproduce section
Steps to reproduce
setup and config
dotnet new console -n App1
git init
dotnet new tool-manifest
dotnet tool install Husky
dotnet husky install
dotnet husky add pre-commit -c "dotnet husky run --group pre-commit'"add .editorconfig file
https://github.com/RehanSaeed/EditorConfig/blob/main/.editorconfig
pre-commit file content
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
dotnet husky run --group pre-commit
# I want to run a condition here, e.g if dotnet format updated some files then the git commit would be rejected
exit 1 # <============ didn't work for c# filesTask-runner.json
{
"tasks": [
{
"name": "Dotnet Format",
"command": "cmd",
"pathMode": "relative",
"args": [
"/c",
"dotnet",
"format",
"--include",
"${staged}"
],
"group": "pre-commit"
}
]
}Update program.cs (with bad format)
using App1;
internal class Program
{
private static void Main(string[] args)
{
int x=100;
int xx=x;
}
}Add all files
git add .
git commit -m "init"
The problem is when I send the git commit, it will be stored successfully, but it shouldn't be.
As you can see the file should be placed in the change section.
Dotnet format worked correctly (added the file as a new file changed)
Metadata
Metadata
Assignees
Labels
No labels


