Skip to content

Commit

Permalink
ci: Code formatting (#7)
Browse files Browse the repository at this point in the history
* ci: dotnet formatting

* simplify job

* test break formatting

* fix format

* dotnet format
  • Loading branch information
miquelbeltran authored Jul 17, 2024
1 parent 3176940 commit 19b3229
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 40 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/dotnet-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Format check
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
dotnet-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Format
working-directory: ./src
run: dotnet format --verify-no-changes

2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET
name: Build & Test check

on:
push:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder)
{
if (ErrorContent is not null)
{
builder.AddContent(1, ErrorContent(CurrentException));
builder.AddContent(1, ErrorContent(CurrentException));
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions src/Raygun.NetCore.Blazor/Models/BreadcrumbDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal record BreadcrumbDetails
/// <summary>
/// A custom value used to arbitrarily group this Breadcrumb.
/// </summary>
[JsonInclude]
[JsonInclude]
public string Category { get; set; }

/// <summary>
Expand All @@ -34,7 +34,7 @@ internal record BreadcrumbDetails
/// <summary>
/// Any custom data you want to record about application state when the Breadcrumb was recorded.
/// </summary>
[JsonInclude]
[JsonInclude]
public Dictionary<string, object> CustomData { get; set; }

/// <summary>
Expand All @@ -46,7 +46,7 @@ internal record BreadcrumbDetails
/// <summary>
/// The message you want to record for this Breadcrumb.
/// </summary>
[JsonInclude]
[JsonInclude]
public string Message { get; set; }

/// <summary>
Expand All @@ -70,7 +70,7 @@ internal record BreadcrumbDetails
/// <summary>
/// The <see cref="BreadcrumbType"> for the message. Defaults to <see cref="BreadcrumbType.Manual"/>.
/// </summary>
[JsonInclude]
[JsonInclude]
public BreadcrumbType Type { get; set; }

#endregion
Expand Down
6 changes: 1 addition & 5 deletions src/Raygun.NetCore.Blazor/Models/BrowserSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace Raygun.NetCore.Blazor.Models
{

/// <summary>
/// Attributes about the Browser that are <i>highly unlikely</i> to change at runtime.
/// </summary>
Expand All @@ -13,7 +12,6 @@ namespace Raygun.NetCore.Blazor.Models
/// </remarks>
internal record BrowserSpecs
{

#region Private Members

private string calculatedBrowserVersion;
Expand Down Expand Up @@ -142,7 +140,5 @@ internal void ParseUserAgent()
}

#endregion

}

}
}
2 changes: 1 addition & 1 deletion src/Raygun.NetCore.Blazor/Models/BrowserUserAgentData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal record BrowserUserAgentData
///
/// </summary>
public string CalculatedOSVersion => $"{Platform} {(
Platform == "Windows" && Decimal.Parse(PlatformVersion?.Split(".")?[0] ?? "0") >= 13 ? "11" :
Platform == "Windows" && Decimal.Parse(PlatformVersion?.Split(".")?[0] ?? "0") >= 13 ? "11" :
Platform == "Windows" && Decimal.Parse(PlatformVersion?.Split(".")?[0] ?? "0") < 13 ? "10" :
PlatformVersion)}";

Expand Down
6 changes: 3 additions & 3 deletions src/Raygun.NetCore.Blazor/Models/ClientDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ internal record ClientDetails
/// <summary>
/// The name of this Client library.
/// </summary>
[JsonInclude]
[JsonInclude]
public string Name { get; set; }

/// <summary>
/// The version of this Client library.
/// </summary>
[JsonInclude]
[JsonInclude]
public string Version { get; set; }

/// <summary>
/// The URL for the repository this Client library is maintained in.
/// </summary>
[JsonInclude]
[JsonInclude]
public string ClientUrl { get; set; }

#endregion
Expand Down
2 changes: 1 addition & 1 deletion src/Raygun.NetCore.Blazor/Models/EnvironmentDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ internal EnvironmentDetails(BrowserSpecs specs, BrowserStats stats)
ColorDepth = specs.ColorDepth;
CurrentOrientation = stats.Orientation.ToString();
DeviceManufacturer = !string.IsNullOrWhiteSpace(specs.DeviceManufacturer) ? specs.DeviceManufacturer : null;
DeviceModel = !string.IsNullOrWhiteSpace(specs.DeviceModel) ? specs.DeviceModel: null;
DeviceModel = !string.IsNullOrWhiteSpace(specs.DeviceModel) ? specs.DeviceModel : null;
DeviceName = !string.IsNullOrWhiteSpace(specs.DeviceName) ? specs.DeviceName : null; ;
Locale = specs.Locale;
OSVersion = !string.IsNullOrWhiteSpace(specs.UAHints?.CalculatedOSVersion) ? specs.UAHints.CalculatedOSVersion : specs.CalculatedOSVersion;
Expand Down
14 changes: 7 additions & 7 deletions src/Raygun.NetCore.Blazor/Models/ErrorDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,37 @@ internal class ErrorDetails
/// <summary>
/// The name of the <see langword="class" /> the error was produced in.
/// </summary>
[JsonInclude]
[JsonInclude]
public string ClassName { get; set; }

/// <summary>
/// Data contained in the error object.
/// </summary>
[JsonInclude]
[JsonInclude]
public NonGeneric.IDictionary Data { get; set; }

/// <summary>
/// Details about the symbol files related to the error.
/// </summary>
[JsonInclude]
[JsonInclude]
public List<PEDebugDetails> Images { get; set; }

/// <summary>
///
/// </summary>
[JsonInclude]
[JsonInclude]
public ErrorDetails InnerError { get; set; }

/// <summary>
///
/// </summary>
[JsonInclude]
[JsonInclude]
public List<ErrorDetails> InnerErrors { get; set; }

