Enable MEN018 and fix noncompliance (except in Cores)
"Use Digit Separators" in integer literals
This commit is contained in:
parent
74e50c3041
commit
21cdc86e8c
|
@ -386,6 +386,8 @@ dotnet_diagnostic.MEN014.severity = warning
|
||||||
dotnet_diagnostic.MEN015.severity = silent
|
dotnet_diagnostic.MEN015.severity = silent
|
||||||
# Use object-oriented methods instead of top-level statements
|
# Use object-oriented methods instead of top-level statements
|
||||||
dotnet_diagnostic.MEN016.severity = silent
|
dotnet_diagnostic.MEN016.severity = silent
|
||||||
|
# Use Digit Separators
|
||||||
|
dotnet_diagnostic.MEN018.severity = warning
|
||||||
|
|
||||||
## Microsoft.CodeAnalysis.BannedApiAnalyzers rules
|
## Microsoft.CodeAnalysis.BannedApiAnalyzers rules
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<Import Project="../Common.props" />
|
<Import Project="../Common.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<NoWarn>$(NoWarn);SA1200</NoWarn>
|
<NoWarn>$(NoWarn);MEN018;SA1200</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="*.sh" />
|
<None Remove="*.sh" />
|
||||||
|
|
|
@ -69,18 +69,18 @@ namespace BizHawk.Client.Common.cheats
|
||||||
hexCode |= y;
|
hexCode |= y;
|
||||||
}
|
}
|
||||||
|
|
||||||
long decoded = (hexCode & 0xFF00000000) >> 32;
|
long decoded = (hexCode & 0xFF_0000_0000) >> 32;
|
||||||
decoded |= hexCode & 0x00FF000000;
|
decoded |= hexCode & 0x00_FF00_0000;
|
||||||
decoded |= (hexCode & 0x0000FF0000) << 16;
|
decoded |= (hexCode & 0x00_00FF_0000) << 16;
|
||||||
decoded |= (hexCode & 0x00000000700) << 5;
|
decoded |= (hexCode & 0x00_0000_0700) << 5;
|
||||||
decoded |= (hexCode & 0x000000F800) >> 3;
|
decoded |= (hexCode & 0x00_0000_F800) >> 3;
|
||||||
decoded |= (hexCode & 0x00000000FF) << 16;
|
decoded |= (hexCode & 0x00_0000_00FF) << 16;
|
||||||
|
|
||||||
return new DecodeResult
|
return new DecodeResult
|
||||||
{
|
{
|
||||||
Size = WatchSize.Word,
|
Size = WatchSize.Word,
|
||||||
Value = (int)(decoded & 0x000000FFFF),
|
Value = (int) (decoded & 0x00_0000_FFFF),
|
||||||
Address= (int)((decoded & 0xFFFFFF0000) >> 16)
|
Address = (int) ((decoded & 0xFF_FFFF_0000) >> 16),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,11 +203,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public enum StartCode : ulong
|
public enum StartCode : ulong
|
||||||
{
|
{
|
||||||
Main = 0x4e4d7a561f5f04ad,
|
// where tf does this incantation come from --yoshi
|
||||||
Stream = 0x4e5311405bf2f9db,
|
Main = 0x4E4D_7A56_1F5F_04AD,
|
||||||
Syncpoint = 0x4e4be4adeeca4569,
|
Stream = 0x4E53_1140_5BF2_F9DB,
|
||||||
Index = 0x4e58dd672f23e64e,
|
Syncpoint = 0x4E4B_E4AD_EECA_4569,
|
||||||
Info = 0x4e49ab68b596ba78
|
Index = 0x4E58_DD67_2F23_E64E,
|
||||||
|
Info = 0x4E49_AB68_B596_BA78,
|
||||||
}
|
}
|
||||||
|
|
||||||
private MemoryStream _data;
|
private MemoryStream _data;
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void FinalizeHeaders()
|
private void FinalizeHeaders()
|
||||||
{
|
{
|
||||||
if (_numBytes + 36 >= 0x100000000)
|
if (_numBytes + 36 >= 0x1_0000_0000)
|
||||||
{
|
{
|
||||||
// passed 4G limit, nothing to be done
|
// passed 4G limit, nothing to be done
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -72,17 +72,17 @@ namespace BizHawk.Common.NumberExtensions
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < 0x10000)
|
if (i < 0x1_0000)
|
||||||
{
|
{
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < 0x1000000)
|
if (i < 0x100_0000)
|
||||||
{
|
{
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i < 0x100000000)
|
if (i < 0x1_0000_0000)
|
||||||
{
|
{
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<Import Project="../MainSlnCommon.props" />
|
<Import Project="../MainSlnCommon.props" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<NoWarn>$(NoWarn);BHI1104;CA1806;CA1825;CA2214;MA0060;MA0084;MA0090;MA0140;RS0030;SA1100;SA1120;SA1129;SA1137;SA1205;SA1208;SA1400;SA1514;SA1517</NoWarn>
|
<NoWarn>$(NoWarn);BHI1104;CA1806;CA1825;CA2214;MA0060;MA0084;MA0090;MA0140;MEN018;RS0030;SA1100;SA1120;SA1129;SA1137;SA1205;SA1208;SA1400;SA1514;SA1517</NoWarn>
|
||||||
<Nullable>disable</Nullable>
|
<Nullable>disable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -82,12 +82,10 @@ namespace BizHawk.Emulation.DiscSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
// end of blocks section
|
// end of blocks section
|
||||||
if (N == 0xFFFFFFFF)
|
if (N is 0xFFFF_FFFF) break;
|
||||||
break;
|
|
||||||
|
|
||||||
//the 0x80000000 business is confusing, but this is almost positively an error
|
// the 0x8000_0000 business is confusing, but this is almost positively an error
|
||||||
if (N >= 0x100000000)
|
if (N >= 0x1_0000_0000) MisformedException();
|
||||||
MisformedException();
|
|
||||||
|
|
||||||
var todo = (uint)N + 1;
|
var todo = (uint)N + 1;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" PrivateAssets="all" />
|
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" PrivateAssets="all" />
|
||||||
<Analyzer Include="$(MSBuildProjectDirectory)/../../References/BizHawk.SrcGen.ReflectionCache.dll" />
|
<Analyzer Include="$(MSBuildProjectDirectory)/../../References/BizHawk.SrcGen.ReflectionCache.dll" />
|
||||||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)/BannedSymbols.BannedApiAnalyzers.txt" />
|
<AdditionalFiles Include="$(MSBuildThisFileDirectory)/BannedSymbols.BannedApiAnalyzers.txt" />
|
||||||
|
<AdditionalFiles Include="$(MSBuildThisFileDirectory)/Menees.Analyzers.Settings.xml" />
|
||||||
<Using Include="System" />
|
<Using Include="System" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<Menees.Analyzers.Settings>
|
||||||
|
<DigitSeparators> <!-- for MEN018 -->
|
||||||
|
<Binary GroupSize="4" MinSize="9" />
|
||||||
|
<!--<Decimal GroupSize="3" MinSize="8" />--> <!-- applies to float literals too :( -->
|
||||||
|
<Decimal GroupSize="3" MinSize="100" />
|
||||||
|
<Hexadecimal GroupSize="4" MinSize="9" />
|
||||||
|
</DigitSeparators>
|
||||||
|
</Menees.Analyzers.Settings>
|
Loading…
Reference in New Issue