From 47bb0530936264b0d449eaf4542392ee7fa596d7 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Thu, 30 Nov 2023 12:25:53 +0100 Subject: [PATCH 1/2] Add directive to correct formatting style --- test/UnitTests/Internal/ErrorObjectTests.cs | 29 ++++++--------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/test/UnitTests/Internal/ErrorObjectTests.cs b/test/UnitTests/Internal/ErrorObjectTests.cs index bb8c4e3bcc..9d022b0caa 100644 --- a/test/UnitTests/Internal/ErrorObjectTests.cs +++ b/test/UnitTests/Internal/ErrorObjectTests.cs @@ -7,28 +7,15 @@ namespace UnitTests.Internal; public sealed class ErrorObjectTests { - // Formatting below is broken due to Resharper bug at https://youtrack.jetbrains.com/issue/RSRP-494897/Formatter-directive-broken-in-2023.3-EAP7. - // This no longer works: @formatter:wrap_array_initializer_style wrap_if_long + // @formatter:wrap_array_initializer_style wrap_if_long + // @formatter:max_array_initializer_elements_on_line 10 [Theory] - [InlineData(new[] - { - HttpStatusCode.UnprocessableEntity - }, HttpStatusCode.UnprocessableEntity)] - [InlineData(new[] - { - HttpStatusCode.UnprocessableEntity, - HttpStatusCode.UnprocessableEntity - }, HttpStatusCode.UnprocessableEntity)] - [InlineData(new[] - { - HttpStatusCode.UnprocessableEntity, - HttpStatusCode.Unauthorized - }, HttpStatusCode.BadRequest)] - [InlineData(new[] - { - HttpStatusCode.UnprocessableEntity, - HttpStatusCode.BadGateway - }, HttpStatusCode.InternalServerError)] + [InlineData(new[] { HttpStatusCode.UnprocessableEntity }, HttpStatusCode.UnprocessableEntity)] + [InlineData(new[] { HttpStatusCode.UnprocessableEntity, HttpStatusCode.UnprocessableEntity }, HttpStatusCode.UnprocessableEntity)] + [InlineData(new[] { HttpStatusCode.UnprocessableEntity, HttpStatusCode.Unauthorized }, HttpStatusCode.BadRequest)] + [InlineData(new[] { HttpStatusCode.UnprocessableEntity, HttpStatusCode.BadGateway }, HttpStatusCode.InternalServerError)] + // @formatter:max_array_initializer_elements_on_line restore + // @formatter:wrap_array_initializer_style restore public void ErrorDocument_GetErrorStatusCode_IsCorrect(HttpStatusCode[] errorCodes, HttpStatusCode expected) { // Arrange From 78b54ddd055499f15344de5051a9295ae5330763 Mon Sep 17 00:00:00 2001 From: Bart Koelman <10324372+bkoelman@users.noreply.github.com> Date: Thu, 30 Nov 2023 12:38:22 +0100 Subject: [PATCH 2/2] Promote Global:PropertyCanBeMadeInitOnly to warning, so it aligns with what Resharper shows in VS, and address new violations --- WarningSeverities.DotSettings | 1 + src/JsonApiDotNetCore/Serialization/Objects/Document.cs | 2 ++ test/DapperTests/IntegrationTests/FrozenClock.cs | 2 ++ 3 files changed, 5 insertions(+) diff --git a/WarningSeverities.DotSettings b/WarningSeverities.DotSettings index 5c641e606f..f8ac8e1515 100644 --- a/WarningSeverities.DotSettings +++ b/WarningSeverities.DotSettings @@ -122,6 +122,7 @@ WARNING WARNING WARNING + WARNING WARNING WARNING WARNING diff --git a/src/JsonApiDotNetCore/Serialization/Objects/Document.cs b/src/JsonApiDotNetCore/Serialization/Objects/Document.cs index e0d7d5def3..f21334f5c4 100644 --- a/src/JsonApiDotNetCore/Serialization/Objects/Document.cs +++ b/src/JsonApiDotNetCore/Serialization/Objects/Document.cs @@ -1,10 +1,12 @@ using System.Text.Json.Serialization; +using JetBrains.Annotations; namespace JsonApiDotNetCore.Serialization.Objects; /// /// See https://jsonapi.org/format#document-top-level and https://jsonapi.org/ext/atomic/#document-structure. /// +[PublicAPI] public sealed class Document { [JsonPropertyName("jsonapi")] diff --git a/test/DapperTests/IntegrationTests/FrozenClock.cs b/test/DapperTests/IntegrationTests/FrozenClock.cs index 0de2390b71..c7ca4ea851 100644 --- a/test/DapperTests/IntegrationTests/FrozenClock.cs +++ b/test/DapperTests/IntegrationTests/FrozenClock.cs @@ -1,8 +1,10 @@ using DapperExample; using FluentAssertions.Extensions; +using JetBrains.Annotations; namespace DapperTests.IntegrationTests; +[UsedImplicitly(ImplicitUseTargetFlags.Members)] internal sealed class FrozenClock : IClock { private static readonly DateTimeOffset DefaultTime = 1.January(2020).At(1, 1, 1).AsUtc();