Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"csharpier"
],
"rollForward": false
},
"husky": {
"version": "0.9.1",
"commands": [
"husky"
],
"rollForward": false
}
}
}
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

dotnet husky run --group pre-commit
19 changes: 19 additions & 0 deletions .husky/task-runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://alirezanet.github.io/Husky.Net/schema.json",
"tasks": [
{
"name": "csharpier-format",
"group": "pre-commit",
"command": "dotnet",
"args": [ "csharpier", "format", "${staged}" ],
"include": [ "**/*" ]
},
{
"name": "csharpier-restage",
"group": "pre-commit",
"command": "git",
"args": [ "add", "${staged}" ],
"include": [ "**/*" ]
}
]
}
6 changes: 6 additions & 0 deletions src/Altinn.App.Core/Altinn.App.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@
<InternalsVisibleTo Include="Altinn.Application.For.IntegrationTesting" />
<InternalsVisibleTo Include="Altinn.Application.For.IntegrationTesting.Scenario" />
</ItemGroup>

<!-- Installs Husky.Net git hooks (see .husky/) on restore so all contributors get the pre-commit csharpier hook. Set HUSKY=0 to skip (e.g. in CI). -->
<Target Name="husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != '0' AND '$(CI)' != 'true'">
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory="$(MSBuildProjectDirectory)/../.." />
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory="$(MSBuildProjectDirectory)/../.." />
</Target>
</Project>
Loading