From 152b3ad6f5441e6d1e1eaa3aa131fa0685370edd Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Wed, 3 Jul 2024 23:08:23 +1000 Subject: [PATCH] Enable MA0057 and fix noncompliance "Class name should end with 'Attribute'" (when subclassing `Attribute`) --- .global.editorconfig.ini | 2 +- src/BizHawk.Client.Common/Api/ExternalToolAttributes.cs | 2 ++ src/BizHawk.Emulation.Common/Interfaces/Services/ISettable.cs | 4 +--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.global.editorconfig.ini b/.global.editorconfig.ini index 4fdd6a1173b..7ce3194c50c 100644 --- a/.global.editorconfig.ini +++ b/.global.editorconfig.ini @@ -213,7 +213,7 @@ dotnet_diagnostic.MA0055.severity = silent # Do not call overridable members in constructor dotnet_diagnostic.MA0056.severity = silent # Class name should end with 'Attribute' -dotnet_diagnostic.MA0057.severity = silent +dotnet_diagnostic.MA0057.severity = error # Class name should end with 'Exception' dotnet_diagnostic.MA0058.severity = error # Class name should end with 'EventArgs' diff --git a/src/BizHawk.Client.Common/Api/ExternalToolAttributes.cs b/src/BizHawk.Client.Common/Api/ExternalToolAttributes.cs index fa7fbfce795..c725a8f2f60 100644 --- a/src/BizHawk.Client.Common/Api/ExternalToolAttributes.cs +++ b/src/BizHawk.Client.Common/Api/ExternalToolAttributes.cs @@ -8,6 +8,7 @@ namespace BizHawk.Client.Common { +#pragma warning disable MA0057 // oops, should have called these `*Attribute`, too late now --yoshi public static class ExternalToolApplicability { /// This class is not deprecated, do not remove it. @@ -100,6 +101,7 @@ public abstract class ExternalToolApplicabilityAttributeBase : Attribute public class DuplicateException : Exception {} } +#pragma warning disable MA0057 [AttributeUsage(AttributeTargets.Class)] public sealed class ExternalToolAttribute : Attribute diff --git a/src/BizHawk.Emulation.Common/Interfaces/Services/ISettable.cs b/src/BizHawk.Emulation.Common/Interfaces/Services/ISettable.cs index 7fc2a83a177..8f52c7ad0fd 100644 --- a/src/BizHawk.Emulation.Common/Interfaces/Services/ISettable.cs +++ b/src/BizHawk.Emulation.Common/Interfaces/Services/ISettable.cs @@ -60,9 +60,7 @@ public interface ISettable : IEmulatorService /// Classes with this attribute will have a BizHawk.Common.SettingsUtil.SetDefaultValues(T) function generated /// [AttributeUsage(AttributeTargets.Class)] - public class CoreSettings : Attribute - { - } + public class CoreSettingsAttribute : Attribute {} //note: this is a bit of a frail API. If a frontend wants a new flag, cores won't know to yea or nay it //this could be solved by adding a KnownSettingsDirtyBits on the settings interface