From 42ac32dacea89386b16cfaf421a15bcce585cc0f Mon Sep 17 00:00:00 2001 From: RoosterDragon Date: Tue, 11 Nov 2025 18:42:12 +0000 Subject: [PATCH] Fix CA1515 --- .editorconfig | 3 +++ OpenRA.Test/OpenRA.Game/ActorInfoTest.cs | 2 +- OpenRA.Test/OpenRA.Game/CPosTest.cs | 2 +- OpenRA.Test/OpenRA.Game/CoordinateTest.cs | 2 +- OpenRA.Test/OpenRA.Game/FluentTest.cs | 2 +- OpenRA.Test/OpenRA.Game/MediatorTest.cs | 6 +++--- OpenRA.Test/OpenRA.Game/MiniYamlTest.cs | 2 +- OpenRA.Test/OpenRA.Game/OrderTest.cs | 2 +- OpenRA.Test/OpenRA.Game/PlatformTest.cs | 2 +- OpenRA.Test/OpenRA.Game/PngTest.cs | 4 +++- OpenRA.Test/OpenRA.Game/VariableExpressionTest.cs | 2 +- OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs | 2 +- OpenRA.Utility/Program.cs | 2 +- 13 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.editorconfig b/.editorconfig index 170c43f712..bd922b697a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -781,6 +781,9 @@ dotnet_diagnostic.CA1513.severity = warning # Avoid redundant length argument. dotnet_diagnostic.CA1514.severity = warning +# Consider making public types internal. +dotnet_diagnostic.CA1515.severity = warning + ### Naming Rules ### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/naming-warnings diff --git a/OpenRA.Test/OpenRA.Game/ActorInfoTest.cs b/OpenRA.Test/OpenRA.Game/ActorInfoTest.cs index 8dc8ffa094..c0a5f06a0c 100644 --- a/OpenRA.Test/OpenRA.Game/ActorInfoTest.cs +++ b/OpenRA.Test/OpenRA.Game/ActorInfoTest.cs @@ -36,7 +36,7 @@ namespace OpenRA.Test sealed class MockLInfo : MockTraitInfo, NotBefore { } [TestFixture] - public class ActorInfoTest + sealed class ActorInfoTest { [TestCase(TestName = "Trait ordering sorts in dependency order correctly")] public void TraitOrderingSortsCorrectly() diff --git a/OpenRA.Test/OpenRA.Game/CPosTest.cs b/OpenRA.Test/OpenRA.Game/CPosTest.cs index d214b17d68..f5d8f8102a 100644 --- a/OpenRA.Test/OpenRA.Game/CPosTest.cs +++ b/OpenRA.Test/OpenRA.Game/CPosTest.cs @@ -14,7 +14,7 @@ using NUnit.Framework; namespace OpenRA.Test { [TestFixture] - public class CPosTest + sealed class CPosTest { [TestCase(TestName = "Packing x,y and layer into int")] public void PackUnpackBits() diff --git a/OpenRA.Test/OpenRA.Game/CoordinateTest.cs b/OpenRA.Test/OpenRA.Game/CoordinateTest.cs index d53af38fe2..912b2c5e93 100644 --- a/OpenRA.Test/OpenRA.Game/CoordinateTest.cs +++ b/OpenRA.Test/OpenRA.Game/CoordinateTest.cs @@ -16,7 +16,7 @@ using NUnit.Framework; namespace OpenRA.Test { [TestFixture] - public class CoordinateTest + sealed class CoordinateTest { [TestCase(TestName = "Test CPos to MPos conversion and back again.")] public void CPosConversionRoundtrip() diff --git a/OpenRA.Test/OpenRA.Game/FluentTest.cs b/OpenRA.Test/OpenRA.Game/FluentTest.cs index f36a7d4031..62f6b26a5e 100644 --- a/OpenRA.Test/OpenRA.Game/FluentTest.cs +++ b/OpenRA.Test/OpenRA.Game/FluentTest.cs @@ -15,7 +15,7 @@ using NUnit.Framework; namespace OpenRA.Test { [TestFixture] - public class FluentTest + sealed class FluentTest { readonly string pluralForms = @" label-players = {$player -> diff --git a/OpenRA.Test/OpenRA.Game/MediatorTest.cs b/OpenRA.Test/OpenRA.Game/MediatorTest.cs index 1e129c02b0..db9c13f432 100644 --- a/OpenRA.Test/OpenRA.Game/MediatorTest.cs +++ b/OpenRA.Test/OpenRA.Game/MediatorTest.cs @@ -15,7 +15,7 @@ using OpenRA.Widgets; namespace OpenRA.Test { [TestFixture] - public class MediatorTest + sealed class MediatorTest { [TestCase(TestName = "Mediator test")] public void Test() @@ -30,7 +30,7 @@ namespace OpenRA.Test } } - public class TestHandler : INotificationHandler + sealed class TestHandler : INotificationHandler { public bool WasNotified { get; set; } @@ -40,5 +40,5 @@ namespace OpenRA.Test } } - public class TestNotificaton { } + sealed class TestNotificaton { } } diff --git a/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs b/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs index d53c2598db..c7d375b6a6 100644 --- a/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs +++ b/OpenRA.Test/OpenRA.Game/MiniYamlTest.cs @@ -21,7 +21,7 @@ using NUnit.Framework; namespace OpenRA.Test { [TestFixture] - public class MiniYamlTest + sealed class MiniYamlTest { [TestCase(TestName = "Parse tree roundtrips")] public void TestParseRoundtrip() diff --git a/OpenRA.Test/OpenRA.Game/OrderTest.cs b/OpenRA.Test/OpenRA.Game/OrderTest.cs index 05b52e8213..8737b57fd5 100644 --- a/OpenRA.Test/OpenRA.Game/OrderTest.cs +++ b/OpenRA.Test/OpenRA.Game/OrderTest.cs @@ -16,7 +16,7 @@ using OpenRA.Traits; namespace OpenRA.Test { [TestFixture] - public class OrderTest + sealed class OrderTest { static byte[] RoundTripOrder(byte[] bytes) { diff --git a/OpenRA.Test/OpenRA.Game/PlatformTest.cs b/OpenRA.Test/OpenRA.Game/PlatformTest.cs index 1bf4fb7e7c..70a04fca17 100644 --- a/OpenRA.Test/OpenRA.Game/PlatformTest.cs +++ b/OpenRA.Test/OpenRA.Game/PlatformTest.cs @@ -15,7 +15,7 @@ using NUnit.Framework; namespace OpenRA.Test { [TestFixture] - public class PlatformTest + sealed class PlatformTest { string supportDir; string engineDir; diff --git a/OpenRA.Test/OpenRA.Game/PngTest.cs b/OpenRA.Test/OpenRA.Game/PngTest.cs index 9bb5f633ef..45f2913543 100644 --- a/OpenRA.Test/OpenRA.Game/PngTest.cs +++ b/OpenRA.Test/OpenRA.Game/PngTest.cs @@ -19,7 +19,7 @@ using OpenRA.Primitives; namespace OpenRA.Test { [TestFixture] - public class PngTests + sealed class PngTests { [Test] public void Save_ShouldProduceValidPngFile() @@ -128,6 +128,8 @@ namespace OpenRA.Test } } + [Test] + [Ignore("Failing test should be fixed")] public void PngConstructor_CompressionMethodNotSupported_ThrowsInvalidDataException() { // Arrange diff --git a/OpenRA.Test/OpenRA.Game/VariableExpressionTest.cs b/OpenRA.Test/OpenRA.Game/VariableExpressionTest.cs index a53f933e36..06a0048b46 100644 --- a/OpenRA.Test/OpenRA.Game/VariableExpressionTest.cs +++ b/OpenRA.Test/OpenRA.Game/VariableExpressionTest.cs @@ -17,7 +17,7 @@ using OpenRA.Support; namespace OpenRA.Test { [TestFixture] - public class VariableExpressionTest + sealed class VariableExpressionTest { readonly IReadOnlyDictionary testValues = new Dictionary { diff --git a/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs b/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs index 9c731c0d38..22ec4ff114 100644 --- a/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs +++ b/OpenRA.Test/OpenRA.Mods.Common/ShapeTest.cs @@ -15,7 +15,7 @@ using OpenRA.Mods.Common.HitShapes; namespace OpenRA.Test { [TestFixture] - public class ShapeTest + sealed class ShapeTest { IHitShape shape; diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index af2ee20360..42cbd0ef96 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -18,7 +18,7 @@ namespace OpenRA { using UtilityActions = Dictionary, Func>>; - public class NoSuchCommandException : Exception + sealed class NoSuchCommandException : Exception { public readonly string Command; public NoSuchCommandException(string command)