From bf09f1e310ed4787b8cd1b39425e16e880352ed5 Mon Sep 17 00:00:00 2001 From: Travis Mcgeehan Date: Mon, 28 Aug 2023 00:37:33 -0400 Subject: [PATCH] Ignore IDE0039 affecting rcheevos.cs, hide BHI1005, and add docs --- .editorconfig | 3 +++ Common.ruleset | 2 +- contributing.md | 2 ++ src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index 3b3e030434a..3b615c80643 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,9 @@ csharp_indent_switch_labels = true csharp_indent_case_contents = true csharp_indent_labels = one_less_than_current +# Style rules +dotnet_diagnostic.IDE0039.severity = none + # Globalization rules dotnet_code_quality.CA1305.excluded_symbol_names = T:System.Byte|T:System.SByte|T:System.Int16|T:System.UInt16|T:System.Int32|T:System.UInt32|T:System.Int64|T:System.UInt64|T:System.String|T:System.Text.StringBuilder|T:System.Convert diff --git a/Common.ruleset b/Common.ruleset index c0d05e8bfa2..b7517afcf77 100644 --- a/Common.ruleset +++ b/Common.ruleset @@ -14,7 +14,7 @@ - + diff --git a/contributing.md b/contributing.md index ff94122ffea..72b1533b2c1 100644 --- a/contributing.md +++ b/contributing.md @@ -76,7 +76,9 @@ It's probably a good idea to get the .NET SDK, even if you're not working on a . For EmuHawk and libraries in the main solution, which do not target .NET 6, we have [this page](https://github.com/TASEmulators/BizHawk/wiki/Available-C%23-and-.NET-features) documenting which features are actually available to use. +### Code Analysis +Visual Studio can detect and show issues and possible optimizations in the IDE before build time. In the Analyze menu pick Run Code Analysis -> On Solution. From there you can open the Error list in the bottom left and highlight issues of different severity level Errors/Warnings/Messages and adjust the scope as small as the open documents and as wide as the entire solution. Developers should target to have no code introduced flagging the Error and Warning levels. It's also good to minimize warnings at the Message severity level either by adopting the suggested fixes or by ignoring irrelevant Messages with `#pragma` directives. Many warnings can be auto-fixed by the `dotnet format` command or by the quick actions menu found on the left next to a line number when hovering a line. ## blip_buf > Audio resampling library. diff --git a/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs b/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs index 0ba5efcd1b3..0d4c38b43ea 100644 --- a/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs +++ b/src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs @@ -414,7 +414,8 @@ public override void Restart() // validate addresses now that we have cheevos init // ReSharper disable once ConvertToLocalFunction - bool peekcb(int address) => _readMap.ContainsKey(address); + LibRCheevos.rc_runtime_validate_address_t peekcb = address => _readMap.ContainsKey(address); + _lib.rc_runtime_validate_addresses(_runtime, _eventcb, peekcb); _gameInfoForm.Restart(_gameData.Title, _gameData.TotalCheevoPoints(HardcoreMode), CurrentRichPresence ?? "N/A");