Enable MA0091 and fix noncompliance

"Sender should be 'this' for instance events"
This commit is contained in:
YoshiRulz 2024-07-03 23:10:57 +10:00
parent 67edf3f047
commit c4498685c2
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
4 changed files with 11 additions and 3 deletions

View File

@ -281,7 +281,7 @@ dotnet_diagnostic.MA0089.severity = error
# Remove empty else/finally block
dotnet_diagnostic.MA0090.severity = silent
# Sender should be 'this' for instance events
dotnet_diagnostic.MA0091.severity = silent
dotnet_diagnostic.MA0091.severity = error
# Sender should be 'null' for static events
dotnet_diagnostic.MA0092.severity = error
# EventArgs should not be null

View File

@ -55,6 +55,7 @@ namespace BizHawk.Client.Common
public int BufferWidth() => VideoProvider.BufferWidth;
#pragma warning disable MA0091 // passing through `sender` is intentional
private void CallBeforeQuickLoad(object sender, BeforeQuickLoadEventArgs args)
=> BeforeQuickLoad?.Invoke(sender, args);
@ -69,6 +70,7 @@ namespace BizHawk.Client.Common
private void CallStateSaved(object sender, StateSavedEventArgs args)
=> StateSaved?.Invoke(sender, args);
#pragma warning restore MA0091
public void ClearAutohold() => _mainForm.ClearHolds();

View File

@ -1335,10 +1335,12 @@ namespace BizHawk.Client.EmuHawk
}
}
#pragma warning disable MA0091 // passing through `sender` is intentional
private void DoRightMouseScroll(object sender, MouseEventArgs e)
{
RightMouseScrolled?.Invoke(sender, e);
}
#pragma warning restore MA0091
private void ColumnClickEvent(RollColumn/*?*/ column)
{
@ -1620,6 +1622,7 @@ namespace BizHawk.Client.EmuHawk
Refresh();
}
#pragma warning disable MA0091 // unorthodox, but I think this is sound --yoshi
if (_horizontalOrientation)
{
ColumnScroll?.Invoke(_hBar, e);
@ -1628,6 +1631,7 @@ namespace BizHawk.Client.EmuHawk
{
RowScroll?.Invoke(_vBar, e);
}
#pragma warning restore MA0091
}
private void HorizontalBar_ValueChanged(object sender, EventArgs e)
@ -1637,6 +1641,7 @@ namespace BizHawk.Client.EmuHawk
Refresh();
}
#pragma warning disable MA0091 // unorthodox, but I think this is sound --yoshi
if (_horizontalOrientation)
{
RowScroll?.Invoke(_hBar, e);
@ -1645,6 +1650,7 @@ namespace BizHawk.Client.EmuHawk
{
ColumnScroll?.Invoke(_vBar, e);
}
#pragma warning restore MA0091
}
private void ColumnChangedCallback()

View File

@ -4045,7 +4045,7 @@ namespace BizHawk.Client.EmuHawk
ExtToolManager.BuildToolStrip();
RomLoaded?.Invoke(null, EventArgs.Empty);
RomLoaded?.Invoke(this, EventArgs.Empty);
return true;
}
else if (Emulator.IsNull())
@ -4059,7 +4059,7 @@ namespace BizHawk.Client.EmuHawk
else
{
// The ROM has been loaded by a recursive invocation of the LoadROM method.
RomLoaded?.Invoke(null, EventArgs.Empty);
RomLoaded?.Invoke(this, EventArgs.Empty);
return true;
}
}