Skip to content

Latest commit

 

History

History
116 lines (108 loc) · 36.1 KB

File metadata and controls

116 lines (108 loc) · 36.1 KB

Cyclomatic Complexity Exception Register

This document records methods that intentionally exceed the current cyclomatic complexity review threshold.

Policy

  • Review threshold: cyclomatic complexity greater than 10.
  • Risk threshold: a coverage-amplified or unregistered CRAP score greater than 30 requires immediate test hardening or refactoring. A fully covered method's score cannot fall below its cyclomatic complexity, so documented complexity floors are reviewed rather than mechanically refactored.
  • Current status: the latest full-project run, excluding generated serializer sources, covers 8,679/8,679 lines, 2,924/2,924 branches, and 1,469/1,469 ReportGenerator methods. The CRAP analyzer scored 1,465 unique method identities; every method is fully covered and the only scores above 30 are the four registered complexity floors at 52, 48, 44, and 32. Per-method coverage is recorded below and should be refreshed whenever a listed implementation changes.

Complexity exceptions are acceptable when the method is a hot deterministic math path, a direct component-wise value comparison, a fixed-shape assertion helper, or an algorithm where extraction would add indirection without reducing real maintenance risk. These exceptions should be revisited when coverage drops, behavior changes, or the implementation becomes harder to reason about.

Exception Register

