Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle new naming inspections on certain enums #28051

Merged
merged 8 commits into from
May 2, 2024
3 changes: 3 additions & 0 deletions osu.Desktop/NVAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ internal struct NvApplication
public static uint Stride => (uint)Marshal.SizeOf(typeof(NvApplication)) | (2 << 16);
}

// ReSharper disable InconsistentNaming
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use [SuppressMessage("ReSharper", "InconsistentNaming")] instead? I really dislike the disable/restore pairs.

If that's not feasible, I'd just disable at a file level

https://github.com/ppy/osu-framework/blob/63405204eba19d054f24c8f349137129a1557936/osu.Framework/Graphics/Sprites/FontAwesome.cs#L8

internal enum NvStatus
{
OK = 0, // Success. Request is completed.
Expand Down Expand Up @@ -738,4 +739,6 @@ internal enum NvThreadControlSetting : uint
OGL_THREAD_CONTROL_NUM_VALUES = 2,
OGL_THREAD_CONTROL_DEFAULT = 0
}

// ReSharper restore InconsistentNaming
}
5 changes: 5 additions & 0 deletions osu.Desktop/Windows/WindowsAssociationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ string getLocalisedString(LocalisableString s)
[DllImport("Shell32.dll")]
private static extern void SHChangeNotify(EventId wEventId, Flags uFlags, IntPtr dwItem1, IntPtr dwItem2);

// ReSharper disable InconsistentNaming

private enum EventId
{
/// <summary>
Expand All @@ -174,9 +176,12 @@ private enum EventId

private enum Flags : uint
{
// ReSharper disable once InconsistentNaming
SHCNF_IDLIST = 0x0000
}

// ReSharper restore InconsistentNaming

#endregion

private record FileAssociation(string Extension, LocalisableString Description, string IconPath)
Expand Down
76 changes: 38 additions & 38 deletions osu.Game/IO/Legacy/SerializationReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,58 +123,58 @@ public object ReadObject()

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:
Expand All @@ -185,25 +185,25 @@ public object ReadObject()

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
}
}
40 changes: 20 additions & 20 deletions osu.Game/IO/Legacy/SerializationWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public override void Write(string str)
{
if (str == null)
{
Write((byte)ObjType.nullType);
Write((byte)ObjType.NullType);
}
else
{
Write((byte)ObjType.stringType);
Write((byte)ObjType.StringType);
base.Write(str);
}
}
Expand Down Expand Up @@ -125,94 +125,94 @@ public void WriteObject(object obj)
{
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;

Expand Down
2 changes: 2 additions & 0 deletions osu.Game/Localisation/Language.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.ComponentModel;
using JetBrains.Annotations;

// ReSharper disable InconsistentNaming

namespace osu.Game.Localisation
{
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
Expand Down
2 changes: 2 additions & 0 deletions osu.Game/Scoring/ScoreRank.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public enum ScoreRank

[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankSH))]
[Description(@"S+")]
// ReSharper disable once InconsistentNaming
SH,

[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankX))]
Expand All @@ -43,6 +44,7 @@ public enum ScoreRank

[LocalisableDescription(typeof(BeatmapsStrings), nameof(BeatmapsStrings.RankXH))]
[Description(@"SS+")]
// ReSharper disable once InconsistentNaming
XH,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -486,16 +486,16 @@ private enum StartMode
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
}
}
}
3 changes: 3 additions & 0 deletions osu.Game/Skinning/LegacyManiaSkinConfigurationLookup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ public enum LegacyManiaSkinConfigurationLookups
LeftStageImage,
RightStageImage,
BottomStageImage,

// ReSharper disable once InconsistentNaming
Hit300g,

Hit300,
Hit200,
Hit100,
Expand Down
2 changes: 2 additions & 0 deletions osu.Game/Users/CountryCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

// ReSharper disable InconsistentNaming

namespace osu.Game.Users
{
/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions osu.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@
<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/=DDKK/@EntryIndexedValue">DDKK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=EF/@EntryIndexedValue">EF</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FPS/@EntryIndexedValue">FPS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GC/@EntryIndexedValue">GC</s:String>
Expand All @@ -357,6 +358,8 @@
<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/=JIT/@EntryIndexedValue">JIT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KDDK/@EntryIndexedValue">KDDK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KKDD/@EntryIndexedValue">KKDD</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>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NS/@EntryIndexedValue">NS</s:String>
Expand All @@ -375,6 +378,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=QAT/@EntryIndexedValue">QAT</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BNG/@EntryIndexedValue">BNG</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=UI/@EntryIndexedValue">UI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=WIP/@EntryIndexedValue">WIP</s:String>
<s:Boolean x:Key="/Default/CodeStyle/Naming/CSharpNaming/ApplyAutoDetectedRules/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=EnumMember/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&#xD;
Expand Down
Loading