Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ForceDirectedLayout/NativeExports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace ktsu.ForceDirectedLayout;

using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -43,6 +44,14 @@ public static class LayoutResult
///
/// All buffer parameters are caller-owned. The library writes into the buffer but never retains a pointer past the call return.
/// </remarks>
// Excluded from code coverage: these [UnmanagedCallersOnly] entry points are reachable only
// through native function pointers, never from managed code, so managed tests cannot exercise
// them. Excluding the type also keeps the coverage instrumenter away from UnmanagedCallersOnly
// method bodies - instrumenting them crashes the dynamic code-coverage collector on .NET 10 CI
// runners (the interprocess collector dies with "Pipe was disconnected" during report generation),
// which is what failed the ForceDirectedLayout.Tests run.
[ExcludeFromCodeCoverage(Justification = "C ABI boundary shim invoked only via native function pointers; uncoverable by managed tests and crashes the .NET 10 dynamic coverage collector when instrumented.")]
[SuppressMessage("Major Code Smell", "S6640:Make sure that using \"unsafe\" is safe here.", Justification = "The C ABI surface marshals raw caller-owned pointers across the native boundary; every pointer argument is null- and range-checked before use and never retained past the call.")]
public static unsafe class NativeExports
{
[ThreadStatic]
Expand Down
3 changes: 3 additions & 0 deletions ForceDirectedLayout/Vec2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace ktsu.ForceDirectedLayout;

using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -73,12 +74,14 @@ public static Vec2D Zero
public static Vec2D operator -(Vec2D v) => new(-v.X, -v.Y);

/// <inheritdoc/>
[SuppressMessage("Major Code Smell", "S1244:Floating point numbers should not be tested for equality", Justification = "Value-equality for a blittable vector requires exact component comparison; a tolerance would break the Equals/GetHashCode contract. Use a range check at call sites that need approximate equality.")]
public static bool operator ==(Vec2D a, Vec2D b) => a.X == b.X && a.Y == b.Y;

/// <inheritdoc/>
public static bool operator !=(Vec2D a, Vec2D b) => !(a == b);

/// <inheritdoc/>
[SuppressMessage("Major Code Smell", "S1244:Floating point numbers should not be tested for equality", Justification = "Value-equality for a blittable vector requires exact component comparison; a tolerance would break the Equals/GetHashCode contract. Use a range check at call sites that need approximate equality.")]
public readonly bool Equals(Vec2D other) => X == other.X && Y == other.Y;

/// <inheritdoc/>
Expand Down
Loading