Module Method Complexity Coverage Rationale Revisit if
FixedMathSharp Fixed64.GetSignedRatio(Signed320, Signed320) 52 100% line / 100% branch Full-domain Gram ratios require explicit sign, fixed five-word alignment/division, guard/sticky rounding, signed limits, and final saturation. A shared fixed-limb divider preserves every signed boundary with lower complexity and neutral or faster measured cost.
FixedMathSharp Fixed64.GetSignedRatio(Signed192, Signed192) 48 100% line / 100% branch General signed wide ratios require explicit sign, exact unit-interval dispatch, signed-limit, fixed-limb quotient, guard/sticky, and saturation. A shared fixed-limb division primitive preserves the complete signed contract with lower complexity and neutral cost.
FixedMathSharp FixedSegment.SolveClosestParameters(...) 44 100% line / 100% branch Exact determinant classification, coupled finite-segment clamps, and endpoint-candidate state form one allocation-free solver decision path. A lower-complexity state representation preserves exact policy and measures neutral or faster on the closest-pair row.
FixedMathSharp FixedTriangle.ClosestPoint(Vector3d) 32 100% line / 100% branch Exact Gram degeneracy, six stable Voronoi regions, full-domain interpolation, and deterministic collapsed-edge fallback form one solver decision tree. Another exact primitive can share the region state or reduce branches without allocations or ordinary-input regression.
FixedMathSharp.FluentAssertions FixedAssertionHelpers.AreComponentApproximatelyEqual(Fixed4x4, Fixed4x4, Fixed64) 30 100% line / 100% branch Fixed-shape assertion over all matrix components. The explicit checks keep assertion intent clear and avoid allocations in test helpers. Assertion diagnostics degrade, matrix shape changes, or repeated assertion logic grows further.
FixedMathSharp Fixed4x4.Equals(Fixed4x4) 30 100% line / 100% branch Direct 4x4 value comparison avoids loops, allocations, and indexer overhead on a hot value type. Equality semantics change or a generated/source-shared component comparison becomes available without runtime cost.
FixedMathSharp FixedSegment.GetClosestPoints(FixedSegment) 26 100% line / 100% branch Full-domain setup, exact point-degeneracy handling, and bit-exact endpoint preservation remain at the public query boundary. Endpoint identity can move into a simpler shared primitive without extra wide products or an ordinary-input regression.
FixedMathSharp FixedBoundSphere.CreateFromPointSpan(ReadOnlySpan<Vector3d>) 24 100% line / 100% branch Ritter-style bounding sphere construction has fixed selection and expansion branches; keeping it span-based preserves the allocation-free path. More sphere construction modes are added, coverage drops, or the algorithm needs accuracy/performance tuning.
FixedMathSharp FixedBoundSphere.CreateFromPointList(IReadOnlyList<Vector3d>) 24 100% line / 100% branch Ritter-style bounding sphere construction has fixed selection and expansion branches; keeping it local preserves data flow and avoids extra passes. More sphere construction modes are added, coverage drops, or the algorithm needs accuracy/performance tuning.
FixedMathSharp FixedMath.Sin(Fixed64) 24 100% line / 100% branch Trigonometric range reduction and approximation are performance-sensitive and deterministic. Extraction would split a compact numeric routine. Approximation strategy changes or benchmark evidence shows a helper split is neutral or faster.
FixedMathSharp Fixed64.RoundSignedToFixed(Signed192, int) 24 100% line / 100% branch Scaled signed conversion keeps high-word overflow, both signed limits, nearest-even ties, carry, and saturation explicit without allocation. A shared conversion primitive can preserve all 32/33-bit shift boundaries with lower complexity and neutral cost.
FixedMathSharp WideArithmetic.MultiplySigned192(Signed192, Signed192) 24 100% line / 100% branch Five-word signed products require explicit fixed-limb carry and two's-complement propagation without allocation or target-specific semantics. A portable runtime intrinsic replaces the manual multiword product with equal netstandard behavior and lower cost.
FixedMathSharp WideArithmetic.GetMagnitude(Signed320, out ...) 22 100% line / 100% branch Five-word two's-complement magnitude conversion keeps carry propagation explicit and shared by comparisons, thresholds, and ratios. A focused fixed-width value type can centralize magnitude conversion without obscuring word order or adding overhead.
FixedMathSharp Fixed4x4.Decompose(Fixed4x4, out Vector3d, out FixedQuaternion, out Vector3d) 22 100% line / 100% branch Strict affine decomposition keeps magnitude validation, orthogonality, reflection canonicalization, quaternion reconstruction, and exact failure outputs in one atomic public contract. A shared decomposition result can reduce decision state without allocations or weakening rejection semantics.
FixedMathSharp Fixed64.DivideMagnitude(ulong, ulong, bool) 20 100% line / 100% branch The shared saturating division core keeps guarded quotient construction, overflow detection, and final round-half-to-even behavior in one hot path. Division semantics change or benchmarks support a simpler guarded implementation.
FixedMathSharp FixedSegment2d.TryGetUniqueIntersection(FixedSegment2d, out Fixed64, out Fixed64) 20 100% line / 100% branch Exact point, determinant, collinearity, and closed-endpoint classification stay together so the public result has one deterministic decision path. Intersection semantics grow beyond closed segments or another exact predicate can remove branches without allocations.
FixedMathSharp Fixed64.TryGetUnitIntervalRatio(Signed320, Signed320, out Fixed64) 16 100% line / 100% branch Exact five-word sign/range classification and a 33-bit guard/sticky quotient preserve one deterministic conversion for extreme determinants. A simpler fixed-limb division primitive retains identical sign, range, guard, sticky, and nearest-even behavior.
FixedMathSharp WideArithmetic.CompareUnsigned(5-word, 5-word) 20 100% line / 100% branch Lexicographic comparison over five fixed words is direct, allocation-free, and shared by determinant thresholds, clamps, and ratios. A fixed-width value type provides an equally inlinable comparison without hiding word significance.
FixedMathSharp WideGeometry.AccumulateDifferenceProduct(...) 18 100% line / 100% branch Signed 65-by-65-bit products and 192-bit two's-complement accumulation share one allocation-free carry path. A reusable fixed-width integer primitive replaces the local word arithmetic without changing hot-path cost.
FixedMathSharp WideGeometry.AccumulateRawProduct(...) 18 100% line / 100% branch The proven narrow-difference path accumulates signed raw products with explicit two's-complement carry propagation and no intermediate conversion. A shared signed product accumulator expresses the same word behavior more simply and measures neutral or faster.
FixedMathSharp FixedBoundBox.HasStrictAxisOverlap(Vector3d, Vector3d) 18 100% line / 100% branch Six direct closed-bound comparisons express strict overlap on three fixed axes without temporary ranges or iteration overhead. More dimensional bound types share the exact policy through an equally inlinable helper.
FixedMathSharp FixedBoundSphere.CreateFromFrustumCorners(FixedBoundFrustum) 22 100% line / 100% branch Frustum-corner sphere construction mirrors the point-list algorithm while avoiding a temporary public collection. Frustum corner ordering changes or the sphere construction algorithm is replaced.
FixedMathSharp FixedQuaternion.TryFormat(...) 18 100% line / 100% branch Span formatting has fixed delimiter and component-write branches that avoid intermediate strings. Formatting shape changes or a shared zero-allocation formatter becomes available.
FixedMathSharp Fixed4x4.TryFormat(...) 18 100% line / 100% branch Matrix span formatting writes a fixed 4x4 shape without temporary strings. Formatting shape changes or a shared zero-allocation formatter becomes available.
FixedMathSharp Vector4d.TryFormat(...) 18 100% line / 100% branch Vector span formatting writes a fixed component shape without temporary strings. Formatting shape changes or a shared zero-allocation formatter becomes available.
FixedMathSharp FixedMath.Sqrt(Fixed64) 18 100% line / 100% branch Integer square-root logic is branchy by nature and sits on a core deterministic math path. A simpler algorithm is adopted with equal determinism and performance.
FixedMathSharp Fixed3x3Extensions.FuzzyEqual(Fixed3x3, Fixed3x3, Fixed64?) 18 100% line / 100% branch Component-wise fuzzy equality is intentionally explicit to avoid allocation and preserve inlining. The matrix equality helpers are generated or centralized without adding runtime overhead.
FixedMathSharp FixedBoundSphere.ContainsBoxLike(Vector3d, Vector3d) 18 100% line / 100% branch Checks all box-like corners against the sphere; explicit shape avoids temporary corner arrays. Bounds internals move to a shared corner iterator that is allocation-free.
FixedMathSharp FixedMath.Atan(Fixed64) 18 100% line / 100% branch Trigonometric approximation and range handling are deterministic hot-path math. Approximation strategy changes or benchmark evidence supports decomposition.
FixedMathSharp Fixed4x4.get_Item(int) 17 100% line / 100% branch Switch-based fixed matrix indexing is direct and avoids table allocation or reflection. The matrix layout changes or generated indexer code becomes part of the build.
FixedMathSharp Fixed4x4.set_Item(int, Fixed64) 17 100% line / 100% branch Switch-based fixed matrix indexing is direct and avoids table allocation or reflection. The matrix layout changes or generated indexer code becomes part of the build.
FixedMathSharp.FluentAssertions FixedAssertionHelpers.AreComponentApproximatelyEqual(Fixed3x3, Fixed3x3, Fixed64) 16 100% line / 100% branch Fixed-shape assertion over all matrix components keeps helper behavior direct and allocation-free. Assertion diagnostics degrade, matrix shape changes, or repeated assertion logic grows further.
FixedMathSharp Fixed3x3Extensions.FuzzyEqualAbsolute(Fixed3x3, Fixed3x3, Fixed64) 16 100% line / 100% branch Direct component-wise comparison avoids loops and keeps the extension inlinable. The matrix equality helpers are generated or centralized without adding runtime overhead.
FixedMathSharp Fixed3x3.Equals(Fixed3x3) 16 100% line / 100% branch Direct 3x3 value comparison avoids loops, allocations, and indexer overhead on a hot value type. Equality semantics change or a generated/source-shared component comparison becomes available without runtime cost.
FixedMathSharp FixedMath.Asin(Fixed64) 16 100% line / 100% branch Trigonometric domain handling and approximation are deterministic hot-path math. Approximation strategy changes or benchmark evidence supports decomposition.
FixedMathSharp Fixed64.LerpFullDomain(Fixed64, Fixed64, Fixed64) 16 100% line / 100% branch Full-domain interpolation must preserve a 65-bit difference and final-result nearest-even parity without a saturating intermediate. A simpler full-width primitive provides identical endpoint, sign, and tie behavior at equal or lower measured cost.
FixedMathSharp Fixed64.RoundSquareRootToFixed(...) 16 100% line / 100% branch Exact triangle area conversion keeps root remainder, half-even midpoint, final carry, and positive saturation at one Q32.32 boundary. Another exact square-root result type can centralize the conversion without obscuring remainder-based rounding.
FixedMathSharp Fixed4x4.IsNormalizedOrthogonalBasis(Vector3d, Vector3d, Vector3d) 16 100% line / 100% branch Fixed-shape basis validation keeps three representable magnitudes, unit tolerances, and pairwise orthogonality checks together at the decomposition gate. Another decomposition path can reuse the exact predicate without duplicating its fixed sequence.
FixedMathSharp WideArithmetic.GetFloorSquareRoot(Signed320, out Signed192) 15 100% line / 100% branch Fixed five-word restoring square root preserves exact root/remainder and dispatches to a smaller ordinary-range path without allocation. A faster portable integer-root algorithm preserves exact remainder and both fixed-width paths across targets.
FixedMathSharp Fixed64.TryGetUnitIntervalRatio(Signed192, Signed192, out Fixed64) 12 100% line / 100% branch Exact sign/range classification dispatches to the minimum fixed-width 33-bit guard/sticky quotient while preserving explicit default failure. A shared fixed-width division core can express both representation widths more simply and without regression.
FixedMathSharp FixedPlane.IntersectsBoxLike(Vector3d, Vector3d) 16 100% line / 100% branch Plane-vs-bounds classification is branch-heavy but fixed-shape and allocation-free. Additional bound shapes are added and a shared allocation-free helper becomes clearer.
FixedMathSharp FixedBoundFrustum.Contains(FixedBoundBox) 14 100% line / 100% branch Frustum containment combines plane checks and box corners without allocating an intermediate shape. Containment semantics change or a shared allocation-free corner helper is introduced.
FixedMathSharp FixedBoundFrustum.Contains(FixedBoundSphere) 14 100% line / 100% branch Frustum containment must distinguish disjoint, intersecting, and fully contained sphere cases. Sphere/frustum containment semantics change or the plane classification helper is redesigned.
FixedMathSharp FixedBoundFrustum.IntersectsFrustum(FixedBoundFrustum) 14 100% line / 100% branch Separating-axis frustum checks are algorithmically branch-heavy and intentionally avoid allocations. A robust shared SAT helper can improve clarity without extra allocations or worse benchmarks.
FixedMathSharp FixedBoundBox.ClosestPointOnSurface(Vector3d) 14 100% line / 100% branch The nearest-face selection is fixed-shape and explicit; helper extraction would not reduce real complexity. Box surface projection grows beyond nearest-face selection.
FixedMathSharp FixedCurve.Evaluate(Fixed64) 14 100% line / 100% branch Curve evaluation combines clamping, segment search, and interpolation mode dispatch in one readable flow. More interpolation modes are added or segment lookup becomes a performance bottleneck.
FixedMathSharp Fixed3x3.TryFormat(...) 14 100% line / 100% branch Matrix span formatting writes a fixed 3x3 shape without temporary strings. Formatting shape changes or a shared zero-allocation formatter becomes available.
FixedMathSharp FixedMath.Pow2(Fixed64) 14 100% line / 100% branch Fixed-point exponent approximation is compact, deterministic, and performance-sensitive. Approximation strategy changes or benchmark evidence supports decomposition.
FixedMathSharp FixedMath.Tan(Fixed64) 14 100% line / 100% branch Tangent delegates through fixed trigonometric identities and guarded edge handling. New domain behavior is added or uncovered lines become reachable with valid input.
FixedMathSharp Vector3d.TryFormat(...) 14 100% line / 100% branch Vector span formatting writes a fixed component shape without temporary strings. Formatting shape changes or a shared zero-allocation formatter becomes available.
FixedMathSharp Fixed64.RoundSquaredDistance(Signed192) 14 100% line / 100% branch Exact Q64.64 squared sums need explicit nearest-even tie handling and positive saturation at the single public conversion boundary. A shared exact-distance conversion expresses the same degeneracy, rounding, and saturation contract more simply.
FixedMathSharp WideArithmetic.GetFloorSquareRoot192(...) 14 100% line / 100% branch The common three-word root path uses two-word root/remainder state to avoid full five-word work while returning the identical exact result. A faster portable root primitive preserves every perfect-square, remainder, and word-boundary result.
FixedMathSharp WideArithmetic.CompareNormalizedComponentToMidpoint(...) 14 100% line / 100% branch Exact normal rounding compares squared values at the half-even midpoint with fixed five-/six-word multiplication and stable limb order. A simpler fixed-limb product comparison preserves exact midpoint parity and improves the normal benchmark.
FixedMathSharp Fixed64.NormalizeWideComponent(...) 14 100% line / 100% branch Exact component normalization combines common scaling, lower-candidate division, and squared midpoint correction into one allocation-free path. A shared three-component normalization root removes repeated work while preserving independent nearest-even results.
FixedMathSharp WideArithmetic.AddSigned320(Signed320, Signed320) 14 100% line / 100% branch Five-word signed addition keeps carry propagation explicit, allocation-free, and independent of target-specific wide integer support. A portable fixed-width value type provides equally visible carry order and neutral or faster measured cost.
FixedMathSharp Fixed64.GetFloorSquareRoot(ulong, ulong, out ulong, out ulong) 14 100% line / 100% branch The private two-word restoring square root keeps pair selection, remainder comparison, subtraction, and exact remainder output in one hot loop. A portable intrinsic or simpler root primitive preserves every 128-bit root and remainder boundary.
FixedMathSharp Fixed64.op_Multiply(Fixed64, Fixed64) 12 100% line / 100% branch Full-width multiply with saturating and round-half-to-even behavior requires explicit guarded paths. Additional uncovered reachable branches appear, arithmetic semantics change, or benchmarks support a simpler equivalent.
FixedMathSharp FixedSegment.PointOnSegment(...) 12 100% line / 100% branch Exact axis bounds plus a Gram determinant preserve an existing endpoint only for a true finite-segment zero-separation contact. A cheaper exact collinearity predicate preserves endpoint identity across the complete raw domain.
FixedMathSharp Fixed64.GetUnitIntervalRatio128(...) 12 100% line / 100% branch The hot two-word representation uses a compact 33-bit guard/sticky long-division loop with exact overflow-bit handling. A portable intrinsic or proven quotient primitive improves this shared path without changing nearest-even results.
FixedMathSharp Fixed3x3.get_Item(int) 12 100% line / 100% branch Switch-based fixed matrix indexing is direct and avoids table allocation or reflection. The matrix layout changes or generated indexer code becomes part of the build.
FixedMathSharp Fixed3x3.set_Item(int, Fixed64) 12 100% line / 100% branch Switch-based fixed matrix indexing is direct and avoids table allocation or reflection. The matrix layout changes or generated indexer code becomes part of the build.
FixedMathSharp FixedBoundFrustum.Contains(Vector3d) 12 100% line / 100% branch Point containment checks all frustum planes directly and avoids temporary arrays. Plane ordering or containment semantics change.
FixedMathSharp FixedBoundFrustum.Intersects(FixedRay) 12 100% line / 100% branch Slab-style frustum clipping has unavoidable enter/exit branches and benefits from locality. More ray/frustum edge cases are discovered or clipping logic is shared elsewhere.
FixedMathSharp FixedMath.FloorLog2(ulong) 12 100% line / 100% branch Bit-scan fallback is branch-heavy by nature and must remain deterministic across targets. A target-safe intrinsic or simpler implementation is introduced.
FixedMathSharp WideArithmetic.CompareUnsigned(3-word, 3-word) 12 100% line / 100% branch Lexicographic comparison over three fixed words is explicit, allocation-free, and shared by exact geometry ratio and distance ordering. A fixed-width value type centralizes comparison with equal inlining and benchmark behavior.
FixedMathSharp WideGeometry.GetDifferenceCrossProduct3D(...) 12 100% line / 100% branch The exact cross root selects a proven signed-raw fast path only when all six differences fit, otherwise retaining full 65-bit endpoint arithmetic. Difference ownership can be shared without adding state or slowing ordinary and extreme triangle rows.
FixedMathSharp WideGeometry.GetDifferenceDotProduct3D(...) 12 100% line / 100% branch The exact dot root selects a signed-raw fast path only when all six differences fit and falls back to full endpoint-difference accumulation. Cached difference state simplifies repeated triangle dots without allocations or a benchmark regression.
FixedMathSharp FixedTriangle2d.Contains(Vector2d) 12 100% line / 100% branch Exact winding, three epsilon-inclusive edge classifications, and collapsed-edge fallback stay together at the public containment boundary. Containment policy expands or a shared exact-orientation classifier removes branches without changing hot-path cost.
FixedMathSharp Fixed4x4.AppendRow(...) 12 100% line / 100% branch Private span-format helper appends a fixed row shape with delimiter handling and no temporary strings. Formatting shape changes or a shared zero-allocation formatter becomes available.
FixedMathSharp Fixed64.CompareMagnitudeSquared(...) 12 100% line / 100% branch Exact squared-magnitude ordering compares overflow, high, and low words directly without projecting either sum back into Q32.32. A reusable fixed-width magnitude value provides the same lexicographic order without extra construction or cost.
FixedMathSharp CoordinateConvention3d.ctor(Axis3d, Axis3d, Axis3d) 12 100% line / 100% branch The public constructor validates three defined signed axes and rejects every duplicate absolute-axis pairing before storing an immutable basis. Axis validation moves to a shared zero-overhead basis type with equally specific argument errors.
FixedMathSharp FixedTransform.TrySetParentKeepingWorld(FixedTransform?) 12 100% line / 100% branch Atomic reparenting validates ancestry, inverse, decomposition, and world recomposition before committing any local or parent state. A shared atomic transform mutation result reduces branches without exposing partial state or weakening verification.

Review Notes

  • Methods at 100% line and branch coverage with direct component-wise logic should usually remain explicit unless a zero-overhead generated approach is introduced.
  • For fixed-point arithmetic and trigonometric routines, prefer benchmark-backed refactors over structural changes made only to reduce the reported complexity number.
  • If a method remains above the complexity threshold and below full branch coverage, prefer adding focused tests for reachable branches before refactoring.
  • Re-run coverage and CRAP analysis after any changes that touch the methods listed above, then update this register.