Format staged C# files on commit (#346)
* Format staged C# files on commit * Fix path
This commit is contained in:
Родитель
cc78c30da9
Коммит
35890b3460
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"husky": {
|
||||
"version": "0.7.1",
|
||||
"commands": [
|
||||
"husky"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
## husky task runner examples -------------------
|
||||
## Note : for local installation use 'dotnet' prefix. e.g. 'dotnet husky'
|
||||
|
||||
## run all tasks
|
||||
#husky run
|
||||
|
||||
### run all tasks with group: 'group-name'
|
||||
#husky run --group group-name
|
||||
|
||||
## run task with name: 'task-name'
|
||||
#husky run --name task-name
|
||||
|
||||
## pass hook arguments to task
|
||||
#husky run --args "$1" "$2"
|
||||
|
||||
## or put your custom commands -------------------
|
||||
#echo 'Husky.Net is awesome!'
|
||||
|
||||
dotnet husky run
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"tasks": [
|
||||
{
|
||||
"name": "dotnet-format-staged-files",
|
||||
"command": "dotnet",
|
||||
"args": ["format", "src/Microsoft.Unity.Analyzers.sln", "whitespace", "--verbosity", "quiet", "--include", "${staged}"],
|
||||
"include": ["**/*.cs"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -28,4 +28,9 @@
|
|||
</EmbeddedResource>
|
||||
</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>
|
||||
|
|
Загрузка…
Ссылка в новой задаче