fix: suppress MA0077 on ref struct types and fix variable shadowing

ref struct types (BatchOutputs, BatchInputs, ScalarState, WorkBuffers)
cannot implement IEquatable<T> — C# prohibits interface implementation
on ref structs. Added #pragma warning disable/restore MA0077 at type
declaration level in AccBands.cs, Aberr.cs, Apz.cs (9 ref structs).

Renamed local 'output' to 'result' in Wma.Coverage.Tests.cs to avoid
shadowing the primary constructor ITestOutputHelper parameter (S1117/MA0084).
This commit is contained in:
Miha Kralj
2026-03-03 12:42:42 -08:00
parent 3e858ca39e
commit 7737098a54
4 changed files with 24 additions and 6 deletions
+6
View File
@@ -412,6 +412,7 @@ public sealed class Aberr : ITValuePublisher, IDisposable
/// <summary>
/// Output buffers for batch Aberr calculation.
/// </summary>
#pragma warning disable MA0077 // ref struct cannot implement interfaces
[StructLayout(LayoutKind.Auto)]
#pragma warning disable S1104 // Fields should not have public accessibility
public readonly ref struct BatchOutputs
@@ -447,10 +448,12 @@ public sealed class Aberr : ITValuePublisher, IDisposable
public static bool operator ==(BatchOutputs left, BatchOutputs right) => left.Equals(right);
public static bool operator !=(BatchOutputs left, BatchOutputs right) => !left.Equals(right);
}
#pragma warning restore MA0077
/// <summary>
/// Internal state for scalar calculation.
/// </summary>
#pragma warning disable MA0077 // ref struct cannot implement interfaces
[StructLayout(LayoutKind.Auto)]
[SuppressMessage("NDepend", "ND1903:StructuresShouldBeImmutable", Justification = "Mutable calculation state accumulator by design")]
private ref struct ScalarState
@@ -471,10 +474,12 @@ public sealed class Aberr : ITValuePublisher, IDisposable
public static bool operator ==(ScalarState left, ScalarState right) => left.Equals(right);
public static bool operator !=(ScalarState left, ScalarState right) => !left.Equals(right);
}
#pragma warning restore MA0077
/// <summary>
/// Working buffers for batch calculation.
/// </summary>
#pragma warning disable MA0077 // ref struct cannot implement interfaces
[StructLayout(LayoutKind.Auto)]
private readonly ref struct WorkBuffers(Span<double> source, Span<double> deviation)
{
@@ -492,6 +497,7 @@ public sealed class Aberr : ITValuePublisher, IDisposable
public static bool operator ==(WorkBuffers left, WorkBuffers right) => left.Equals(right);
public static bool operator !=(WorkBuffers left, WorkBuffers right) => !left.Equals(right);
}
#pragma warning restore MA0077
/// <summary>
/// Calculates Aberr for the entire TSeries using a new instance.