diff --git a/MiraAPI/GameOptions/Attributes/ModdedOptionVisibilityAttribute.cs b/MiraAPI/GameOptions/Attributes/ModdedOptionVisibilityAttribute.cs index 1d50f4b..690ba36 100644 --- a/MiraAPI/GameOptions/Attributes/ModdedOptionVisibilityAttribute.cs +++ b/MiraAPI/GameOptions/Attributes/ModdedOptionVisibilityAttribute.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using MiraAPI.GameOptions.OptionTypes; @@ -158,7 +159,7 @@ public sealed class ModdedOptionVisibilityAttribute(Type? holderType = null, str return null; } -#pragma warning disable S3011 // Reflection should not be used to increase accessibility of classes, methods, or fields + [SuppressMessage("Major Code Smell", "S3011:Reflection should not be used to increase accessibility of classes, methods, or fields", Justification = "It is safe.")] private MemberInfo? GetVisibilityMember(AbstractOptionGroup group, PropertyInfo property, out Type type, out Func? instanceGet) { Type groupType = group.GetType(); @@ -197,5 +198,4 @@ public sealed class ModdedOptionVisibilityAttribute(Type? holderType = null, str return member; } -#pragma warning restore S3011 // Reflection should not be used to increase accessibility of classes, methods, or fields } diff --git a/MiraAPI/GameOptions/ModdedOptionsManager.cs b/MiraAPI/GameOptions/ModdedOptionsManager.cs index f74c84f..387a1f8 100644 --- a/MiraAPI/GameOptions/ModdedOptionsManager.cs +++ b/MiraAPI/GameOptions/ModdedOptionsManager.cs @@ -376,10 +376,9 @@ public static class ModdedOptionsManager /// The list's instance. /// The index to find in the list. /// The new object value. -#pragma warning disable CA1707 [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Harmony naming convention")] + [SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Read above.")] public static void PropertyListSetterPatch(object __instance, int index, object value) -#pragma warning restore CA1707 { var attribute = (ModdedOptionListAttribute)OptionAttributes.First( pair => pair.Value is ModdedOptionListAttribute list && ReferenceEquals(list.Value, __instance)).Value; @@ -393,10 +392,9 @@ public static class ModdedOptionsManager /// The index to find in the list. /// The result of the property getter. /// False so the original getter gets skipped. -#pragma warning disable CA1707 [SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Harmony naming convention")] + [SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Read above.")] public static bool PropertyListGetterPatch(object __instance, int index, ref object __result) -#pragma warning restore CA1707 { var attribute = (ModdedOptionListAttribute)OptionAttributes.First( pair => pair.Value is ModdedOptionListAttribute list && ReferenceEquals(list.Value, __instance)).Value; diff --git a/MiraAPI/MiraApiPlugin.cs b/MiraAPI/MiraApiPlugin.cs index f8aec24..ba70406 100644 --- a/MiraAPI/MiraApiPlugin.cs +++ b/MiraAPI/MiraApiPlugin.cs @@ -23,7 +23,7 @@ namespace MiraAPI; [BepInProcess("Among Us.exe")] [BepInDependency(ReactorPlugin.Id)] [ReactorModFlags(ModFlags.RequireOnAllClients)] -#pragma warning disable SA1515 // Single-line comment should be preceded by blank line (Justification: ReSharper suppression,) +#pragma warning disable SA1515 // Single-line comment should be preceded by blank line (Justification: ReSharper suppression.) // ReSharper disable once ClassNeverInstantiated.Global (Justification: Instantiated by BepInEx.) public partial class MiraApiPlugin : BasePlugin, IMiraPlugin #pragma warning restore SA1515 // Single-line comment should be preceded by blank line diff --git a/MiraAPI/Patches/RoleGuidePatches.cs b/MiraAPI/Patches/RoleGuidePatches.cs index 8fd7ea5..2395d5f 100644 --- a/MiraAPI/Patches/RoleGuidePatches.cs +++ b/MiraAPI/Patches/RoleGuidePatches.cs @@ -238,9 +238,9 @@ public static class RoleGuidePatches continue; #pragma warning restore S1751 // Loops with at most one iteration should be refactored - void LoadNameplate(NamePlateViewData viewdata) + void LoadNameplate(NamePlateViewData viewData) { - component.buttonSprite.sprite = viewdata.Image; + component.buttonSprite.sprite = viewData.Image; component.buttonSprite.transform.localScale = new Vector3(0.7f, 1.075f, 1); component.buttonSprite.transform.localPosition = new Vector3(-0.395f, 0, 0.1f); } diff --git a/MiraAPI/Presets/SavePresetPopup.cs b/MiraAPI/Presets/SavePresetPopup.cs index 9fce9f9..8df354c 100644 --- a/MiraAPI/Presets/SavePresetPopup.cs +++ b/MiraAPI/Presets/SavePresetPopup.cs @@ -11,9 +11,8 @@ using UnityEngine.UI; namespace MiraAPI.Presets; -// TODO: Give proper reasoning [RegisterInIl2Cpp] -[SuppressMessage("Style", "IDE0051:Remove unused private members", Justification = "Unity Convention.")] +[SuppressMessage("Style", "IDE0051:Remove unused private members", Justification = "Unity convention.")] #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member (Justification: Unity fields; ignore.) public class SavePresetPopup(nint cppPtr) : Minigame(cppPtr) { diff --git a/MiraAPI/Utilities/Helpers.cs b/MiraAPI/Utilities/Helpers.cs index 0d37e5d..35280ab 100644 --- a/MiraAPI/Utilities/Helpers.cs +++ b/MiraAPI/Utilities/Helpers.cs @@ -389,9 +389,8 @@ public static class Helpers Constants.ShipAndObjectsMask)) select playerControl); -#pragma warning disable SA1008 // Opening parenthesis should be spaced correctly (Justification: Formatting.) outputList.Sort( - delegate (PlayerControl a, PlayerControl b) + (a, b) => { var magnitude2 = (a.GetTruePosition() - source).magnitude; var magnitude3 = (b.GetTruePosition() - source).magnitude; @@ -401,7 +400,6 @@ public static class Helpers ? -1 : 0; }); -#pragma warning restore SA1008 // Opening parenthesis should be spaced correctly return outputList; }