/// <summary>
///
/// </summary>
[JsonInclude]
[JsonInclude]
public string Message { get; set; }

/// <summary>
Expand All @@ -58,7 +58,7 @@ internal class ErrorDetails
/// <remarks>
/// The first one in the list should be the highest on the stack
/// </remarks>
[JsonInclude]
[JsonInclude]
public List<StackTraceDetails> StackTrace { get; set; }

#endregion
Expand Down
16 changes: 8 additions & 8 deletions src/Raygun.NetCore.Blazor/Models/EventDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ internal record EventDetails
/// <summary>
/// A trail of breadcrumbs leading up to this event.
/// </summary>
[JsonInclude]
[JsonInclude]
public List<BreadcrumbDetails> Breadcrumbs { get; set; }

/// <summary>
/// Information about the client library you are using for talking to the Raygun API.
/// </summary>
[JsonInclude]
[JsonInclude]
public ClientDetails Client { get; set; }

/// <summary>
/// Information about the environment at the time of the event.
/// </summary>
[JsonInclude]
[JsonInclude]
public EnvironmentDetails Environment { get; set; }

/// <summary>
Expand All @@ -49,19 +49,19 @@ internal record EventDetails
/// <remarks>
/// Must be 1-100 chars, ideally the result of a hash function e.g MD5
/// </remarks>
[JsonInclude]
[JsonInclude]
public string GroupingKey { get; set; }

/// <summary>
/// The name of machine this event occurred on
/// </summary>
[JsonInclude]
[JsonInclude]
public string MachineName { get; set; }

/// <summary>
/// Information about the HTTP request being processed when the error occurred.
/// </summary>
[JsonInclude]
[JsonInclude]
public RequestDetails Request { get; set; }

/// <summary>
Expand All @@ -70,7 +70,7 @@ internal record EventDetails
/// <remarks>
/// These will be searchable and filterable on the dashboard.
/// </remarks>
[JsonInclude]
[JsonInclude]
public List<string> Tags { get; set; }

/// <summary>
Expand All @@ -85,7 +85,7 @@ internal record EventDetails
/// <remarks>
/// These will be searchable on the dashboard.
/// </remarks>
[JsonInclude]
[JsonInclude]
public Dictionary<string, string> UserCustomData { get; set; }

#endregion
Expand Down
2 changes: 1 addition & 1 deletion src/Raygun.NetCore.Blazor/Models/RaygunRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal record RaygunRequest
public RequestQueueStatus QueueStatus { get; set; }

#endregion

#region Constructors

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/Raygun.NetCore.Blazor/Models/StackTraceDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ internal class StackTraceDetails
/// <summary>
/// The name of the class this stack frame is in.
/// </summary>
[JsonInclude]
[JsonInclude]
public string ClassName { get; set; }

/// <summary>
/// The column of the file that this stack frame is in.
/// </summary>
[JsonInclude]
[JsonInclude]
public int ColumnNumber { get; set; }

/// <summary>
/// The name of the file this stack frame is in.
/// </summary>
[JsonInclude]
[JsonInclude]
public string FileName { get; set; }

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Raygun.NetCore.Blazor/RaygunBlazorClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ public async Task InitializeAsync()
/// <code>
/// TBD
/// </code>
public void RecordBreadcrumb(string message, BreadcrumbType breadcrumbType = BreadcrumbType.Manual, string category = null,
public void RecordBreadcrumb(string message, BreadcrumbType breadcrumbType = BreadcrumbType.Manual, string category = null,
Dictionary<string, object> customData = null, string platform = "DotNet")
{
{
_breadcrumbs.Add(new BreadcrumbDetails(message, breadcrumbType, category, customData, platform));
}

Expand Down
4 changes: 2 additions & 2 deletions src/Raygun.NetCore.Blazor/RaygunBrowserInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public RaygunBrowserInterop(IJSRuntime jsRuntime, IWindowService windowService,
/// <param name="customData"></param>
/// <returns></returns>
[JSInvokable]
public async ValueTask RecordJsBreadcrumb(string message, BreadcrumbType breadcrumbType = BreadcrumbType.Manual,
public async ValueTask RecordJsBreadcrumb(string message, BreadcrumbType breadcrumbType = BreadcrumbType.Manual,
string category = null, Dictionary<string, object> customData = null)
{
_breadcrumbAction.Invoke(message, breadcrumbType, category, customData, "JavaScript");
Expand Down Expand Up @@ -154,7 +154,7 @@ internal async Task InitializeAsync(Func<ErrorEvent, Task> onUnhandledJsExceptio
// RWM: We're going to register the Raygun script and get the BrowserSpecs first. The reason why is because if we
// handle JS errors & they start coming in before we're ready, then there will be wailing and gnashing of teeth.
RaygunScriptReference = await _jsRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/Raygun.NetCore.Blazor/Raygun.NetCore.Blazor.js");

// RWM: Register the .NET reference with JS so that JS code can also manually create Bookmarks and report Exceptions.
await _jsRuntime.InvokeVoidAsync("window.raygunBlazor.initialize", _dotNetReference);

Expand Down
2 changes: 1 addition & 1 deletion src/Raygun.NetCore.Tests.Blazor/RaygunBlazorClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void Setup()
var browserStats = new BrowserStats();
browserSpecs.UserAgent =
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0";

// BlazorBreakdanceTestBase exposes bunit JSInterop
BUnitTestContext.JSInterop.Setup<BrowserSpecs>("getBrowserSpecs").SetResult(browserSpecs);
BUnitTestContext.JSInterop.Setup<BrowserStats>("getBrowserStats").SetResult(browserStats);
Expand Down

0 comments on commit 19b3229

Please sign in to comment.