From db2782ca1bb371b503606c9036fd7a7d14eeafe8 Mon Sep 17 00:00:00 2001
From: YoshiRulz <OSSYoshiRulz+git@gmail.com>
Date: Wed, 3 Jul 2024 21:01:05 +1000
Subject: [PATCH] Enable MA0140 and fix noncompliance (except in Cores)

"Both if and else branch have identical code"
see 618951403
---
 .global.editorconfig.ini                                   | 2 +-
 src/BizHawk.Client.EmuHawk/MainForm.FileLoader.cs          | 7 ++-----
 src/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj | 2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/.global.editorconfig.ini b/.global.editorconfig.ini
index d82a1320cf..9194bc65b0 100644
--- a/.global.editorconfig.ini
+++ b/.global.editorconfig.ini
@@ -321,7 +321,7 @@ dotnet_diagnostic.MA0109.severity = silent
 # Use the Regex source generator
 dotnet_diagnostic.MA0110.severity = error
 # Both if and else branch have identical code
-dotnet_diagnostic.MA0140.severity = silent
+dotnet_diagnostic.MA0140.severity = warning
 
 ## Menees.Analyzers rules
 
diff --git a/src/BizHawk.Client.EmuHawk/MainForm.FileLoader.cs b/src/BizHawk.Client.EmuHawk/MainForm.FileLoader.cs
index 382c7cbeb8..ba4e5625d7 100644
--- a/src/BizHawk.Client.EmuHawk/MainForm.FileLoader.cs
+++ b/src/BizHawk.Client.EmuHawk/MainForm.FileLoader.cs
@@ -169,15 +169,12 @@ namespace BizHawk.Client.EmuHawk
 							 */
 							var dearchivalMethod = SharpCompressDearchivalMethod.Instance;
 
+#if false // making this run always to restore the default behavior where unrecognized files are treated like roms --adelikat
 							if (string.IsNullOrEmpty(archive) && dearchivalMethod.CheckSignature(file, out _, out _))
+#endif
 							{
 								sortedFiles[LoadOrdering.Rom].Add(fileInformation);
 							}
-							else
-							{
-								// This is hack is to ensure that unrecognized files are treated like ROMs
-								sortedFiles[LoadOrdering.Rom].Add(fileInformation);
-							}
 
 #if false
 							/*
diff --git a/src/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/src/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
index 3657b7a326..95056f75d1 100644
--- a/src/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
+++ b/src/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
@@ -5,7 +5,7 @@
 	<Import Project="../MainSlnCommon.props" />
 	<PropertyGroup>
 		<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-		<NoWarn>$(NoWarn);CA1806;CA1825;CA2214;MA0084;SA1100;SA1120;SA1129;SA1137;SA1205;SA1208;SA1400</NoWarn>
+		<NoWarn>$(NoWarn);CA1806;CA1825;CA2214;MA0084;MA0140;SA1100;SA1120;SA1129;SA1137;SA1205;SA1208;SA1400</NoWarn>
 		<Nullable>disable</Nullable>
 	</PropertyGroup>
 	<ItemGroup>