From 981a19f6a5c6a9b2d9ef904e9644ac82af5e7007 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 1 May 2024 17:17:50 +0300 Subject: [PATCH 1/8] Disable naming inspections in p/invoke code --- osu.Desktop/NVAPI.cs | 3 +++ osu.Desktop/Windows/WindowsAssociationManager.cs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/osu.Desktop/NVAPI.cs b/osu.Desktop/NVAPI.cs index 554f89a847..c1622e7cc1 100644 --- a/osu.Desktop/NVAPI.cs +++ b/osu.Desktop/NVAPI.cs @@ -489,6 +489,7 @@ namespace osu.Desktop public static uint Stride => (uint)Marshal.SizeOf(typeof(NvApplication)) | (2 << 16); } + // ReSharper disable InconsistentNaming internal enum NvStatus { OK = 0, // Success. Request is completed. @@ -738,4 +739,6 @@ namespace osu.Desktop OGL_THREAD_CONTROL_NUM_VALUES = 2, OGL_THREAD_CONTROL_DEFAULT = 0 } + + // ReSharper restore InconsistentNaming } diff --git a/osu.Desktop/Windows/WindowsAssociationManager.cs b/osu.Desktop/Windows/WindowsAssociationManager.cs index 11b5c19ca1..e4c070934e 100644 --- a/osu.Desktop/Windows/WindowsAssociationManager.cs +++ b/osu.Desktop/Windows/WindowsAssociationManager.cs @@ -163,6 +163,8 @@ namespace osu.Desktop.Windows [DllImport("Shell32.dll")] private static extern void SHChangeNotify(EventId wEventId, Flags uFlags, IntPtr dwItem1, IntPtr dwItem2); + // ReSharper disable InconsistentNaming + private enum EventId { /// @@ -174,9 +176,12 @@ namespace osu.Desktop.Windows private enum Flags : uint { + // ReSharper disable once InconsistentNaming SHCNF_IDLIST = 0x0000 } + // ReSharper restore InconsistentNaming + #endregion private record FileAssociation(string Extension, LocalisableString Description, string IconPath) From 02be275554beed4e450c8eca29d1cf979890d489 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 1 May 2024 17:20:20 +0300 Subject: [PATCH 2/8] Disable naming inspections in country/language enums --- osu.Game/Localisation/Language.cs | 2 ++ osu.Game/Users/CountryCode.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game/Localisation/Language.cs b/osu.Game/Localisation/Language.cs index 711e95486f..e946779cba 100644 --- a/osu.Game/Localisation/Language.cs +++ b/osu.Game/Localisation/Language.cs @@ -4,6 +4,8 @@ using System.ComponentModel; using JetBrains.Annotations; +// ReSharper disable InconsistentNaming + namespace osu.Game.Localisation { [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] diff --git a/osu.Game/Users/CountryCode.cs b/osu.Game/Users/CountryCode.cs index edaa1562c7..6a0ed63648 100644 --- a/osu.Game/Users/CountryCode.cs +++ b/osu.Game/Users/CountryCode.cs @@ -6,6 +6,8 @@ using JetBrains.Annotations; using Newtonsoft.Json; using Newtonsoft.Json.Converters; +// ReSharper disable InconsistentNaming + namespace osu.Game.Users { /// From 2fd8950b2135edde3d63431ea68e25f951a93b5b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 1 May 2024 17:22:08 +0300 Subject: [PATCH 3/8] Disable inconsistent naming in some fields of `LegacyManiaSkinConfigurationLookup` --- osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs b/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs index cacca0de23..1550fc8a47 100644 --- a/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs +++ b/osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs @@ -67,7 +67,10 @@ namespace osu.Game.Skinning LeftStageImage, RightStageImage, BottomStageImage, + + // ReSharper disable once InconsistentNaming Hit300g, + Hit300, Hit200, Hit100, From 97fc2a5473854b403525bcc028aaf24711af58ec Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 1 May 2024 17:20:57 +0300 Subject: [PATCH 4/8] Disable inconsistent naming in some fields of `ScoreRank` --- osu.Game/Scoring/ScoreRank.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Scoring/ScoreRank.cs b/osu.Game/Scoring/ScoreRank.cs index 327e4191d7..957cfc9b95 100644 --- a/osu.Game/Scoring/ScoreRank.cs +++ b/osu.Game/Scoring/ScoreRank.cs @@ -35,6 +35,7 @@ namespace osu.Game.Scoring [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankSH))] [Description(@"S+")] + // ReSharper disable once InconsistentNaming SH, [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankX))] @@ -43,6 +44,7 @@ namespace osu.Game.Scoring [LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankXH))] [Description(@"SS+")] + // ReSharper disable once InconsistentNaming XH, } } From 16bae4f0046f0c9bde8cdadb2a96f535c0904744 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 1 May 2024 17:22:42 +0300 Subject: [PATCH 5/8] Update naming of enum fields in `StartMode` --- .../Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs index 66acd6d1b0..5446211ced 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Match/MultiplayerMatchSettingsOverlay.cs @@ -486,16 +486,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match Off = 0, [Description("30 seconds")] - Seconds_30 = 30, + Seconds30 = 30, [Description("1 minute")] - Seconds_60 = 60, + Seconds60 = 60, [Description("3 minutes")] - Seconds_180 = 180, + Seconds180 = 180, [Description("5 minutes")] - Seconds_300 = 300 + Seconds300 = 300 } } } From e8a63813953ac17f3f646fe02dcfdf6f404cb158 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 1 May 2024 17:22:52 +0300 Subject: [PATCH 6/8] Update naming of enum fields in `ObjType` --- osu.Game/IO/Legacy/SerializationReader.cs | 76 +++++++++++------------ osu.Game/IO/Legacy/SerializationWriter.cs | 40 ++++++------ 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/osu.Game/IO/Legacy/SerializationReader.cs b/osu.Game/IO/Legacy/SerializationReader.cs index 2d3d5bffd5..fc61b028a4 100644 --- a/osu.Game/IO/Legacy/SerializationReader.cs +++ b/osu.Game/IO/Legacy/SerializationReader.cs @@ -123,58 +123,58 @@ namespace osu.Game.IO.Legacy switch (t) { - case ObjType.boolType: + case ObjType.BoolType: return ReadBoolean(); - case ObjType.byteType: + case ObjType.ByteType: return ReadByte(); - case ObjType.uint16Type: + case ObjType.UInt16Type: return ReadUInt16(); - case ObjType.uint32Type: + case ObjType.UInt32Type: return ReadUInt32(); - case ObjType.uint64Type: + case ObjType.UInt64Type: return ReadUInt64(); - case ObjType.sbyteType: + case ObjType.SByteType: return ReadSByte(); - case ObjType.int16Type: + case ObjType.Int16Type: return ReadInt16(); - case ObjType.int32Type: + case ObjType.Int32Type: return ReadInt32(); - case ObjType.int64Type: + case ObjType.Int64Type: return ReadInt64(); - case ObjType.charType: + case ObjType.CharType: return ReadChar(); - case ObjType.stringType: + case ObjType.StringType: return base.ReadString(); - case ObjType.singleType: + case ObjType.SingleType: return ReadSingle(); - case ObjType.doubleType: + case ObjType.DoubleType: return ReadDouble(); - case ObjType.decimalType: + case ObjType.DecimalType: return ReadDecimal(); - case ObjType.dateTimeType: + case ObjType.DateTimeType: return ReadDateTime(); - case ObjType.byteArrayType: + case ObjType.ByteArrayType: return ReadByteArray(); - case ObjType.charArrayType: + case ObjType.CharArrayType: return ReadCharArray(); - case ObjType.otherType: + case ObjType.OtherType: throw new IOException("Deserialization of arbitrary type is not supported."); default: @@ -185,25 +185,25 @@ namespace osu.Game.IO.Legacy public enum ObjType : byte { - nullType, - boolType, - byteType, - uint16Type, - uint32Type, - uint64Type, - sbyteType, - int16Type, - int32Type, - int64Type, - charType, - stringType, - singleType, - doubleType, - decimalType, - dateTimeType, - byteArrayType, - charArrayType, - otherType, - ILegacySerializableType + NullType, + BoolType, + ByteType, + UInt16Type, + UInt32Type, + UInt64Type, + SByteType, + Int16Type, + Int32Type, + Int64Type, + CharType, + StringType, + SingleType, + DoubleType, + DecimalType, + DateTimeType, + ByteArrayType, + CharArrayType, + OtherType, + LegacySerializableType } } diff --git a/osu.Game/IO/Legacy/SerializationWriter.cs b/osu.Game/IO/Legacy/SerializationWriter.cs index 10572a6478..afe86cd096 100644 --- a/osu.Game/IO/Legacy/SerializationWriter.cs +++ b/osu.Game/IO/Legacy/SerializationWriter.cs @@ -34,11 +34,11 @@ namespace osu.Game.IO.Legacy { if (str == null) { - Write((byte)ObjType.nullType); + Write((byte)ObjType.NullType); } else { - Write((byte)ObjType.stringType); + Write((byte)ObjType.StringType); base.Write(str); } } @@ -125,94 +125,94 @@ namespace osu.Game.IO.Legacy { if (obj == null) { - Write((byte)ObjType.nullType); + Write((byte)ObjType.NullType); } else { switch (obj) { case bool boolObj: - Write((byte)ObjType.boolType); + Write((byte)ObjType.BoolType); Write(boolObj); break; case byte byteObj: - Write((byte)ObjType.byteType); + Write((byte)ObjType.ByteType); Write(byteObj); break; case ushort ushortObj: - Write((byte)ObjType.uint16Type); + Write((byte)ObjType.UInt16Type); Write(ushortObj); break; case uint uintObj: - Write((byte)ObjType.uint32Type); + Write((byte)ObjType.UInt32Type); Write(uintObj); break; case ulong ulongObj: - Write((byte)ObjType.uint64Type); + Write((byte)ObjType.UInt64Type); Write(ulongObj); break; case sbyte sbyteObj: - Write((byte)ObjType.sbyteType); + Write((byte)ObjType.SByteType); Write(sbyteObj); break; case short shortObj: - Write((byte)ObjType.int16Type); + Write((byte)ObjType.Int16Type); Write(shortObj); break; case int intObj: - Write((byte)ObjType.int32Type); + Write((byte)ObjType.Int32Type); Write(intObj); break; case long longObj: - Write((byte)ObjType.int64Type); + Write((byte)ObjType.Int64Type); Write(longObj); break; case char charObj: - Write((byte)ObjType.charType); + Write((byte)ObjType.CharType); base.Write(charObj); break; case string stringObj: - Write((byte)ObjType.stringType); + Write((byte)ObjType.StringType); base.Write(stringObj); break; case float floatObj: - Write((byte)ObjType.singleType); + Write((byte)ObjType.SingleType); Write(floatObj); break; case double doubleObj: - Write((byte)ObjType.doubleType); + Write((byte)ObjType.DoubleType); Write(doubleObj); break; case decimal decimalObj: - Write((byte)ObjType.decimalType); + Write((byte)ObjType.DecimalType); Write(decimalObj); break; case DateTime dateTimeObj: - Write((byte)ObjType.dateTimeType); + Write((byte)ObjType.DateTimeType); Write(dateTimeObj); break; case byte[] byteArray: - Write((byte)ObjType.byteArrayType); + Write((byte)ObjType.ByteArrayType); base.Write(byteArray); break; case char[] charArray: - Write((byte)ObjType.charArrayType); + Write((byte)ObjType.CharArrayType); base.Write(charArray); break; From 9dc1a58ce7a4fb00a973a3ce4498b5bff8164e16 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 1 May 2024 17:23:27 +0300 Subject: [PATCH 7/8] Add few abbreviations from existing enums to appease naming inspection --- osu.sln.DotSettings | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index dd71744bf0..51af281ac6 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -340,6 +340,7 @@ API ARGB BPM + DDKK EF FPS GC @@ -357,6 +358,8 @@ IP IPC JIT + KDDK + KKDD LTRB MD5 NS @@ -375,6 +378,7 @@ QAT BNG UI + WIP False HINT <?xml version="1.0" encoding="utf-16"?> From 30fd40efd16a651a6c00b5c89289a85ffcbe546b Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 1 May 2024 21:18:56 +0300 Subject: [PATCH 8/8] Avoid disable/restore pairs --- osu.Desktop/NVAPI.cs | 9 ++++++--- osu.Desktop/Windows/WindowsAssociationManager.cs | 8 +++----- osu.Game/Localisation/Language.cs | 4 ++-- osu.Game/Users/CountryCode.cs | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/osu.Desktop/NVAPI.cs b/osu.Desktop/NVAPI.cs index c1622e7cc1..0b09613ba0 100644 --- a/osu.Desktop/NVAPI.cs +++ b/osu.Desktop/NVAPI.cs @@ -489,7 +489,7 @@ namespace osu.Desktop public static uint Stride => (uint)Marshal.SizeOf(typeof(NvApplication)) | (2 << 16); } - // ReSharper disable InconsistentNaming + [SuppressMessage("ReSharper", "InconsistentNaming")] internal enum NvStatus { OK = 0, // Success. Request is completed. @@ -612,6 +612,7 @@ namespace osu.Desktop FIRMWARE_REVISION_NOT_SUPPORTED = -200, // The device's firmware is not supported. } + [SuppressMessage("ReSharper", "InconsistentNaming")] internal enum NvSystemType { UNKNOWN = 0, @@ -619,6 +620,7 @@ namespace osu.Desktop DESKTOP = 2 } + [SuppressMessage("ReSharper", "InconsistentNaming")] internal enum NvGpuType { UNKNOWN = 0, @@ -626,6 +628,7 @@ namespace osu.Desktop DGPU = 2, // Discrete } + [SuppressMessage("ReSharper", "InconsistentNaming")] internal enum NvSettingID : uint { OGL_AA_LINE_GAMMA_ID = 0x2089BF6C, @@ -718,6 +721,7 @@ namespace osu.Desktop INVALID_SETTING_ID = 0xFFFFFFFF } + [SuppressMessage("ReSharper", "InconsistentNaming")] internal enum NvShimSetting : uint { SHIM_RENDERING_MODE_INTEGRATED = 0x00000000, @@ -732,6 +736,7 @@ namespace osu.Desktop SHIM_RENDERING_MODE_DEFAULT = SHIM_RENDERING_MODE_AUTO_SELECT } + [SuppressMessage("ReSharper", "InconsistentNaming")] internal enum NvThreadControlSetting : uint { OGL_THREAD_CONTROL_ENABLE = 0x00000001, @@ -739,6 +744,4 @@ namespace osu.Desktop OGL_THREAD_CONTROL_NUM_VALUES = 2, OGL_THREAD_CONTROL_DEFAULT = 0 } - - // ReSharper restore InconsistentNaming } diff --git a/osu.Desktop/Windows/WindowsAssociationManager.cs b/osu.Desktop/Windows/WindowsAssociationManager.cs index e4c070934e..b32c01433d 100644 --- a/osu.Desktop/Windows/WindowsAssociationManager.cs +++ b/osu.Desktop/Windows/WindowsAssociationManager.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.IO; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -163,8 +164,7 @@ namespace osu.Desktop.Windows [DllImport("Shell32.dll")] private static extern void SHChangeNotify(EventId wEventId, Flags uFlags, IntPtr dwItem1, IntPtr dwItem2); - // ReSharper disable InconsistentNaming - + [SuppressMessage("ReSharper", "InconsistentNaming")] private enum EventId { /// @@ -174,14 +174,12 @@ namespace osu.Desktop.Windows SHCNE_ASSOCCHANGED = 0x08000000 } + [SuppressMessage("ReSharper", "InconsistentNaming")] private enum Flags : uint { - // ReSharper disable once InconsistentNaming SHCNF_IDLIST = 0x0000 } - // ReSharper restore InconsistentNaming - #endregion private record FileAssociation(string Extension, LocalisableString Description, string IconPath) diff --git a/osu.Game/Localisation/Language.cs b/osu.Game/Localisation/Language.cs index e946779cba..4e1fc3a474 100644 --- a/osu.Game/Localisation/Language.cs +++ b/osu.Game/Localisation/Language.cs @@ -2,12 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using JetBrains.Annotations; -// ReSharper disable InconsistentNaming - namespace osu.Game.Localisation { + [SuppressMessage("ReSharper", "InconsistentNaming")] [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] public enum Language { diff --git a/osu.Game/Users/CountryCode.cs b/osu.Game/Users/CountryCode.cs index 6a0ed63648..59fcd5d625 100644 --- a/osu.Game/Users/CountryCode.cs +++ b/osu.Game/Users/CountryCode.cs @@ -2,18 +2,18 @@ // See the LICENCE file in the repository root for full licence text. using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using JetBrains.Annotations; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -// ReSharper disable InconsistentNaming - namespace osu.Game.Users { /// /// Matches `osu_countries` database table. /// [JsonConverter(typeof(StringEnumConverter))] + [SuppressMessage("ReSharper", "InconsistentNaming")] [UsedImplicitly(ImplicitUseTargetFlags.WithMembers)] public enum CountryCode {