Skip to content

Commit 3565f10

Browse files
committed
Add csharpier
1 parent b0b0cbc commit 3565f10

File tree

7 files changed

+58
-3
lines changed

7 files changed

+58
-3
lines changed

.config/dotnet-tools.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"csharpier": {
6+
"version": "1.1.1",
7+
"commands": [
8+
"csharpier"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}

.csharpierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cake.config

.github/workflows/csharpier.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Formatting check
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
formatting-check:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
12+
steps:
13+
- name: CSharpier Linter
14+
uses: guibranco/[email protected]

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,4 +402,6 @@ FodyWeavers.xsd
402402

403403
# JetBrains Rider
404404
.idea/
405-
*.sln.iml
405+
*.sln.iml
406+
407+
test-results/

build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
dotnet run --project build/Build.csproj -- $args
2-
exit $LASTEXITCODE;
2+
exit $LASTEXITCODE;

build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
dotnet run --project ./build/Build.csproj -- "$@"
1+
#!/bin/sh
2+
3+
set -e
4+
5+
dotnet run --project ./build/Build.csproj -- "$@"

build/Tasks.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,25 @@ public override void Run(BuildContext context)
129129
}
130130
}
131131

132+
[TaskName("Format")]
133+
public sealed class CheckFormatTask : FrostingTask<BuildContext>
134+
{ public override void Run(BuildContext context)
135+
{
136+
var param = context.Parameters;
137+
context.DotNetTool("./", "csharpier", "format .");
138+
}
139+
}
140+
141+
[TaskName("Check-Format")]
142+
public sealed class FormatTask : FrostingTask<BuildContext>
143+
{
144+
public override void Run(BuildContext context)
145+
{
146+
var param = context.Parameters;
147+
context.DotNetTool("./", "csharpier", "check .");
148+
}
149+
}
150+
132151
[TaskName("Sonar-Begin")]
133152
public sealed class SonarBeginTask : FrostingTask<BuildContext>
134153
{
@@ -241,6 +260,7 @@ public override void Run(BuildContext context)
241260
[TaskName("Default")]
242261
[IsDependentOn(typeof(CleanTask))]
243262
[IsDependentOn(typeof(RestoreNuGetPackagesTask))]
263+
[IsDependentOn(typeof(FormatTask))]
244264
[IsDependentOn(typeof(BuildTask))]
245265
[IsDependentOn(typeof(TestsTask))]
246266
public sealed class DefaultTask : FrostingTask;
@@ -249,6 +269,7 @@ public sealed class DefaultTask : FrostingTask;
249269
[IsDependentOn(typeof(CleanTask))]
250270
[IsDependentOn(typeof(RestoreNuGetPackagesTask))]
251271
[IsDependentOn(typeof(SonarBeginTask))]
272+
[IsDependentOn(typeof(FormatTask))]
252273
[IsDependentOn(typeof(BuildTask))]
253274
[IsDependentOn(typeof(TestsTask))]
254275
[IsDependentOn(typeof(SonarEndTask))]

0 commit comments

Comments
 (0)