Skip to content

Commit bd62cf0

Browse files
authored
chore: dotnet format PRs (#3097)
1 parent e0d87e4 commit bd62cf0

File tree

222 files changed

+948
-916
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+948
-916
lines changed

.github/workflows/format-code.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: format code
2+
on:
3+
pull_request:
4+
paths:
5+
- 'src/**'
6+
- 'test/**'
7+
- 'samples/**'
8+
- '.github/workflows/format-code.yml'
9+
10+
jobs:
11+
format-code:
12+
name: Format Code
13+
runs-on: macos-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
submodules: recursive
19+
20+
- name: Setup Environment
21+
uses: ./.github/actions/environment
22+
23+
- name: Restore .NET Dependencies
24+
run: dotnet restore Sentry.sln --nologo
25+
26+
- name: Install dotnet format
27+
run: dotnet tool install -g dotnet-format
28+
29+
- name: Format Code
30+
# We're excluding `./**/*OptionsSetup.cs` from the format because the tool struggles with
31+
# source generators
32+
run: dotnet format Sentry.sln --no-restore --exclude ./modules --exclude ./**/*OptionsSetup.cs
33+
34+
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore
35+
# we need to pass the current branch, otherwise we can't commit the changes.
36+
# GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs.
37+
- name: Commit Formatted Code
38+
run: ./scripts/commit-formatted-code.sh $GITHUB_HEAD_REF

GlobalUsings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
global using System.IO.Compression;
1313
global using System.IO.MemoryMappedFiles;
1414
global using System.Net;
15-
global using System.Net.Http.Headers;
1615
global using System.Net.Http;
16+
global using System.Net.Http.Headers;
1717
global using System.Net.NetworkInformation;
1818
global using System.Net.Sockets;
1919
global using System.Reflection;

benchmarks/Sentry.Benchmarks/SdkInitBenchmarks.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using BenchmarkDotNet.Attributes;
2-
using BenchmarkDotNet.Engines;
1+
using BenchmarkDotNet.Attributes;
32
using BenchmarkDotNet.Diagnostics.Windows.Configs;
3+
using BenchmarkDotNet.Engines;
44

55
namespace Sentry.Benchmarks;
66

samples/Sentry.Samples.AspNetCore.Mvc/ExampleEventProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ public SentryEvent Process(SentryEvent @event)
1515
@event.SetExtra("Response:HasStarted", _httpContext.HttpContext?.Response.HasStarted);
1616
return @event;
1717
}
18-
}
18+
}

samples/Sentry.Samples.AspNetCore.Mvc/SpecialExceptionProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ protected override void ProcessException(
1212

1313
sentryEvent.SetTag("IsSpecial", exception.IsSpecial.ToString());
1414
}
15-
}
15+
}

samples/Sentry.Samples.Azure.Functions.Worker/BadApple.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Sentry.Samples.Azure.Functions.Worker;
1+
namespace Sentry.Samples.Azure.Functions.Worker;
22

33
internal static class BadApple
44
{

samples/Sentry.Samples.Azure.Functions.Worker/SampleHttpTrigger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Net;
1+
using System.Net;
22
using Microsoft.Azure.Functions.Worker;
33
using Microsoft.Azure.Functions.Worker.Http;
44
using Microsoft.Extensions.Logging;

samples/Sentry.Samples.Azure.Functions.Worker/SampleTimerTrigger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Microsoft.Azure.Functions.Worker;
1+
using Microsoft.Azure.Functions.Worker;
22
using Microsoft.Extensions.Logging;
33

44
namespace Sentry.Samples.Azure.Functions.Worker;

samples/Sentry.Samples.Console.Metrics/Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Diagnostics.Metrics;
1+
using System.Diagnostics.Metrics;
22
using System.Text.RegularExpressions;
33

44
namespace Sentry.Samples.Console.Metrics;
@@ -30,15 +30,15 @@ private static async Task Main()
3030
// Initialize some (non null) ExperimentalMetricsOptions to enable Sentry Metrics,
3131
options.ExperimentalMetrics = new ExperimentalMetricsOptions
3232
{
33-
EnableCodeLocations = true, // Set this to false if you don't want to track code locations
34-
CaptureSystemDiagnosticsInstruments = [
33+
EnableCodeLocations = true, // Set this to false if you don't want to track code locations
34+
CaptureSystemDiagnosticsInstruments = [
3535
// Capture System.Diagnostics.Metrics matching the name "HatCo.HatStore", which is the name
3636
// of the custom HatsMeter defined above
3737
"hats-sold"
3838
],
39-
// Capture all built in metrics (this is the default - you can override this to capture some or
40-
// none of these if you prefer)
41-
CaptureSystemDiagnosticsMeters = BuiltInSystemDiagnosticsMeters.All
39+
// Capture all built in metrics (this is the default - you can override this to capture some or
40+
// none of these if you prefer)
41+
CaptureSystemDiagnosticsMeters = BuiltInSystemDiagnosticsMeters.All
4242
};
4343
}))
4444
{

samples/Sentry.Samples.Console.Native/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async Task FirstFunctionAsync()
2828
async Task SecondFunctionAsync()
2929
{
3030
await Task.Delay(100);
31-
#pragma warning disable CS0618
31+
#pragma warning disable CS0618
3232
SentrySdk.CauseCrash(CrashType.Native);
33-
#pragma warning restore CS0618
33+
#pragma warning restore CS0618
3434
}

0 commit comments

Comments
 (0)