Skip to content

Commit

Permalink
Merge pull request #6443 from frenzibyte/fix-warnings
Browse files Browse the repository at this point in the history
Fix recent warnings seen on Rider 2024.3
  • Loading branch information
peppy authored Dec 4, 2024
2 parents d2f7780 + cf5d8d3 commit 13e82bd
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 78 deletions.
4 changes: 4 additions & 0 deletions osu-framework.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedParameter_002EGlobal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedParameter_002ELocal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedType_002EGlobal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UsageOfDefaultStructEquality/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseAwaitUsing/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseCollectionCountProperty/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseCollectionExpression/@EntryIndexedValue">HINT</s:String>
Expand Down Expand Up @@ -341,6 +342,8 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=API/@EntryIndexedValue">API</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ARGB/@EntryIndexedValue">ARGB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BPM/@EntryIndexedValue">BPM</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FBO/@EntryIndexedValue">FBO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=CCL/@EntryIndexedValue">CCL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GC/@EntryIndexedValue">GC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GL/@EntryIndexedValue">GL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GLSL/@EntryIndexedValue">GLSL</s:String>
Expand All @@ -355,6 +358,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IOSGL/@EntryIndexedValue">IOSGL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IPC/@EntryIndexedValue">IPC</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IQ/@EntryIndexedValue">IQ</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=JIT/@EntryIndexedValue">JIT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LTRB/@EntryIndexedValue">LTRB</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=MD/@EntryIndexedValue">MD5</s:String>
Expand Down
10 changes: 5 additions & 5 deletions osu.Framework.Tests/Visual/Input/TestSceneKeyBindingContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
};
});
Expand Down Expand Up @@ -500,7 +500,7 @@ public TestKeyBindingContainer(bool prioritised = false, SimultaneousBindingMode
public override IEnumerable<IKeyBinding> 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),
Expand Down Expand Up @@ -529,7 +529,7 @@ public InputBlockingDrawable()
private enum TestAction
{
ActionA,
ActionAB,
ActionAb,
ActionEnter,
ActionControl,
ActionMouse4,
Expand Down
132 changes: 66 additions & 66 deletions osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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);
Expand All @@ -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);
});
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
});
}

Expand Down Expand Up @@ -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
}

Expand All @@ -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),
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions osu.Framework/Configuration/FrameSync.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions osu.Framework/Configuration/RendererType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
3 changes: 3 additions & 0 deletions osu.Framework/Graphics/Drawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -2709,6 +2710,8 @@ public enum Invalidation
/// x and y counterparts can be accessed using bitwise flags.
/// </summary>
[Flags]
// todo: revisit when we have a way to exclude enum members from naming rules
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum Anchor
{
TopLeft = y0 | x0,
Expand Down
3 changes: 3 additions & 0 deletions osu.Framework/Graphics/Video/HardwareVideoDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;

namespace osu.Framework.Graphics.Video
{
Expand All @@ -13,6 +14,8 @@ namespace osu.Framework.Graphics.Video
/// Contains decoders for ALL platforms.
/// </remarks>
[Flags]
// todo: revisit when we have a way to exclude enum members from naming rules
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum HardwareVideoDecoder
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions osu.Framework/Input/Bindings/InputKey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@ public enum InputKey
/// <summary>
/// The secondary backslash key.
/// </summary>
// todo: revisit when we have a way to exclude enum members from naming rules
// ReSharper disable once InconsistentNaming
NonUSBackSlash = 130,

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions osu.Framework/Platform/Linux/Native/Library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using System.IO;
using System.Runtime.InteropServices;

// ReSharper disable InconsistentNaming

namespace osu.Framework.Platform.Linux.Native
{
public static class Library
Expand Down
2 changes: 2 additions & 0 deletions osu.Framework/Platform/MacOS/Native/NSStringEncoding.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. 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
Expand Down
2 changes: 2 additions & 0 deletions osu.Framework/Platform/Windows/Native/Execution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions osu.Framework/Platform/Windows/Native/Imm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Microsoft.Win32.SafeHandles;
using osu.Framework.Extensions.EnumExtensions;

// ReSharper disable InconsistentNaming

namespace osu.Framework.Platform.Windows.Native
{
/// <summary>
Expand Down
Loading

0 comments on commit 13e82bd

Please sign in to comment.