Skip to content

Commit

Permalink
Enable inspections for unused method parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Aug 6, 2021
1 parent 1848b03 commit 6a2250e
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 18 deletions.
4 changes: 2 additions & 2 deletions osu-framework.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedMember_002ELocal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedMethodReturnValue_002EGlobal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedMethodReturnValue_002ELocal/@EntryIndexedValue">HINT</s:String>
<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/=UnusedParameter_002EGlobal/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedParameter_002ELocal/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedType_002EGlobal/@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>
Expand Down
13 changes: 3 additions & 10 deletions osu.Framework/Host.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,23 @@
using osu.Framework.Platform.MacOS;
using osu.Framework.Platform.Windows;
using System;
using osuTK;

namespace osu.Framework
{
public static class Host
{
public static DesktopGameHost GetSuitableHost(string gameName, bool bindIPC = false, bool portableInstallation = false)
{
var toolkitOptions = new ToolkitOptions
{
EnableHighResolution = true,
Backend = RuntimeInfo.OS == RuntimeInfo.Platform.Linux ? PlatformBackend.Default : PlatformBackend.PreferNative
};

switch (RuntimeInfo.OS)
{
case RuntimeInfo.Platform.macOS:
return new MacOSGameHost(gameName, bindIPC, toolkitOptions, portableInstallation);
return new MacOSGameHost(gameName, bindIPC);

case RuntimeInfo.Platform.Linux:
return new LinuxGameHost(gameName, bindIPC, toolkitOptions, portableInstallation);
return new LinuxGameHost(gameName, bindIPC);

case RuntimeInfo.Platform.Windows:
return new WindowsGameHost(gameName, bindIPC, toolkitOptions, portableInstallation);
return new WindowsGameHost(gameName, bindIPC);

default:
throw new InvalidOperationException($"Could not find a suitable host for the selected operating system ({Enum.GetName(typeof(RuntimeInfo.Platform), RuntimeInfo.OS)}).");
Expand Down
3 changes: 1 addition & 2 deletions osu.Framework/Platform/Linux/LinuxGameHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
using System;
using System.IO;
using osu.Framework.Platform.Linux.SDL2;
using osuTK;

namespace osu.Framework.Platform.Linux
{
public class LinuxGameHost : DesktopGameHost
{
internal LinuxGameHost(string gameName, bool bindIPC = false, ToolkitOptions toolkitOptions = default, bool portableInstallation = false)
internal LinuxGameHost(string gameName, bool bindIPC = false, bool portableInstallation = false)
: base(gameName, bindIPC, portableInstallation)
{
}
Expand Down
3 changes: 1 addition & 2 deletions osu.Framework/Platform/MacOS/MacOSGameHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Handlers;
using osu.Framework.Input.Handlers.Mouse;
using osuTK;
using osuTK.Graphics.OpenGL;

namespace osu.Framework.Platform.MacOS
{
public class MacOSGameHost : DesktopGameHost
{
internal MacOSGameHost(string gameName, bool bindIPC = false, ToolkitOptions toolkitOptions = default, bool portableInstallation = false)
internal MacOSGameHost(string gameName, bool bindIPC = false, bool portableInstallation = false)
: base(gameName, bindIPC, portableInstallation)
{
}
Expand Down
2 changes: 2 additions & 0 deletions osu.Framework/Platform/SDL2DesktopWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
using Rectangle = System.Drawing.Rectangle;
using Size = System.Drawing.Size;

// ReSharper disable UnusedParameter.Local (Class regularly handles native events where we don't consume all parameters)

namespace osu.Framework.Platform
{
/// <summary>
Expand Down
3 changes: 1 addition & 2 deletions osu.Framework/Platform/Windows/WindowsGameHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using osu.Framework.Input.Handlers;
using osu.Framework.Input.Handlers.Mouse;
using osu.Framework.Platform.Windows.Native;
using osuTK;

namespace osu.Framework.Platform.Windows
{
Expand All @@ -28,7 +27,7 @@ public class WindowsGameHost : DesktopGameHost
#endif
public override bool CapsLockEnabled => Console.CapsLock;

internal WindowsGameHost(string gameName, bool bindIPC = false, ToolkitOptions toolkitOptions = default, bool portableInstallation = false)
internal WindowsGameHost(string gameName, bool bindIPC = false, bool portableInstallation = false)
: base(gameName, bindIPC, portableInstallation)
{
}
Expand Down
2 changes: 2 additions & 0 deletions osu.Framework/Platform/Windows/WindowsMouseHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
using osuTK;
using SDL2;

// ReSharper disable UnusedParameter.Local (Class regularly handles native events where we don't consume all parameters)

namespace osu.Framework.Platform.Windows
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions osu.Framework/Statistics/DotNetRuntimeListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ protected override void OnEventWritten(EventWrittenEventArgs data)
/// Attrib: https://stackoverflow.com/questions/26972066/type-from-intptr-handle/54469241#54469241
/// </remarks>
// ReSharper disable once RedundantUnsafeContext
// ReSharper disable once UnusedParameter.Local
private static unsafe Type getTypeFromHandle(IntPtr handle)
{
#if NET5_0
Expand Down

0 comments on commit 6a2250e

Please sign in to comment.