Skip to content

Commit

Permalink
Ignore IDE0039 affecting rcheevos.cs, hide BHI1005, and add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TiKevin83 committed Aug 28, 2023
1 parent 0808bed commit bf09f1e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Common.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Rule Id="BHI1004" Action="Error" />

<!-- Default branch of switch expression should throw InvalidOperationException/SwitchExpressionException or not throw -->
<Rule Id="BHI1005" Action="Error" />
<Rule Id="BHI1005" Action="Hidden" />

<!-- Do not discard local variables -->
<Rule Id="BHI1006" Action="Error" />
Expand Down
2 changes: 2 additions & 0 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/BizHawk.Client.EmuHawk/RetroAchievements/RCheevos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit bf09f1e

Please sign in to comment.