From 6ddd9acceea04327009ffc93ac4cff173e423715 Mon Sep 17 00:00:00 2001 From: Salman Alshamrani Date: Wed, 4 Dec 2024 05:44:14 -0500 Subject: [PATCH 1/2] Fix enum naming warnings --- osu-framework.sln.DotSettings | 3 + .../Input/TestSceneKeyBindingContainer.cs | 10 +- .../Visual/Input/TestSceneKeyBindingsGrid.cs | 132 +++++++++--------- osu.Framework/Configuration/FrameSync.cs | 3 + osu.Framework/Configuration/RendererType.cs | 3 + osu.Framework/Graphics/Drawable.cs | 3 + .../Graphics/Video/HardwareVideoDecoder.cs | 3 + osu.Framework/Input/Bindings/InputKey.cs | 2 + .../Platform/Linux/Native/Library.cs | 2 + .../Platform/MacOS/Native/NSStringEncoding.cs | 2 + .../Platform/Windows/Native/Execution.cs | 2 + osu.Framework/Platform/Windows/Native/Imm.cs | 2 + .../Platform/Windows/Native/Input.cs | 2 + .../Platform/Windows/SDL2WindowsWindow.cs | 4 +- .../Platform/Windows/WindowsGLRenderer.cs | 2 + osu.Framework/RuntimeInfo.cs | 3 + .../Statistics/DotNetRuntimeListener.cs | 12 +- 17 files changed, 112 insertions(+), 78 deletions(-) diff --git a/osu-framework.sln.DotSettings b/osu-framework.sln.DotSettings index 3f68824f12..6a0ab9a682 100644 --- a/osu-framework.sln.DotSettings +++ b/osu-framework.sln.DotSettings @@ -341,6 +341,8 @@ API ARGB BPM + FBO + CCL GC GL GLSL @@ -355,6 +357,7 @@ IOSGL IP IPC + IQ JIT LTRB MD5 diff --git a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingContainer.cs b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingContainer.cs index 378709bc5e..7d322201fe 100644 --- a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingContainer.cs +++ b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingContainer.cs @@ -339,9 +339,9 @@ public void TestKeyCombinationRepeatEvents() { Child = new TestKeyBindingReceptor { - Pressed = a => pressedReceived = a == TestAction.ActionAB, - Repeated = a => repeatedReceived = a == TestAction.ActionAB, - Released = a => releasedReceived = a == TestAction.ActionAB, + Pressed = a => pressedReceived = a == TestAction.ActionAb, + Repeated = a => repeatedReceived = a == TestAction.ActionAb, + Released = a => releasedReceived = a == TestAction.ActionAb, } }; }); @@ -500,7 +500,7 @@ public TestKeyBindingContainer(bool prioritised = false, SimultaneousBindingMode public override IEnumerable DefaultKeyBindings => new IKeyBinding[] { new KeyBinding(InputKey.A, TestAction.ActionA), - new KeyBinding(new KeyCombination(InputKey.A, InputKey.B), TestAction.ActionAB), + new KeyBinding(new KeyCombination(InputKey.A, InputKey.B), TestAction.ActionAb), new KeyBinding(InputKey.Enter, TestAction.ActionEnter), new KeyBinding(InputKey.Control, TestAction.ActionControl), new KeyBinding(InputKey.ExtraMouseButton4, TestAction.ActionMouse4), @@ -529,7 +529,7 @@ public InputBlockingDrawable() private enum TestAction { ActionA, - ActionAB, + ActionAb, ActionEnter, ActionControl, ActionMouse4, diff --git a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs index 08b3dacdf0..1596923882 100644 --- a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs +++ b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs @@ -187,19 +187,19 @@ public void SimultaneousBindingModes() checkReleased(TestAction.S, 1, 0, 1, 1, 1); toggleKey(Key.D); - checkPressed(TestAction.D_or_F, 1, 1, 1, 1, 1); + checkPressed(TestAction.DOrF, 1, 1, 1, 1, 1); toggleKey(Key.F); - check(TestAction.D_or_F, new CheckConditions(none, 1, 1), new CheckConditions(noneExact, 0, 1), new CheckConditions(noneModifiers, 1, 1), new CheckConditions(unique, 0, 0), new CheckConditions(all, 1, 0)); + check(TestAction.DOrF, new CheckConditions(none, 1, 1), new CheckConditions(noneExact, 0, 1), new CheckConditions(noneModifiers, 1, 1), new CheckConditions(unique, 0, 0), new CheckConditions(all, 1, 0)); toggleKey(Key.F); - checkReleased(TestAction.D_or_F, 0, 0, 0, 0, 1); + checkReleased(TestAction.DOrF, 0, 0, 0, 0, 1); toggleKey(Key.D); - checkReleased(TestAction.D_or_F, 1, 0, 1, 1, 1); + checkReleased(TestAction.DOrF, 1, 0, 1, 1, 1); toggleKey(Key.ShiftLeft); toggleKey(Key.AltLeft); - checkPressed(TestAction.Alt_and_LShift, 1, 1, 1, 1, 1); + checkPressed(TestAction.AltAndLShift, 1, 1, 1, 1, 1); toggleKey(Key.A); - checkPressed(TestAction.LShift_A, 1, 0, 0, 1, 1); + checkPressed(TestAction.LShiftA, 1, 0, 0, 1, 1); toggleKey(Key.AltLeft); toggleKey(Key.ShiftLeft); }); @@ -216,18 +216,18 @@ public void PerSideModifierKeys() checkPressed(TestAction.RShift, 0, 0, 0, 0, 0); toggleKey(Key.A); - checkPressed(TestAction.AnyShift_A, 0, 0, 0, 1, 1); - checkPressed(TestAction.LShift_A, 1, 1, 1, 1, 1); + checkPressed(TestAction.AnyShiftA, 0, 0, 0, 1, 1); + checkPressed(TestAction.LShiftA, 1, 1, 1, 1, 1); checkReleased(TestAction.AnyShift, 1, 1, 1, 0, 0); toggleKey(Key.ShiftRight); - checkReleased(TestAction.LShift_A, 1, 0, 0, 0, 0); + checkReleased(TestAction.LShiftA, 1, 0, 0, 0, 0); checkPressed(TestAction.RShift, 1, 0, 0, 1, 1); checkPressed(TestAction.AnyShift, 0, 0, 0, 0, 0); toggleKey(Key.ShiftLeft); checkReleased(TestAction.LShift, 0, 0, 0, 1, 1); - checkReleased(TestAction.LShift_A, 0, 1, 1, 1, 1); + checkReleased(TestAction.LShiftA, 0, 1, 1, 1, 1); checkReleased(TestAction.AnyShift, 0, 0, 0, 0, 0); toggleKey(Key.ShiftRight); @@ -244,21 +244,21 @@ public void BothSideModifierKeys() checkPressed(TestAction.Alt, 1, 1, 1, 1, 1); toggleKey(Key.A); checkReleased(TestAction.Alt, 1, 1, 1, 0, 0); - checkPressed(TestAction.Alt_A, 1, 1, 1, 1, 1); + checkPressed(TestAction.AltA, 1, 1, 1, 1, 1); toggleKey(Key.AltRight); checkPressed(TestAction.Alt, 0, 0, 0, 0, 0); - checkReleased(TestAction.Alt_A, 0, 0, 0, 0, 0); + checkReleased(TestAction.AltA, 0, 0, 0, 0, 0); toggleKey(Key.AltLeft); checkReleased(TestAction.Alt, 0, 0, 0, 0, 0); - checkReleased(TestAction.Alt_A, 0, 0, 0, 0, 0); + checkReleased(TestAction.AltA, 0, 0, 0, 0, 0); toggleKey(Key.AltRight); checkReleased(TestAction.Alt, 0, 0, 0, 1, 1); - checkReleased(TestAction.Alt_A, 1, 1, 1, 1, 1); + checkReleased(TestAction.AltA, 1, 1, 1, 1, 1); toggleKey(Key.A); toggleKey(Key.ControlLeft); toggleKey(Key.AltLeft); - checkPressed(TestAction.Ctrl_and_Alt, 1, 1, 1, 1, 1); + checkPressed(TestAction.CtrlAndAlt, 1, 1, 1, 1, 1); }); } @@ -289,7 +289,7 @@ public void MouseScrollAndButtons() toggleKey(Key.ControlLeft); scrollMouseWheel(0, 1); toggleKey(Key.ControlLeft); - check(TestAction.Ctrl_and_WheelUp, allPressAndReleased); + check(TestAction.CtrlAndWheelUp, allPressAndReleased); toggleMouseButton(MouseButton.Left); toggleMouseButton(MouseButton.Left); check(TestAction.LeftMouse, allPressAndReleased); @@ -320,7 +320,7 @@ public void Scroll() toggleKey(Key.ControlLeft); scrollMouseWheel(0, 4); toggleKey(Key.ControlLeft); - check(TestAction.Ctrl_and_WheelUp, allPressAndReleased(4)); + check(TestAction.CtrlAndWheelUp, allPressAndReleased(4)); }); } @@ -362,37 +362,37 @@ private enum TestAction { A, S, - D_or_F, - Ctrl_A, - Ctrl_S, - Ctrl_D_or_F, - Alt_A, - Alt_S, - Alt_D_or_F, - LShift_A, - LShift_S, - LShift_D_or_F, - RShift_A, - RShift_S, - RShift_D_or_F, - Ctrl_Shift_A, - Ctrl_Shift_S, - Ctrl_Shift_D_or_F, + DOrF, + CtrlA, + CtrlS, + CtrlDOrF, + AltA, + AltS, + AltDOrF, + LShiftA, + LShiftS, + LShiftDOrF, + RShiftA, + RShiftS, + RShiftDOrF, + CtrlShiftA, + CtrlShiftS, + CtrlShiftDOrF, Ctrl, RShift, LShift, Alt, - Alt_and_LShift, - Ctrl_and_Alt, - Ctrl_or_Shift, + AltAndLShift, + CtrlAndAlt, + CtrlOrShift, LeftMouse, RightMouse, WheelUp, WheelDown, WheelLeft, WheelRight, - Ctrl_and_WheelUp, - AnyShift_A, + CtrlAndWheelUp, + AnyShiftA, AnyShift } @@ -407,45 +407,45 @@ public TestInputManager(SimultaneousBindingMode concurrencyMode = SimultaneousBi { new KeyBinding(InputKey.A, TestAction.A), new KeyBinding(InputKey.S, TestAction.S), - new KeyBinding(InputKey.D, TestAction.D_or_F), - new KeyBinding(InputKey.F, TestAction.D_or_F), + new KeyBinding(InputKey.D, TestAction.DOrF), + new KeyBinding(InputKey.F, TestAction.DOrF), - new KeyBinding(new[] { InputKey.Control, InputKey.A }, TestAction.Ctrl_A), - new KeyBinding(new[] { InputKey.Control, InputKey.S }, TestAction.Ctrl_S), - new KeyBinding(new[] { InputKey.Control, InputKey.D }, TestAction.Ctrl_D_or_F), - new KeyBinding(new[] { InputKey.Control, InputKey.F }, TestAction.Ctrl_D_or_F), + new KeyBinding(new[] { InputKey.Control, InputKey.A }, TestAction.CtrlA), + new KeyBinding(new[] { InputKey.Control, InputKey.S }, TestAction.CtrlS), + new KeyBinding(new[] { InputKey.Control, InputKey.D }, TestAction.CtrlDOrF), + new KeyBinding(new[] { InputKey.Control, InputKey.F }, TestAction.CtrlDOrF), - new KeyBinding(new[] { InputKey.LShift, InputKey.A }, TestAction.LShift_A), - new KeyBinding(new[] { InputKey.LShift, InputKey.S }, TestAction.LShift_S), - new KeyBinding(new[] { InputKey.LShift, InputKey.D }, TestAction.LShift_D_or_F), - new KeyBinding(new[] { InputKey.LShift, InputKey.F }, TestAction.LShift_D_or_F), + new KeyBinding(new[] { InputKey.LShift, InputKey.A }, TestAction.LShiftA), + new KeyBinding(new[] { InputKey.LShift, InputKey.S }, TestAction.LShiftS), + new KeyBinding(new[] { InputKey.LShift, InputKey.D }, TestAction.LShiftDOrF), + new KeyBinding(new[] { InputKey.LShift, InputKey.F }, TestAction.LShiftDOrF), - new KeyBinding(new[] { InputKey.RShift, InputKey.A }, TestAction.RShift_A), - new KeyBinding(new[] { InputKey.RShift, InputKey.S }, TestAction.RShift_S), - new KeyBinding(new[] { InputKey.RShift, InputKey.D }, TestAction.RShift_D_or_F), - new KeyBinding(new[] { InputKey.RShift, InputKey.F }, TestAction.RShift_D_or_F), + new KeyBinding(new[] { InputKey.RShift, InputKey.A }, TestAction.RShiftA), + new KeyBinding(new[] { InputKey.RShift, InputKey.S }, TestAction.RShiftS), + new KeyBinding(new[] { InputKey.RShift, InputKey.D }, TestAction.RShiftDOrF), + new KeyBinding(new[] { InputKey.RShift, InputKey.F }, TestAction.RShiftDOrF), - new KeyBinding(new[] { InputKey.Shift, InputKey.A }, TestAction.AnyShift_A), + new KeyBinding(new[] { InputKey.Shift, InputKey.A }, TestAction.AnyShiftA), - new KeyBinding(new[] { InputKey.Alt, InputKey.A }, TestAction.Alt_A), - new KeyBinding(new[] { InputKey.Alt, InputKey.S }, TestAction.Alt_S), - new KeyBinding(new[] { InputKey.Alt, InputKey.D }, TestAction.Alt_D_or_F), - new KeyBinding(new[] { InputKey.Alt, InputKey.F }, TestAction.Alt_D_or_F), + new KeyBinding(new[] { InputKey.Alt, InputKey.A }, TestAction.AltA), + new KeyBinding(new[] { InputKey.Alt, InputKey.S }, TestAction.AltS), + new KeyBinding(new[] { InputKey.Alt, InputKey.D }, TestAction.AltDOrF), + new KeyBinding(new[] { InputKey.Alt, InputKey.F }, TestAction.AltDOrF), - new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.A }, TestAction.Ctrl_Shift_A), - new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.S }, TestAction.Ctrl_Shift_S), - new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.D }, TestAction.Ctrl_Shift_D_or_F), - new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.F }, TestAction.Ctrl_Shift_D_or_F), + new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.A }, TestAction.CtrlShiftA), + new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.S }, TestAction.CtrlShiftS), + new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.D }, TestAction.CtrlShiftDOrF), + new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.F }, TestAction.CtrlShiftDOrF), new KeyBinding(new[] { InputKey.Control }, TestAction.Ctrl), new KeyBinding(new[] { InputKey.Shift }, TestAction.AnyShift), new KeyBinding(new[] { InputKey.LShift }, TestAction.LShift), new KeyBinding(new[] { InputKey.RShift }, TestAction.RShift), new KeyBinding(new[] { InputKey.Alt }, TestAction.Alt), - new KeyBinding(new[] { InputKey.Alt, InputKey.LShift }, TestAction.Alt_and_LShift), - new KeyBinding(new[] { InputKey.Control, InputKey.Alt }, TestAction.Ctrl_and_Alt), - new KeyBinding(new[] { InputKey.Control }, TestAction.Ctrl_or_Shift), - new KeyBinding(new[] { InputKey.Shift }, TestAction.Ctrl_or_Shift), + new KeyBinding(new[] { InputKey.Alt, InputKey.LShift }, TestAction.AltAndLShift), + new KeyBinding(new[] { InputKey.Control, InputKey.Alt }, TestAction.CtrlAndAlt), + new KeyBinding(new[] { InputKey.Control }, TestAction.CtrlOrShift), + new KeyBinding(new[] { InputKey.Shift }, TestAction.CtrlOrShift), new KeyBinding(new[] { InputKey.MouseLeft }, TestAction.LeftMouse), new KeyBinding(new[] { InputKey.MouseRight }, TestAction.RightMouse), @@ -454,7 +454,7 @@ public TestInputManager(SimultaneousBindingMode concurrencyMode = SimultaneousBi new KeyBinding(new[] { InputKey.MouseWheelDown }, TestAction.WheelDown), new KeyBinding(new[] { InputKey.MouseWheelLeft }, TestAction.WheelLeft), new KeyBinding(new[] { InputKey.MouseWheelRight }, TestAction.WheelRight), - new KeyBinding(new[] { InputKey.Control, InputKey.MouseWheelUp }, TestAction.Ctrl_and_WheelUp), + new KeyBinding(new[] { InputKey.Control, InputKey.MouseWheelUp }, TestAction.CtrlAndWheelUp), }; protected override bool Handle(UIEvent e) diff --git a/osu.Framework/Configuration/FrameSync.cs b/osu.Framework/Configuration/FrameSync.cs index 1cdbf8f261..2630c2b06c 100644 --- a/osu.Framework/Configuration/FrameSync.cs +++ b/osu.Framework/Configuration/FrameSync.cs @@ -2,9 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; namespace osu.Framework.Configuration { + // todo: revisit when we have a way to exclude enum members from naming rules + [SuppressMessage("ReSharper", "InconsistentNaming")] public enum FrameSync { VSync, diff --git a/osu.Framework/Configuration/RendererType.cs b/osu.Framework/Configuration/RendererType.cs index b12d7a2a31..6a6f6b14b4 100644 --- a/osu.Framework/Configuration/RendererType.cs +++ b/osu.Framework/Configuration/RendererType.cs @@ -3,10 +3,13 @@ using System; using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using osu.Framework.Graphics.OpenGL; namespace osu.Framework.Configuration { + // todo: revisit when we have a way to exclude enum members from naming rules + [SuppressMessage("ReSharper", "InconsistentNaming")] public enum RendererType { [Description("Automatic")] diff --git a/osu.Framework/Graphics/Drawable.cs b/osu.Framework/Graphics/Drawable.cs index 0ef037c605..9f84e98092 100644 --- a/osu.Framework/Graphics/Drawable.cs +++ b/osu.Framework/Graphics/Drawable.cs @@ -22,6 +22,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Threading; @@ -2709,6 +2710,8 @@ public enum Invalidation /// x and y counterparts can be accessed using bitwise flags. /// [Flags] + // todo: revisit when we have a way to exclude enum members from naming rules + [SuppressMessage("ReSharper", "InconsistentNaming")] public enum Anchor { TopLeft = y0 | x0, diff --git a/osu.Framework/Graphics/Video/HardwareVideoDecoder.cs b/osu.Framework/Graphics/Video/HardwareVideoDecoder.cs index 95a504620e..d93add8565 100644 --- a/osu.Framework/Graphics/Video/HardwareVideoDecoder.cs +++ b/osu.Framework/Graphics/Video/HardwareVideoDecoder.cs @@ -3,6 +3,7 @@ using System; using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; namespace osu.Framework.Graphics.Video { @@ -13,6 +14,8 @@ namespace osu.Framework.Graphics.Video /// Contains decoders for ALL platforms. /// [Flags] + // todo: revisit when we have a way to exclude enum members from naming rules + [SuppressMessage("ReSharper", "InconsistentNaming")] public enum HardwareVideoDecoder { /// diff --git a/osu.Framework/Input/Bindings/InputKey.cs b/osu.Framework/Input/Bindings/InputKey.cs index d463e60e9d..adfa163a61 100644 --- a/osu.Framework/Input/Bindings/InputKey.cs +++ b/osu.Framework/Input/Bindings/InputKey.cs @@ -683,6 +683,8 @@ public enum InputKey /// /// The secondary backslash key. /// + // todo: revisit when we have a way to exclude enum members from naming rules + // ReSharper disable once InconsistentNaming NonUSBackSlash = 130, /// diff --git a/osu.Framework/Platform/Linux/Native/Library.cs b/osu.Framework/Platform/Linux/Native/Library.cs index 169125fd0b..fda59d2d0a 100644 --- a/osu.Framework/Platform/Linux/Native/Library.cs +++ b/osu.Framework/Platform/Linux/Native/Library.cs @@ -8,6 +8,8 @@ using System.IO; using System.Runtime.InteropServices; +// ReSharper disable InconsistentNaming + namespace osu.Framework.Platform.Linux.Native { public static class Library diff --git a/osu.Framework/Platform/MacOS/Native/NSStringEncoding.cs b/osu.Framework/Platform/MacOS/Native/NSStringEncoding.cs index 2c933d7543..47b3d4c004 100644 --- a/osu.Framework/Platform/MacOS/Native/NSStringEncoding.cs +++ b/osu.Framework/Platform/MacOS/Native/NSStringEncoding.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +// ReSharper disable InconsistentNaming + namespace osu.Framework.Platform.MacOS.Native { public enum NSStringEncoding : uint diff --git a/osu.Framework/Platform/Windows/Native/Execution.cs b/osu.Framework/Platform/Windows/Native/Execution.cs index 1eb20b8047..77dcd226f9 100644 --- a/osu.Framework/Platform/Windows/Native/Execution.cs +++ b/osu.Framework/Platform/Windows/Native/Execution.cs @@ -5,6 +5,8 @@ using System.Runtime.InteropServices; using System.Runtime.InteropServices.ComTypes; +// ReSharper disable InconsistentNaming + namespace osu.Framework.Platform.Windows.Native { internal static class Execution diff --git a/osu.Framework/Platform/Windows/Native/Imm.cs b/osu.Framework/Platform/Windows/Native/Imm.cs index 912ade6b00..6bc7dbd700 100644 --- a/osu.Framework/Platform/Windows/Native/Imm.cs +++ b/osu.Framework/Platform/Windows/Native/Imm.cs @@ -8,6 +8,8 @@ using Microsoft.Win32.SafeHandles; using osu.Framework.Extensions.EnumExtensions; +// ReSharper disable InconsistentNaming + namespace osu.Framework.Platform.Windows.Native { /// diff --git a/osu.Framework/Platform/Windows/Native/Input.cs b/osu.Framework/Platform/Windows/Native/Input.cs index 851172654f..cb1d7c736d 100644 --- a/osu.Framework/Platform/Windows/Native/Input.cs +++ b/osu.Framework/Platform/Windows/Native/Input.cs @@ -5,6 +5,8 @@ using System.Drawing; using System.Runtime.InteropServices; +// ReSharper disable InconsistentNaming + namespace osu.Framework.Platform.Windows.Native { internal static class Input diff --git a/osu.Framework/Platform/Windows/SDL2WindowsWindow.cs b/osu.Framework/Platform/Windows/SDL2WindowsWindow.cs index 4284cbf0e1..17c6a8df5a 100644 --- a/osu.Framework/Platform/Windows/SDL2WindowsWindow.cs +++ b/osu.Framework/Platform/Windows/SDL2WindowsWindow.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics.CodeAnalysis; using System.Drawing; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -321,6 +322,7 @@ public override Point PointToScreen(Point point) [DllImport("SHCore.dll", SetLastError = true)] internal static extern bool SetProcessDpiAwareness(ProcessDpiAwareness awareness); + [SuppressMessage("ReSharper", "InconsistentNaming")] internal enum ProcessDpiAwareness { Process_DPI_Unaware = 0, @@ -332,7 +334,7 @@ internal enum ProcessDpiAwareness [return: MarshalAs(UnmanagedType.Bool)] internal static extern bool SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT value); - // ReSharper disable once InconsistentNaming + [SuppressMessage("ReSharper", "InconsistentNaming")] internal enum DPI_AWARENESS_CONTEXT { DPI_AWARENESS_CONTEXT_UNAWARE = -1, diff --git a/osu.Framework/Platform/Windows/WindowsGLRenderer.cs b/osu.Framework/Platform/Windows/WindowsGLRenderer.cs index 7918d346ef..2cb6959d48 100644 --- a/osu.Framework/Platform/Windows/WindowsGLRenderer.cs +++ b/osu.Framework/Platform/Windows/WindowsGLRenderer.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -100,6 +101,7 @@ void queueNextAttempt() => Task.Delay(time_per_attempt, cancellationToken).Conti [DllImport("shell32.dll")] private static extern int SHQueryUserNotificationState(out QueryUserNotificationState state); + [SuppressMessage("ReSharper", "InconsistentNaming")] private enum QueryUserNotificationState { QUNS_NOT_PRESENT = 1, diff --git a/osu.Framework/RuntimeInfo.cs b/osu.Framework/RuntimeInfo.cs index ed1b83364d..778a34c549 100644 --- a/osu.Framework/RuntimeInfo.cs +++ b/osu.Framework/RuntimeInfo.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Reflection; using osu.Framework.Development; using osu.Framework.Extensions.ObjectExtensions; @@ -62,6 +63,8 @@ static RuntimeInfo() throw new PlatformNotSupportedException("Operating system could not be detected correctly."); } + // todo: revisit when we have a way to exclude enum members from naming rules + [SuppressMessage("ReSharper", "InconsistentNaming")] public enum Platform { Windows = 1, diff --git a/osu.Framework/Statistics/DotNetRuntimeListener.cs b/osu.Framework/Statistics/DotNetRuntimeListener.cs index ec7a6a9bc4..8633609303 100644 --- a/osu.Framework/Statistics/DotNetRuntimeListener.cs +++ b/osu.Framework/Statistics/DotNetRuntimeListener.cs @@ -74,12 +74,12 @@ protected override void OnEventWritten(EventWrittenEventArgs data) case source_runtime: switch ((GCEventType)data.EventId) { - case GCEventType.GCStart_V1 when data.Payload != null: + case GCEventType.GCStartV1 when data.Payload != null: // https://docs.microsoft.com/en-us/dotnet/framework/performance/garbage-collection-etw-events#gcstart_v1_event GlobalStatistics.Get(gc_statistics_grouping, $"Collections Gen{data.Payload[1]}").Value++; break; - case GCEventType.GCHeapStats_V1 when data.Payload != null: + case GCEventType.GCHeapStatsV1 when data.Payload != null: // https://docs.microsoft.com/en-us/dotnet/framework/performance/garbage-collection-etw-events#gcheapstats_v1_event for (int i = 0; i <= 6; i += 2) addStatistic($"Size Gen{i / 2}", data.Payload[i]); @@ -88,7 +88,7 @@ protected override void OnEventWritten(EventWrittenEventArgs data) addStatistic("Pinned objects", data.Payload[10]); break; - case GCEventType.GCAllocationTick_V2 when data.Payload != null: + case GCEventType.GCAllocationTickV2 when data.Payload != null: string name = (string)data.Payload[5]; if (string.IsNullOrEmpty(name)) break; @@ -134,9 +134,9 @@ private enum ArrayPoolEventType private enum GCEventType { - GCStart_V1 = 1, - GCHeapStats_V1 = 4, - GCAllocationTick_V2 = 10, + GCStartV1 = 1, + GCHeapStatsV1 = 4, + GCAllocationTickV2 = 10, FinalizeObject = 29 } } From 9670c3da19c1a20a25b694f3dfd829b6d2560838 Mon Sep 17 00:00:00 2001 From: Salman Alshamrani Date: Wed, 4 Dec 2024 06:07:47 -0500 Subject: [PATCH 2/2] Demote "usage of default struct equality" inspection to hint --- osu-framework.sln.DotSettings | 1 + 1 file changed, 1 insertion(+) diff --git a/osu-framework.sln.DotSettings b/osu-framework.sln.DotSettings index 6a0ab9a682..05061adb75 100644 --- a/osu-framework.sln.DotSettings +++ b/osu-framework.sln.DotSettings @@ -252,6 +252,7 @@ HINT HINT HINT + HINT DO_NOT_SHOW WARNING HINT