mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 17:48:05 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user