Demo commit-linter Args appear empty even with commit message argument #64
-
Hi there, We have been using this Husky.Net in task-runner.json to run things like dotnet format, dotnet build and dotnet test, so thank you for creating it. Lately I have been experimenting trying to add commit message linting, so I tried using the excellent example posted. However, I'm running into a problem where using example provided is not succeeding fully. I have Husky 0.5.4 installed, and when I go to do the commit to kick off the As far as I can tell, the error is being thrown when attempting to do https://github.com/alirezanet/Husky.Net/blob/master/.husky/csx/commit-lint.csx#L10 I really don't think I have changed things, since my task-runner.json has the following, but it really seems like the commit message is always coming back as empty. {
"name": "commit-message-linter",
"command": "dotnet",
"group": "pre-commit",
"args": ["husky", "exec", ".husky/csx/commit-lint.csx", "--args", "${args}"]
}, For the record I invoke the script by Other relevant info: I'm on a macOS Monterey, using zsh, with .NET6 SDK and runtime installed |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
Hi @Rvanmech, also to test your csx file I recommend using the exec command and passing a text file to it to make sure it is working as expected. Let me know if you need further information |
Beta Was this translation helpful? Give feedback.
Hi @Rvanmech,
Thank you for the feedback, you are the second person that recently mentioned having problems with macOS, unfortunately, at the moment I don't have access to my mac machine so I can not debug exactly what is wrong. But if I give you some context, I hope you can solve it.
when you commit something, Git will create a file containing your commit message and it won't pass the commit message directly to the CSX script so the first thing I would check is your commit message file path in the
commit-msg
hook,dotnet husky run --name "commit-message-linter" --args "$1"
. here the$1
is not the commit message, it is a file path you must pass to the linter. so make sure you have it. (ma…