Public report of mermaid-js/mermaid, published 14 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 14 November 2026, 09:35 UTC · Survey ID cd_f110cab9334a459b9e75e00f250e6f61

mermaid-js/mermaid

Measured 14 November 2026, 09:33 UTC, at code version 2b1e7f6

CAI score 49out of 100 At risk Down 2 since the last survey

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A large codebase: 123,570 lines of product code in 7 projects, tests not counted · Estimated rebuild effort: about 1.4 person-years · Weakest lens: Accessibility, 43

Findings by how serious they are

82 critical 1175 serious 272 minor

4 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
14 November 2026, 09:33 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that implements it, and today the Canine Code Analyzer is the only one that does.

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

75of 75 dimensions measured by tools.
1487of 1529 findings point to an exact file and line, so you can open each one in the code. The other 42 concern the repository as a whole, such as missing documentation.
75dimensions across 7 lenses, read from 123,570 lines of product code in 7 projects.
Chapters

Executive summary

mermaid-js/mermaid is rated At risk because critical security findings are open, most of them in the packages it uses. Its score is held back because it has form fields without a label. It scores 49 out of 100, which the At risk rating leaves unchanged.

Accessibility, at 43, is the weakest lens and counts most in the score. The best first steps are labelling the form fields and buttons and fixing focus, motion and contrast, each worth about 4 points. Raising Accessibility to 70 would lift the score to about 54.

Fifty-seven known security holes in the packages the code depends on can be used by attackers. Four pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with, and four form fields can't be read by a screen reader. Labelling the form fields, updating the vulnerable packages and pinning each tool to an exact version would close these risks. Setting a waiting period for automatic updates would fix the three automatic dependency updates that take new releases at once, and the three passwords or keys in the code's history need replacing, with the old ones switched off. The three parts of the code nobody has worked on for a long time need someone to learn and document them before anyone changes them.

The product code is 123,570 lines, about €200,000 to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Accessibility 43 · counts for 46%Code Health 44 · counts for 25%Production Readiness 59 · counts for 14%Performance 60 · counts for 8%Security and Compliance 66 · counts for 4%Maturity 75 · counts for 2%Architecture 91 · counts for 1%

If Accessibility rose from 43 to 70, the lowest score rated Strong, the score would rise from 49 to about 54.

Code composition: what the lines of code are
Product code 58%Tests 42%
New since the last survey: 248 findings

These 248 critical or serious findings weren't in the previous survey, on 26 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · layered.layered (cyclomatic 215) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · compound.routeCrossings (cyclomatic 95) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts
  • Cyclomatic Complexity · compound.compoundLayout (cyclomatic 87) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts
  • Cyclomatic Complexity · layered.position (cyclomatic 83) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · edgeLabels.positionGridEdgeLabels (cyclomatic 72) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cyclomatic Complexity · routerPlanning.assignDemandCoordinates (cyclomatic 68) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cyclomatic Complexity · routePath.routePath (cyclomatic 56) packages/mermaid/src/rendering-util/rendering-elements/routePath.ts
  • Cyclomatic Complexity · routerSparse.sparseContainerSegment (cyclomatic 51) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts
  • Cyclomatic Complexity · layered.settle (cyclomatic 50) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · layered.reduceCrossings (cyclomatic 49) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · GridEdgeRoutingSession.routePlan (cyclomatic 43) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts
  • Cyclomatic Complexity · index.run (cyclomatic 41) packages/mermaid/src/rendering-util/layout-algorithms/layered/index.ts
  • Cyclomatic Complexity · layered.rank (cyclomatic 39) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · routerTopology.buildEndpointRoutingOverlay (cyclomatic 39) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts
  • Cyclomatic Complexity · routerCompatibility.prepareRoutingModes (cyclomatic 38) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts
  • Cyclomatic Complexity · compound.compoundLayout::place (cyclomatic 35) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts
  • Cyclomatic Complexity · routerPlanning.endpointCandidates (cyclomatic 34) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cyclomatic Complexity · layered.snap (cyclomatic 33) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · layered.assignTracks (cyclomatic 33) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · routerSparse.sparseSameContainerRoute::searchPairs (cyclomatic 33) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts
  • Cyclomatic Complexity · routerSearch.search (cyclomatic 32) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts
  • Cyclomatic Complexity · routerSparse.sparseSelfLoopRoute (cyclomatic 32) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts
  • Cyclomatic Complexity · layered.assignTracks::lay (cyclomatic 30) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · layered.alignLabels (cyclomatic 26) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · orthogonalEdgeClipping.outlineEndpoint (cyclomatic 26) packages/mermaid/src/rendering-util/rendering-elements/orthogonalEdgeClipping.js
  • Cyclomatic Complexity · routerConstraint.canonicalizeOrthogonalPolyline (cyclomatic 26) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerConstraint.ts
  • Cyclomatic Complexity · layered.reduceCrossings::count (cyclomatic 25) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · layered.pastLabels (cyclomatic 24) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · edgeLabels.blockedCenterIntervals (cyclomatic 24) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cyclomatic Complexity · routerSearch.search::relaxArc (cyclomatic 24) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts
  • Cyclomatic Complexity · routerTopology.buildVisibilityGraph (cyclomatic 24) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts
  • Cyclomatic Complexity · routerPlanning.resolveAmbiguousEndpointSides (cyclomatic 23) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cyclomatic Complexity · layered.reduceCrossings::sweep (cyclomatic 22) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · routerPlanning.buildEndpointPlan (cyclomatic 22) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cyclomatic Complexity · layoutData.toLayoutGraph (cyclomatic 21) packages/mermaid/src/rendering-util/layout-algorithms/layered/layoutData.ts
  • Cyclomatic Complexity · sanitizeDirective.sanitizeDirectiveValue (cyclomatic 20) packages/mermaid/src/utils/sanitizeDirective.ts
  • Cyclomatic Complexity · anchoredNodes.pinAnchoredNodes (cyclomatic 20) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts
  • Cyclomatic Complexity · gridPlacement.validateGridPlacementCoordinates (cyclomatic 19) packages/mermaid/src/utils/gridPlacement.ts
  • Cyclomatic Complexity · layered.straighten (cyclomatic 19) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · edgeLabels.rerouteSegmentAroundRect (cyclomatic 19) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cyclomatic Complexity · routerSparse.sparseSameContainerRoute (cyclomatic 19) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts
  • Cyclomatic Complexity · gridPlacement.sanitizeGridPlacements (cyclomatic 18) packages/mermaid/src/utils/gridPlacement.ts
  • Cyclomatic Complexity · anchoredNodes.clearAnchoredOverlaps (cyclomatic 18) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts
  • Cyclomatic Complexity · edgeLabels.labelPlacementWithExtendedDetour (cyclomatic 18) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cyclomatic Complexity · routerCompatibility.labelAwareSelfLoopCandidates (cyclomatic 18) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts
  • Cyclomatic Complexity · swimlane (cyclomatic 18) packages/mermaid/src/rendering-util/rendering-elements/clusters/swimlane.js
  • Cyclomatic Complexity · layered.sortByBary (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · edgeLabels.labelPlacementWithDetour (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cyclomatic Complexity · routerTopology.buildPairedPortal (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts
  • Cyclomatic Complexity · parseToLayoutData.stampRendererFields (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/ddlt/parseToLayoutData.ts
  • Cyclomatic Complexity · layered.sideEnds (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cyclomatic Complexity · labelSpacing.deriveGridContainerLabelGaps (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/labelSpacing.ts
  • Cyclomatic Complexity · routerPlanning.allocateEndpointSlots (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cyclomatic Complexity · routerCompatibility.routeWithinContainer (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts
  • Cognitive Complexity · layered.layered (cognitive 334) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · layered.position (cognitive 197) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · compound.compoundLayout (cognitive 177) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts
  • Cognitive Complexity · edgeLabels.positionGridEdgeLabels (cognitive 174) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cognitive Complexity · compound.routeCrossings (cognitive 154) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts
  • Cognitive Complexity · layered.settle (cognitive 125) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · routerPlanning.assignDemandCoordinates (cognitive 104) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cognitive Complexity · routerSearch.search (cognitive 93) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts
  • Cognitive Complexity · routerSparse.sparseContainerSegment (cognitive 93) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts
  • Cognitive Complexity · layered.reduceCrossings (cognitive 73) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · layered.assignTracks::lay (cognitive 67) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · routePath.routePath (cognitive 66) packages/mermaid/src/rendering-util/rendering-elements/routePath.ts
  • Cognitive Complexity · layered.rank (cognitive 64) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · GridEdgeRoutingSession.routePlan (cognitive 64) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts
  • Cognitive Complexity · compound.compoundLayout::place (cognitive 63) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts
  • Cognitive Complexity · layered.assignTracks (cognitive 60) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · routerTopology.buildEndpointRoutingOverlay (cognitive 60) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts
  • Cognitive Complexity · layered.reduceCrossings::count (cognitive 59) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · routerSparse.sparseSelfLoopRoute (cognitive 57) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts
  • Cognitive Complexity · routerCompatibility.prepareRoutingModes (cognitive 54) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts
  • Cognitive Complexity · layered.alignLabels (cognitive 51) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · routerSparse.sparseSameContainerRoute::searchPairs (cognitive 51) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts
  • Cognitive Complexity · layered.reduceCrossings::sweep (cognitive 48) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · layered.snap (cognitive 47) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · index.run (cognitive 45) packages/mermaid/src/rendering-util/layout-algorithms/layered/index.ts
  • Cognitive Complexity · edgeLabels.labelPlacementWithExtendedDetour (cognitive 44) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cognitive Complexity · layered.pastLabels (cognitive 43) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · edgeLabels.labelPlacementWithDetour (cognitive 42) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cognitive Complexity · edgeLabels.blockedCenterIntervals (cognitive 39) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cognitive Complexity · routerPlanning.endpointCandidates (cognitive 39) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cognitive Complexity · routerConstraint.canonicalizeOrthogonalPolyline (cognitive 39) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerConstraint.ts
  • Cognitive Complexity · routerTopology.buildVisibilityGraph (cognitive 38) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts
  • Cognitive Complexity · gridPlacement.validateGridPlacementCoordinates (cognitive 35) packages/mermaid/src/utils/gridPlacement.ts
  • Cognitive Complexity · layered.straighten (cognitive 33) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · edgeLabels.rerouteSegmentAroundRect (cognitive 32) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cognitive Complexity · labelSpacing.deriveGridContainerLabelGaps (cognitive 30) packages/mermaid/src/rendering-util/layout-algorithms/grid/labelSpacing.ts
  • Cognitive Complexity · gridPlacement.sanitizeGridPlacements (cognitive 28) packages/mermaid/src/utils/gridPlacement.ts
  • Cognitive Complexity · routerPlanning.buildEndpointPlan (cognitive 28) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cognitive Complexity · routerPlanning.resolveAmbiguousEndpointSides (cognitive 28) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cognitive Complexity · sanitizeDirective.sanitizeDirectiveValue (cognitive 27) packages/mermaid/src/utils/sanitizeDirective.ts
  • Cognitive Complexity · edgeLabels.polylineHasSelfConflict (cognitive 27) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts
  • Cognitive Complexity · layered.sortByBary (cognitive 25) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · layered.alignPorts (cognitive 25) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts
  • Cognitive Complexity · anchoredNodes.clearAnchoredOverlaps (cognitive 24) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts
  • Cognitive Complexity · routerPlanning.prepareEdgeRoutes (cognitive 24) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts
  • Cognitive Complexity · swimlane (cognitive 24) packages/mermaid/src/rendering-util/rendering-elements/clusters/swimlane.js

We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 667 findings

These 667 critical or serious findings were in the previous survey, on 26 October 2026, and are gone from this one. The first 100 are listed here.

  • Cyclomatic Complexity · sanitizeDirective.sanitizeDirective (cyclomatic 18) packages/mermaid/src/utils/sanitizeDirective.ts
  • Cognitive Complexity · sanitizeDirective.sanitizeDirective (cognitive 25) packages/mermaid/src/utils/sanitizeDirective.ts
  • Cognitive Complexity · swimlane (cognitive 20) packages/mermaid/src/rendering-util/rendering-elements/clusters/swimlane.js
  • Cognitive Complexity · drawAttributes (cognitive 19) packages/mermaid/src/diagrams/er/erRenderer.js
  • Cognitive Complexity · docs.transformMarkdownAst (cognitive 18) packages/mermaid/scripts/docs.mts
  • Cognitive Complexity · screenshot-sheets.byDeclaration (cognitive 18) scripts/screenshot-sheets.ts
  • God Classes · FunctionTooLong: validateLayout.validateLayout packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts
  • God Classes · FunctionTooLong: erRenderer.drawAttributes packages/mermaid/src/diagrams/er/erRenderer.js
  • God Classes · FunctionTooLong: erMarkers.insertMarkers packages/mermaid/src/diagrams/er/erMarkers.js
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/architecture/architectureRenderer.ts packages/mermaid/src/diagrams/architecture/architectureRenderer.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/architecture/architectureTypes.ts packages/mermaid/src/diagrams/architecture/architectureTypes.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/architecture/svgDraw.ts packages/mermaid/src/diagrams/architecture/svgDraw.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/er/erMarkers.js packages/mermaid/src/diagrams/er/erMarkers.js
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/er/erRenderer.js packages/mermaid/src/diagrams/er/erRenderer.js
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/git/gitGraphAst.ts packages/mermaid/src/diagrams/git/gitGraphAst.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/git/gitGraphRenderer.ts packages/mermaid/src/diagrams/git/gitGraphRenderer.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/mindmap/mindmapRenderer.ts packages/mermaid/src/diagrams/mindmap/mindmapRenderer.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/mindmap/svgDraw.ts packages/mermaid/src/diagrams/mindmap/svgDraw.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/packet/db.ts packages/mermaid/src/diagrams/packet/db.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/pie/pieRenderer.ts packages/mermaid/src/diagrams/pie/pieRenderer.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/radar/db.ts packages/mermaid/src/diagrams/radar/db.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/railroad/railroadRenderer.ts packages/mermaid/src/diagrams/railroad/railroadRenderer.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/timeline/svgDraw.js packages/mermaid/src/diagrams/timeline/svgDraw.js
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/timeline/timelineRendererVertical.ts packages/mermaid/src/diagrams/timeline/timelineRendererVertical.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/treemap/db.ts packages/mermaid/src/diagrams/treemap/db.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/wardley/wardleyBuilder.ts packages/mermaid/src/diagrams/wardley/wardleyBuilder.ts
  • Code Coverage · Low coverage: packages/mermaid/src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts packages/mermaid/src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/intersect/intersect-node.js packages/mermaid/src/rendering-util/rendering-elements/intersect/intersect-node.js
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/anchor.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/anchor.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/bang.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/bang.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/bowTieRect.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/bowTieRect.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/browser.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/browser.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/bucket.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/bucket.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/card.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/card.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/choice.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/choice.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/cloud.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/cloud.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/collapsedGroup.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/collapsedGroup.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/composite.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/composite.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/console.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/console.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/crossedCircle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/crossedCircle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/curlyBraceLeft.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/curlyBraceLeft.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/curlyBraceRight.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/curlyBraceRight.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/curlyBraces.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/curlyBraces.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/datastore.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/datastore.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/defaultMindmapNode.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/defaultMindmapNode.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/dividedRect.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/dividedRect.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/erBox.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/erBox.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/filledCircle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/filledCircle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/folder.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/folder.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/forkJoin.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/forkJoin.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/hexagon.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/hexagon.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/hourglass.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/hourglass.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/icon.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/icon.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/iconCircle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/iconCircle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/iconRounded.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/iconRounded.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/iconSquare.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/iconSquare.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/imageSquare.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/imageSquare.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/invertedTrapezoid.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/invertedTrapezoid.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/labelImageUtils.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/labelImageUtils.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/labelRect.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/labelRect.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/leanLeft.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/leanLeft.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/leanRight.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/leanRight.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/lightningBolt.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/lightningBolt.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/linedCylinder.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/linedCylinder.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/mindmapCircle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/mindmapCircle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/multiRect.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/multiRect.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/multiWaveEdgedRectangle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/multiWaveEdgedRectangle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/rectLeftInvArrow.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/rectWithTitle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/rectWithTitle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/shadedProcess.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/shadedProcess.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/slopedRect.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/slopedRect.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/state.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/state.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/subroutine.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/subroutine.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/taggedRect.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/taggedRect.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/taggedWaveEdgedRectangle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/taggedWaveEdgedRectangle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/text.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/text.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoid.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoid.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoidalPentagon.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/triangle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/triangle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/waveEdgedRectangle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/waveEdgedRectangle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/waveRectangle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/waveRectangle.ts
  • Code Coverage · Low coverage: packages/mermaid/src/rendering-util/rendering-elements/shapes/windowPane.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/windowPane.ts
  • Code Coverage · Low coverage: packages/mermaid/src/utils/diagramRoot.ts packages/mermaid/src/utils/diagramRoot.ts
  • Code Coverage · Low coverage: packages/parser/src/language/common/tokenBuilder.ts packages/parser/src/language/common/tokenBuilder.ts
  • Code Coverage · Low coverage: REDACTED REDACTED
  • REDACTED Scanning · Leaked secret: hardcoded-credential REDACTED
  • Churn × Complexity Hotspots · Hotspot: packages/mermaid/src/diagrams/block/renderHelpers.ts packages/mermaid/src/diagrams/block/renderHelpers.ts
  • Churn × Complexity Hotspots · Hotspot: packages/mermaid/src/diagrams/usecase/usecaseRenderer.ts packages/mermaid/src/diagrams/usecase/usecaseRenderer.ts
  • Churn × Complexity Hotspots · Hotspot: packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts
  • Churn × Complexity Hotspots · Hotspot: packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts
  • Churn × Complexity Hotspots · Hotspot: packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts
  • Churn × Complexity Hotspots · Repeated repair: packages/mermaid/src/rendering-util/rendering-elements/shapes/usecaseActor.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/usecaseActor.ts
  • Churn × Complexity Hotspots · Repeated repair: packages/mermaid/src/rendering-util/rendering-elements/shapes/usecaseBusiness.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/usecaseBusiness.ts
  • Churn × Complexity Hotspots · Repeated repair: packages/mermaid/src/diagrams/usecase/styles.ts packages/mermaid/src/diagrams/usecase/styles.ts
  • Churn × Complexity Hotspots · Repeated repair: packages/mermaid/src/rendering-util/rendering-elements/clusters/swimlane.js packages/mermaid/src/rendering-util/rendering-elements/clusters/swimlane.js
  • Boundary Type-Coupling · Cross-context type DiagramAST (parser → mermaid) packages/mermaid/src/diagrams/common/populateCommonDb.ts
Rebuild cost: about €200,000 · Estimate
Cost to rebuild€65,000 to €330,000, for 1,088 to 3,451 hours of work, about 1.4 person-years for 1 to 3 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 49. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeLarge: 123,570 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Raises the score by about 4 points · Medium effort · Forms & labels
2
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Raises the score by about 4 points · Medium effort · Visual & motion safety
3
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Raises the score by about 3 points · Medium effort · Page structure

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Files that change often carry extra risk · Combined risk
One file is changed often and is hard to read, which makes it the likeliest place for a mistake. It also has under half its code tested, or was written almost entirely by one person, so a mistake there is less likely to be caught, or only one person knows the code well enough to avoid it. A change to this file therefore carries more risk than the overall score suggests.
Based on: Churn × Complexity Hotspots (53 files) · Code Coverage (9 files under half tested) · Bus Factor (0 files written almost entirely by one person) · The files: svgDraw.js
What to do: Add tests to these files and have a second person review every change to them, starting with svgDraw.js.
Where the investment is most exposed · Value at risk
This code would cost about €200,000 to build again, about 1.4 person-years of work. Its weakest lens is Accessibility, at 43 (Weak). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility actions in Top priorities.
If you do one thing first · First action
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label. Of all the actions in this report, it raises the score most for the work it takes: about 4 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 4.7 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 8% to 19% on every change. The history of the code shows how much it changes: about 162,888 lines over the last 90 days, which is about 660,601 lines a year. At that pace, the extra work comes to an estimated 137.6 to 825.8 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.

arch @mermaid-js/layout-elk layout-elk mermaid mermaid @mermaid-js/layout-elk->mermaid @mermaid-js/layout-tidy-tree layout-tidy-tree @mermaid-js/layout-tidy-tree->mermaid @mermaid-js/mermaid-zenuml mermaid-zenuml @mermaid-js/mermaid-zenuml->mermaid @mermaid-js/parser parser @mermaid-js/tiny tiny mermaid->@mermaid-js/parser

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

352 modules, with 451 dependencies between them. Every module uses only modules listed above it, so there are no loops.

The table shows the 40 modules with the most connections; 312 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 mermaid.src.Diagram2 mermaid.src.config_type3 mermaid.src.diagrams.block.blockTypes4 mermaid.src.diagrams.requirement.types5 mermaid.src.rendering-util.layout-algorithms.grid.routerInstrumentation6 mermaid.src.rendering-util.layout-algorithms.swimlanes.direction.lrTransform7 parser.src.language.common.tokenBuilder8 parser.src.language.common.valueConverter9 mermaid.src.diagram-api.types10 mermaid.src.diagrams.cynefin11 mermaid.src.types12 mermaid.src.diagrams.agentflow.agentflowDb13 mermaid.src.diagrams.xychart.chartBuilder.interfaces14 mermaid.src.rendering-util.layout-algorithms.layered.types15 mermaid.src.rendering-util.layout-algorithms.swimlanes.direction.geometry16 mermaid.src.rendering-util.types17 mermaid.src.diagrams.agentflow18 mermaid.src.diagrams.c419 mermaid.src.diagrams.sequence.types20 mermaid.src.diagrams.treeView21 mermaid.src.diagrams.xychart.chartBuilder.textDimensionCalculator22 mermaid.src.rendering-util.layout-algorithms.ddlt23 mermaid.src.rendering-util.layout-algorithms.elk24 mermaid.src.rendering-util.layout-algorithms.grid.types25 mermaid.src.rendering-util.layout-algorithms.layout-utils26 mermaid.src.rendering-util.layout-algorithms.swimlanes27 mermaid.src.rendering-util.layout-algorithms.swimlanes.direction28 mermaid.src.rendering-util.render29 mermaid.src.rendering-util.rendering-elements30 mermaid.src.rendering-util.rendering-elements.shapes31 mermaid.src.diagrams.state.stateDb32 mermaid.src.diagrams.usecase.usecaseTypes33 mermaid.src.diagrams.xychart.chartBuilder.components.axis.baseAxis34 mermaid.src.rendering-util.layout-algorithms.grid.routerSession35 mermaid.src.rendering-util.layout-algorithms.layered36 mermaid.src37 mermaid.src.diagrams.usecase.usecaseAst38 mermaid.src.rendering-util.layout-algorithms.grid39 mermaid.src.diagrams.usecase40 mermaid.src.diagrams.usecase.parser.usecaseModelBuilder
1 mermaid.src.Diagram
2 mermaid.src.config_type
3 mermaid.src.diagrams.block.blockTypes
4 mermaid.src.diagrams.requirement.types
5 mermaid.src.rendering-util.layout-algorithms.grid.routerInstrumentation
6 mermaid.src.rendering-util.layout-algorithms.swimlanes.direction.lrTransform
7 parser.src.language.common.tokenBuilder
8 parser.src.language.common.valueConverter
9 mermaid.src.diagram-api.types1
10 mermaid.src.diagrams.cynefin11
11 mermaid.src.types3
12 mermaid.src.diagrams.agentflow.agentflowDb11
13 mermaid.src.diagrams.xychart.chartBuilder.interfaces11
14 mermaid.src.rendering-util.layout-algorithms.layered.types2
15 mermaid.src.rendering-util.layout-algorithms.swimlanes.direction.geometry2
16 mermaid.src.rendering-util.types21
17 mermaid.src.diagrams.agentflow111
18 mermaid.src.diagrams.c41121
19 mermaid.src.diagrams.sequence.types1
20 mermaid.src.diagrams.treeView21
21 mermaid.src.diagrams.xychart.chartBuilder.textDimensionCalculator2
22 mermaid.src.rendering-util.layout-algorithms.ddlt6
23 mermaid.src.rendering-util.layout-algorithms.elk24
24 mermaid.src.rendering-util.layout-algorithms.grid.types5212
25 mermaid.src.rendering-util.layout-algorithms.layout-utils46
26 mermaid.src.rendering-util.layout-algorithms.swimlanes19
27 mermaid.src.rendering-util.layout-algorithms.swimlanes.direction12421310
28 mermaid.src.rendering-util.render1
29 mermaid.src.rendering-util.rendering-elements124
30 mermaid.src.rendering-util.rendering-elements.shapes1112
31 mermaid.src.diagrams.state.stateDb11
32 mermaid.src.diagrams.usecase.usecaseTypes2411
33 mermaid.src.diagrams.xychart.chartBuilder.components.axis.baseAxis11131
34 mermaid.src.rendering-util.layout-algorithms.grid.routerSession24
35 mermaid.src.rendering-util.layout-algorithms.layered1241
36 mermaid.src4151
37 mermaid.src.diagrams.usecase.usecaseAst214
38 mermaid.src.rendering-util.layout-algorithms.grid195218441
39 mermaid.src.diagrams.usecase122151
40 mermaid.src.diagrams.usecase.parser.usecaseModelBuilder211161
Uses a module listed above itPart of a loopThe module itself
1 mermaid.src.Diagram2 mermaid.src.config_type3 mermaid.src.diagrams.block.blockTypes4 mermaid.src.diagrams.requirement.types5 mermaid.src.rendering-util.layout-algorithms.grid.routerInstrumentation6 mermaid.src.rendering-util.layout-algorithms.swimlanes.direction.lrTransform7 parser.src.language.common.tokenBuilder8 parser.src.language.common.valueConverter9 mermaid.src.diagram-api.types10 mermaid.src.diagrams.cynefin11 mermaid.src.types12 mermaid.src.diagrams.agentflow.agentflowDb13 mermaid.src.diagrams.xychart.chartBuilder.interfaces14 mermaid.src.rendering-util.layout-algorithms.layered.types15 mermaid.src.rendering-util.layout-algorithms.swimlanes.direction.geometry16 mermaid.src.rendering-util.types17 mermaid.src.diagrams.agentflow18 mermaid.src.diagrams.c419 mermaid.src.diagrams.sequence.types20 mermaid.src.diagrams.treeView21 mermaid.src.diagrams.xychart.chartBuilder.textDimensionCalculator22 mermaid.src.rendering-util.layout-algorithms.ddlt23 mermaid.src.rendering-util.layout-algorithms.elk24 mermaid.src.rendering-util.layout-algorithms.grid.types25 mermaid.src.rendering-util.layout-algorithms.layout-utils26 mermaid.src.rendering-util.layout-algorithms.swimlanes27 mermaid.src.rendering-util.layout-algorithms.swimlanes.direction28 mermaid.src.rendering-util.render29 mermaid.src.rendering-util.rendering-elements30 mermaid.src.rendering-util.rendering-elements.shapes31 mermaid.src.diagrams.state.stateDb32 mermaid.src.diagrams.usecase.usecaseTypes33 mermaid.src.diagrams.xychart.chartBuilder.components.axis.baseAxis34 mermaid.src.rendering-util.layout-algorithms.grid.routerSession35 mermaid.src.rendering-util.layout-algorithms.layered36 mermaid.src37 mermaid.src.diagrams.usecase.usecaseAst38 mermaid.src.rendering-util.layout-algorithms.grid39 mermaid.src.diagrams.usecase40 mermaid.src.diagrams.usecase.parser.usecaseModelBuildermermaid.src.Diagram1mermaid.src.config_type2mermaid.src.diagrams.block.blockTypes3mermaid.src.diagrams.requirement.types4mermaid.src.rendering-util.layout-algorithms.grid.routerInstrumentation5mermaid.src.rendering-util.layout-algorithms.swimlanes.direction.lrTransform6parser.src.language.common.tokenBuilder7parser.src.language.common.valueConverter8mermaid.src.diagram-api.types9mermaid.src.diagrams.cynefin10mermaid.src.types11mermaid.src.diagrams.agentflow.agentflowDb12mermaid.src.diagrams.xychart.chartBuilder.interfaces13mermaid.src.rendering-util.layout-algorithms.layered.types14mermaid.src.rendering-util.layout-algorithms.swimlanes.direction.geometry15mermaid.src.rendering-util.types16mermaid.src.diagrams.agentflow17mermaid.src.diagrams.c418mermaid.src.diagrams.sequence.types19mermaid.src.diagrams.treeView20mermaid.src.diagrams.xychart.chartBuilder.textDimensionCalculator21mermaid.src.rendering-util.layout-algorithms.ddlt22mermaid.src.rendering-util.layout-algorithms.elk23mermaid.src.rendering-util.layout-algorithms.grid.types24mermaid.src.rendering-util.layout-algorithms.layout-utils25mermaid.src.rendering-util.layout-algorithms.swimlanes26mermaid.src.rendering-util.layout-algorithms.swimlanes.direction27mermaid.src.rendering-util.render28mermaid.src.rendering-util.rendering-elements29mermaid.src.rendering-util.rendering-elements.shapes30mermaid.src.diagrams.state.stateDb31mermaid.src.diagrams.usecase.usecaseTypes32mermaid.src.diagrams.xychart.chartBuilder.components.axis.baseAxis33mermaid.src.rendering-util.layout-algorithms.grid.routerSession34mermaid.src.rendering-util.layout-algorithms.layered35mermaid.src36mermaid.src.diagrams.usecase.usecaseAst37mermaid.src.rendering-util.layout-algorithms.grid38mermaid.src.diagrams.usecase39mermaid.src.diagrams.usecase.parser.usecaseModelBuilder4011131111222111111211212624521246191242131011241112112411111312412414151214195218441122151211161+312 more modules (most-connected shown)

At a glance — Code Health · 44% · Weak · gated by D1, D2, R10 ·

At a glance — Architecture · 91% · Exemplary ·

At a glance — Maturity · 75% · Strong ·

At a glance — Readiness · 59% · Adequate · gated by P5 ·

At a glance — Security · 66% · Adequate · gated by D29 ·

At a glance — Accessibility · 43% · Weak ·

At a glance — Performance · 60% · Adequate ·

Security & Compliance — OWASP Top-10 mapping

Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).

OWASP categoryFindingsSeverity
A03:2025 — Software Supply Chain Failures82High / Critical
A05:2025 — Injection22High / Critical
A07:2025 — Authentication Failures4High / Critical
A02:2025 — Security Misconfiguration2High / Critical

Roadmap

Top priorities: Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label; Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1; Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.

Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.

Do thisHelpsEffortDimension
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.+3.8 ptsMediumForms & labels
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.+3.7 ptsMediumVisual & motion safety
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.+3.3 ptsMediumPage structure
Bring the 115 bodies over 30 down to 30 or less in Cognitive Complexity — start with router.routeEdgesOrthogonal (cognitive 514), validateLayout.validateLayout (cognitive 424), layered.layered (cognitive 334).+3.0 ptsHighCognitive Complexity
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.+1.9 ptsMediumCode Duplication
Bring the 30 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with updateColors (cyclomatic 289), router.routeEdgesOrthogonal (cyclomatic 240), updateColors (cyclomatic 216).+1.9 ptsHighCyclomatic Complexity
Resolve the 77 FunctionTooLong finding(s) in God Classes — start with materializedGeometry.ts (7), layered.ts (5), styles.ts (4).+1.6 ptsHighGod Classes
TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.+1.3 ptsMediumAsync & latency hygiene

File quality

Per-file score 0–10 — a quality signature. Of 270 files carrying findings, judged against the Production bar: 0% slop · 62% mixed · 38% near-clean.

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js4.0MixedTest Quality: No assertions (empty test): should limit the number of relationships between the same two entities
REDACTED4.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedSecrets (history): REDACTED: REDACTED
packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/rendering-util/rendering-elements/shapes/classBox.ts6.0MixedExplicit Debt: TodoComment repeated across 10 files
packages/mermaid/src/diagrams/flowchart/flowDb.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/diagrams/agentflow/agentflowDb.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/diagrams/sequence/sequenceDb.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/diagrams/architecture/svgDraw.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/diagrams/xychart/xychartRenderer.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/diagrams/state/dataFetcher.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/mermaidAPI.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/rendering-util/rendering-elements/shapes/util.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/utils/sanitizeDirective.ts6.0MixedExplicit Debt: TodoComment
packages/mermaid/src/utils.ts6.0MixedExplicit Debt: TodoComment

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 82

A definite problem that already costs you something and drags the score down: a missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here tends to cause failures elsewhere.

Serious — 1175

Likely wrong, but not failing yet. It degrades the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to carry for two years either.

Minor — 272

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 4

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 75 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.

Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.

What we checked — 75 dimensions across the health lenses
D1D2D3D5D6D8D10D11D12D13D14D15D16D17D19D21D23D24D26D27D28D29D30D31D34D35D36D43AC2AC3AC6AX10AX3AX4AX6AX8GD1IC1M1M2M3M4P1P10P2P3P4P5P6PF3R1R10R11R2R3R4R6R7R8R9S1X1X12X16X17X2X21X23X24X25X28X29X3X30X5

Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.

How to trust any code-health report — three questions
  1. Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 1487 of 1529 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

This report answers yes to all three. That's the bar to hold any assessment to.

Tools & methods

The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic

Every finding is locatable in findings.md. Run 01a1d967-ad2e-783b-b8d1-71b86a21f954.

The exact command behind every deep-scan dimension — tool, version, invocation and retained raw output — is in Appendix B — Reproduction & audit trail.

Run transparency — what happened this run

What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.

  • D8 Code Coverage — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 31 test file(s) failed while being loaded here, so none of their cases ran (typically a native addon or generated module the package's install scripts build, which the analyzer's scripts-off install does not run). The 95 production file(s) those files import that read under half covered are unmeasured in this run, not untested, so their figures are left out of the per-file rows and the 82.6% rather than published as low coverage. You can widen what we reach: optional: commit the lcov report of a run where those test files load, and their modules are read from it.
  • D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D23 Boundary Type-Coupling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind measured 0/40 valid on a seeded held-out sample of its rows on 98 C# repositories (docs/plans/deterministic-engine/adjudication/P5c-D23-units.md, "Version 1 ON MAIN"): the noise rows were dependencies on layer folders, shared cores and grouping folders read as contexts. By the pre-registered fallback (PREREGISTRATION v37) it publishes no row until version 4 passes its gate. The candidates are counted here, not reported as findings, and the score does not include them.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `.build/common.ts`, `packages/mermaid/src/diagrams/flowchart/flowDb.ts`, `packages/mermaid/src/diagrams/git/gitGraphAst.ts`, `packages/mermaid/src/diagrams/kanban/kanbanDb.ts`, `packages/mermaid/src/diagrams/state/stateDb.ts`, … (+9 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • D44 Platform End-of-Life — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a REDACTED) is simply not read here yet.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DockerCompose (docker-compose.yml). compose up failed (exit 15 — the compose project is invalid) — time="2026-11-14T09:34:11Z" level=warning msg="The \"MERMAID_PORT\" variable is not set. Defaulting to a blank string." time="2026-11-14T09:34:11Z" level=warning msg="The \"MERMAID_PORT\" variable is not set. Defaulting to a blank string." no port specified: :<empty>; runtime evidence skipped.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. A badge or prose version claim scored 9/17 in its adjudication (docs/plans/deterministic-engine/adjudication/M4-v3.md: badges 9/9, prose 0/8, where prose versions are minimums or history), short of the 95 % precision gate, so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them. The .NET and Node.js version checks are a different kind and still publish.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • R10 Code Duplication — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 516 further occurrence(s) are not listed individually; the score already reflects all 556.
  • R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 396 further occurrence(s) are not listed individually; the score already reflects all 436.
  • R3 Large Files — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 33 further occurrence(s) are not listed individually; the score already reflects all 73.
  • X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 117 further occurrence(s) are not listed individually; the score already reflects all 157.
  • X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

Repo exclusion declarations: 28 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

Limitations & what we did not check

We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.

Per-dimension blind spots

For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D11 Test Reliability: Flakiness is inferred from history/markers — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
  • D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
  • AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
  • AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity2.0 / 10Critical✓ Tool-verified

What it measures: How tangled the control flow is — methods with many branches are hard to test and change.

Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

227 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was updateColors at 289. A further 5 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being renderHelpers.getNodeFromBlock at 26 — they are counted neither in the figure above nor in this dimension's score. 3 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: packages/mermaid/src/diagrams/block/renderHelpers.ts (renderHelpers.getNodeFromBlock at 26), packages/mermaid/src/diagrams/state/styles.js (getStyles at 22), packages/mermaid/src/rendering-util/rendering-elements/shapes/handDrawnShapeStyles.ts (handDrawnShapeStyles.isLabelStyle at 18). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

updateColors (cyclomatic 215) · ×2packages/mermaid/src/themes/theme-neo-dark.js:68
layered.reduceCrossings::count (cyclomatic 25) · ×2packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2023
updateColors (cyclomatic 289)packages/mermaid/src/themes/theme-base.js:32
router.routeEdgesOrthogonal (cyclomatic 240)packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141
updateColors (cyclomatic 216)packages/mermaid/src/themes/theme-redux-dark.js:76

+ 192 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 30 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with updateColors (cyclomatic 289), router.routeEdgesOrthogonal (cyclomatic 240), updateColors (cyclomatic 216). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 30 together lifts Cyclomatic Complexity from 2.0 to about 4.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.

D2 · Cognitive Complexity2.0 / 10Critical✓ Tool-verified

What it measures: How hard the code is for a person to follow, beyond raw branching.

Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

326 method(s) exceeded the cognitive complexity threshold of 15; the worst was router.routeEdgesOrthogonal at 514.

layered.reduceCrossings::count (cognitive 59) · ×3packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2023
updateColors (cognitive 220) · ×2packages/mermaid/src/themes/theme-neo-dark.js:68
router.routeEdgesOrthogonal::crossingPenalty (cognitive 37) · ×2packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:300
materializedGeometry.reassignCrossingExternalRailChannels::candidateIsSafe (cognitive 28) · ×2packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1574
router.routeEdgesOrthogonal (cognitive 514)packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141

+ 280 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Bring the 115 bodies over 30 down to 30 or less in Cognitive Complexity — start with router.routeEdgesOrthogonal (cognitive 514), validateLayout.validateLayout (cognitive 424), layered.layered (cognitive 334). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 115 together lifts Cognitive Complexity from 2.0 to about 5.6/10, projected with the scoring formula itself and assuming each lands exactly at 30; a cleaner split scores higher.

Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.

D3 · God Classes6.4 / 10Adequate✓ Tool-verified

What it measures: Over-large classes that try to do too much ("god classes").

Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.

Maturity: Documented → Verified → Prevented · effective 6.4 / 10 · rule-coverage 100% · ceiling Prevented

145 god class(es) detected.

FunctionTooLong: router.routeEdgesOrthogonal · ×77packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141
FileTooLong: direction/materializedGeometry.ts · ×33packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts
MethodTooLong: UsecaseParser.constructor · ×18packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts:134
ClassTooLong: AgentFlowDB · ×10packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:188
TooManyMethods: AgentFlowDB · ×7packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:188

What to do

  1. Resolve the 77 FunctionTooLong finding(s) in God Classes — start with materializedGeometry.ts (7), layered.ts (5), styles.ts (4). — One of this dimension's main actionable groups (77 warning-level).
  2. Resolve the 33 FileTooLong finding(s) in God Classes — start with materializedGeometry.ts, layered.ts, edgeLabels.ts. — One of this dimension's main actionable groups (33 warning-level).
  3. Resolve the 18 MethodTooLong finding(s) in God Classes — start with theme-default.js (2), usecase.parser.ts, theme-base.js. — One of this dimension's main actionable groups (18 warning-level).

Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.

D5 · Coupling8.7 / 10Strong✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 8.7 / 10 · rule-coverage 100% · ceiling Prevented

6 production modules (npm), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 1 module(s) off the main sequence, with abstractness counted on 4 of the 6 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

Off the main sequence: @mermaid-js/parser

What to do

  1. Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.

D6 · Cohesion (LCOM4)10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 46 classes have LCOM4 above 3.

✓ On the Gold path — maintain.

Detailed fixes: d6_recommendation.md.

D8 · Code Coverage9.9 / 10Stronggated by 9 serious findings✓ Tool-verified

What it measures: How much of the code is actually exercised by tests.

Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Verified

Line coverage 82.6% — 9 file(s) below 50%. Measured from the JavaScript/TypeScript suite (vitest + @vitest/coverage-v8 via `pnpm install --frozen-lockfile --ignore-scripts` in the repository root).

Low coverage: .build/jisonTransformer.ts · ×9.build/jisonTransformer.ts:1

What to do

  1. Resolve the 9 Low coverage finding(s) in Code Coverage — start with jisonTransformer.ts, jsonSchema.ts, jisonPlugin.ts. — One of this dimension's main actionable groups (9 warning-level).

Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.

D10 · Test Quality9.6 / 10Adequategated by 2 critical findings✓ Tool-verified

What it measures: Whether the tests truly assert behaviour rather than just running the code.

Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Prevented

17 skipped (3 with a documented reason), 121 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 4855 tests.

No assertions (empty test): should limit the number of relationships between the same two entities · ×2packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js:575
No assertions: should add to mermaid · ×119packages/mermaid-layout-elk/src/plugin.spec.ts:13
Skipped test: markdownToLines - No auto wrapping · ×14packages/mermaid/src/rendering-util/handle-markdown-text.spec.ts:207
Test project verifies nothing: packages/mermaid-example-diagrampackages/mermaid-example-diagram/src/exampleDiagram.spec.js:22
Mock-dominated test: calls setDiagramId with the svg element id · ×2packages/mermaid/src/diagrams/flowchart/flowRenderer-v3-unified.spec.ts:27

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 2 No assertions (empty test) finding(s) in Test Quality — start with erDiagram.spec.js (2). — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 119 No assertions finding(s) in Test Quality — start with classDiagram.spec.ts (39), stateDiagram.spec.js (24), stateDiagram-v2.spec.js (21). — One of this dimension's main actionable groups (119 warning-level).
  3. Resolve the 14 Skipped test finding(s) in Test Quality — start with gitGraph.spec.ts (4), handle-markdown-text.spec.ts, postProcessing.spec.ts. — One of this dimension's main actionable groups (14 warning-level).

Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.

D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests pass reliably, with no flakiness.

Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 flaky across 1 measured tier(s). JavaScript/TypeScript (vitest via `pnpm install --frozen-lockfile --ignore-scripts` in the repository root (7693 tests)): measured (0 flaky).

✓ On the Gold path — maintain.

Detailed fixes: d11_recommendation.md.

D12 · Dependency Hygiene7.2 / 10Strong✓ Tool-verified

What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.

Maturity: Documented → Verified → Prevented · effective 7.2 / 10 · rule-coverage 100% · ceiling Verified

15 outdated direct production npm dependency(ies) of 31 graded, 0 pinning defect(s), across 11 package.json (7 of them the product) and 1 committed lockfile(s). Development dependencies are deliberately not graded for currency: that grade is about what SHIPS. 4 direct dependency(ies) — production, development or optional — are marked DEPRECATED by their publisher (the registry's per-version mark, or the lockfile's copy of it when the registry could not be asked); deprecated transitive packages are listed but not charged. Whether any is UNMAINTAINED is not graded — the registry publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, and the frontend dependency lens (R8) answers it in this same run. Known CVEs in this dependency graph are D30's question, read from the manifest there.

Deprecated: @types/rollup-plugin-visualizer · ×5package.json:121
Deprecated: @types/flexsearch · ×14REDACTED:4048
Outdated (npm): @iconify/utils · ×15

What to do

  1. Resolve the 14 Deprecated finding(s) in Dependency Hygiene — start with REDACTED (14). — One of this dimension's main actionable groups (14 recommendation-level).
  2. Resolve the 5 Deprecated finding(s) in Dependency Hygiene — start with package.json (5). — One of this dimension's main actionable groups (5 warning-level).

Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.

D13 · REDACTED Scanning10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.

Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

REDACTED scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 344 shipped npm package(s) use a banned license. Licences were resolved from registry.npmjs.org over the 344 package(s) this repository's committed lockfile installs for a consumer — its 31 production, optional and peer dependency(ies), across 7 product package.json manifest(s), and everything those install in turn. Its 153 `devDependencies` declaration(s), and every package only they reach, are excluded: a consumer installs none of them. ★ Each licence is the one the registry publishes for the package's CURRENT release rather than for the pinned version, which is the same caveat the Hex and RubyGems arms carry. 1 of them publish no licence this pass can read on registry.npmjs.org — an absent field, `UNLICENSED`, or a `SEE LICENSE IN <file>` pointer into a tarball this pass does not download; that is missing data, not a violation, and none of them is charged. This repository publishes itself under MIT, which is its own choice and is not judged here.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.5 / 10Stronggated by 57 serious findings✓ Tool-verified

What it measures: Files that change often and are also complex — the riskiest hotspots.

Method: Per production file churn times cyclomatic complexity over a rolling window, computed from git and Roslyn/JS/Razor analysis. Exhaustive, deterministic per commit date.

Maturity: Documented → Verified → Prevented · effective 9.5 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts (6×443=2658); packages/mermaid/src/themes/theme-redux-color.js (10×195=1950); packages/mermaid/src/rendering-util/rendering-elements/edges.js (24×80=1920) Repeated repair below the complexity floor: packages/mermaid/src/rendering-util/rendering-elements/edgeStepAnimation.ts (10 of 17 changes were fixes); packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts (6 of 6 changes were fixes); packages/mermaid/src/diagrams/flowchart/styles.ts (5 of 8 changes were fixes)

Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts · ×42packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141
Repeated repair: packages/mermaid/src/rendering-util/rendering-elements/edgeStepAnimation.ts · ×15packages/mermaid/src/rendering-util/rendering-elements/edgeStepAnimation.ts:88

What to do

  1. Resolve the 42 Hotspot finding(s) in Churn × Complexity Hotspots — start with router.ts, theme-redux-color.js, edges.js. — One of this dimension's main actionable groups (42 warning-level).
  2. Resolve the 15 Repeated repair finding(s) in Churn × Complexity Hotspots — start with styles.ts (3), edgeStepAnimation.ts, index.ts. — One of this dimension's main actionable groups (15 warning-level).

Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.

D16 · Bus Factor7.8 / 10Strong✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

Maturity: Documented → Verified → Prevented · effective 7.8 / 10 · rule-coverage 100% · ceiling Documented

75 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts. Counted over 344 of the 679 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1 · ×6
Further sole-owners (lower concentration)

What to do

  1. Resolve the 6 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (6 recommendation-level).
  2. Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.

D17 · Explicit Debt9.8 / 10Stronggated by 85 serious findings✓ Tool-verified

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Prevented

94 deducted task-comment markers across 103873 LoC (0.1/KLoC) → score 9.8. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

TodoComment · ×83scripts/tsc-check.ts:63
TodoComment repeated across 10 filespackages/mermaid/src/rendering-util/rendering-elements/shapes/classBox.ts:48
HackCommentpackages/mermaid/src/diagrams/architecture/architectureRenderer.ts:495

What to do

  1. Resolve the 83 TodoComment finding(s) in Explicit Debt — start with styles.ts (6), mermaidAPI.ts (5), mermaidAPI.spec.ts (4). — One of this dimension's main actionable groups (83 warning-level).
  2. Resolve the 1 TodoComment repeated across 10 files finding(s) in Explicit Debt — start with classBox.ts. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 HackComment finding(s) in Explicit Debt — start with architectureRenderer.ts. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

What it measures: Whether the project's documentation is clear, complete, and useful.

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

2 of 2 documentation facets pass in full. 81 document(s) read across 10 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D21 · Naming Consistency9.1 / 10Exemplary✓ Tool-verified

What it measures: Whether names — types, methods, variables — are clear and consistent.

Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.

Maturity: Documented → Verified → Prevented · effective 9.1 / 10 · rule-coverage 100% · ceiling Verified

3 naming inconsistencies among 317 declarations measured against a convention their peers follow.

`deterministicIDSeed` spells `ID` where 321 names in the project spell it `Id`packages/mermaid/src/config.type.ts:363
`getID` spells `ID` where 321 names in the project spell it `Id`packages/mermaid/src/diagrams/git/gitGraphAst.ts:66
`InitIDGenerator` spells `ID` where 321 names in the project spell it `Id`packages/mermaid/src/utils.ts:754

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.

D23 · Boundary Type-Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.

Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.

Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

1 domain type(s) cross context boundaries across 7 contexts; they are measured and withheld (not published, not scored). Contexts: examples, mermaid, mermaid-example-diagram, mermaid-layout-tidy-tree, mermaid-local-editor, mermaid-zenuml, parser.

✓ On the Gold path — maintain.

Detailed fixes: d23_recommendation.md.

D24 · Comment Value8.9 8.6 / 10Strong✓ Tool-verified

What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).

Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.

Maturity: Documented → Verified → Prevented · effective 8.6 / 10 · rule-coverage 97% · ceiling Documented

48 of 4235 judged comments only repeat the code they sit on (1.1 %). 144 comment(s) in another language or script were not judged.

redundant comment · ×39packages/mermaid/scripts/create-types-from-json-schema.mts:199
doc comments repeat the names · ×3packages/mermaid/src/docs/.vitepress/headerDomainRules.ts:9

What to do

  1. Resolve the 39 redundant comment finding(s) in Comment Value — start with timelineRenderer.ts (4), validateLayout.ts (4), timelineRendererVertical.ts (2). — One of this dimension's main actionable groups (39 recommendation-level).

Detailed fixes: d24_recommendation.md · top locations in Appendix A, every location in findings.md.

D26 · Project Cohesion7.1 / 10Strong✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 7.1 / 10 · rule-coverage 100% · ceiling Documented

1 of 7 build units (npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.

D27 · Navigability10.0 / 10Exemplary✓ Tool-verified

What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.

Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.

Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

25 % of calls cross a namespace and 0 % go through an interface, but 96 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.md.

D28 · Secrets (history)7.0 / 10Adequategated by 3 critical findings✓ Tool-verified

What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

Maturity: Documented → Verified → Prevented · effective 7.0 / 10 · rule-coverage 100% · ceiling Documented

3 finding(s): 0 critical, 3 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.

REDACTED
REDACTED

What to do

  1. Resolve the 3 REDACTED finding(s) in Secrets (history) — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 issue-level).
  2. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.

D29 · Static Analysis (SAST)0.9 / 10Critical✓ Tool-verified

What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.

Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.

Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).

Maturity: Documented → Verified → Prevented · effective 0.9 / 10 · rule-coverage 100% · ceiling Documented

22 finding(s): 0 critical, 12 high, 10 medium, 0 low. 1 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 107 file(s) — `.build/common.ts` (line 48), `demos/block.html` (lines 16–26, lines 33–35, lines 43–47, …), `demos/classchart.html` (lines 27–49, lines 56–70, lines 96–109, …), `demos/dataflowchart.html` (line 21), `demos/error.html` (line 28), … (+102 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 9 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 issue-level).
  2. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  3. No action in Static Analysis (SAST) — all 1 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (1 issue-level, 0 of them charged here).

Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.

D30 · Dependency Vulnerabilities0.0 / 10Critical✓ Tool-verified

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

75 finding(s): 5 critical, 52 high, 15 medium, 3 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 50 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (50). — One of this dimension's main actionable groups (50 issue-level).
  2. Resolve the 5 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (5). — One of this dimension's main actionable groups (5 issue-level).
  3. Resolve the 2 High vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).

Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.

D31 · IaC & Container Security9.6 / 10Adequategated by 1 critical finding✓ Tool-verified

What it measures: Whether Dockerfiles / Terraform / Kubernetes config follow security best practices.

Method: IaC/container misconfiguration scan via trivy config (REDACTED/Terraform/K8s/Helm/CloudFormation); severity rules to 0-10 moderate normalizer. NotApplicable without manifests. Exhaustive, deterministic.

Maturity: Documented → Verified → Prevented · effective 9.6 / 10 · rule-coverage 100% · ceiling Documented

2 finding(s): 0 critical, 1 high, 0 medium, 1 low.

REDACTED
REDACTED

What to do

  1. Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 1 Low IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.

D34 · Knowledge Freshness8.3 / 10Adequategated by 3 critical findings✓ Tool-verified

What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.

Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.

Maturity: Documented → Verified → Prevented · effective 8.3 / 10 · rule-coverage 100% · ceiling Documented

58 of 344 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is packages/mermaid/src/diagrams/sequence/sequenceDb.ts. Counted over 344 of the 679 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×3packages/mermaid/src/diagrams/sequence/sequenceDb.ts:1
Orphaned file · ×55scripts/swimlanes-size.ts:1
Further orphaned files (smaller)

What to do

  1. Resolve the 3 Orphaned knowledge finding(s) in Knowledge Freshness — start with sequenceDb.ts, quadrantBuilder.ts, railroadRenderer.ts. — One of this dimension's main actionable groups (3 issue-level).
  2. Resolve the 55 Orphaned file finding(s) in Knowledge Freshness — start with index.ts (2), swimlanes-size.ts, cynefinRenderer.ts. — One of this dimension's main actionable groups (55 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.

D35 · Change Coupling9.8 / 10Stronggated by 6 serious findings✓ Tool-verified

What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.

Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

Maturity: Documented → Verified → Prevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: chartTitle.ts↔index.ts 86%; index.ts↔chartTitle.ts 80%; index.ts↔index.ts 79%

Change coupling: chartTitle.ts ↔ index.ts · ×5packages/mermaid/src/diagrams/xychart/chartBuilder/components/chartTitle.ts:1
Change-coupling hub: textDimensionCalculator.ts → index.ts, orchestrator.ts, xychartDb.tspackages/mermaid/src/diagrams/xychart/chartBuilder/textDimensionCalculator.ts

What to do

  1. Resolve the 5 Change coupling finding(s) in Change Coupling — start with chartTitle.ts, index.ts, linePlot.ts. — One of this dimension's main actionable groups (5 warning-level).
  2. Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with textDimensionCalculator.ts. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.

D36 · Supply-chain Provenance & Signing5.0 / 10Adequate✓ Tool-verified

What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.

Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.

Maturity: Documented → Verified → Prevented · effective 5.0 / 10 · rule-coverage 100% · ceiling Documented

2/4 supply-chain integrity signals present (provenance, signing, SBOM, pinned actions).

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 1 more group(s) — more in Appendix A; the complete list is findings.md.

What to do

  1. Resolve the 2 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).

Detailed fixes: d36_recommendation.md · top locations in Appendix A, every location in findings.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

Frontend & cross-cutting dimensions

R = React/JS · M = Maturity · P = Readiness.

AC2 · Forms & labels4.2 / 10Weak✓ Tool-verified

Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.

Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×3) — .esbuild/dev-explorer/diagram-viewer.ts:1662, packages/mermaid-local-editor/static/index.html:17, packages/mermaid-local-editor/static/index.html:27
  • This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. — packages/mermaid-local-editor/static/index.html:18

What to do

  • Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
AC3 · Page structure4.8 / 10Weak✓ Tool-verified

Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.

Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×2) — .esbuild/dev-explorer/public/compare-pane.html:2, packages/mermaid-local-editor/static/index.html:2
  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <dev-explorer-app>, so there is no content here to wrap — render the <main> from the component mounted into it. — .esbuild/dev-explorer/public/index.html:2

What to do

  • Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
AC6 · Visual & motion safety4.2 / 10Weak✓ Tool-verified

Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.

Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.

Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • `.editable-code:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue:137
  • `dev-explorer-app .cm-content` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — .esbuild/dev-explorer/public/styles.css:479
  • `#toolbar` moves (`transition: transform 0.25s ease, opacity 0.2s ease, height 0.25s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — packages/mermaid-local-editor/static/styles.css:16
  • `.mermaid-chart-tooltip.showing` moves (`animation: tooltipFadeIn 0.3s ease 0.4s forwards`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — packages/mermaid/src/docs/.vitepress/theme/Tooltip.vue:84
  • `.mermaid-chart-tooltip.hiding` moves (`animation: tooltipFadeOut 0.3s ease forwards`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — packages/mermaid/src/docs/.vitepress/theme/Tooltip.vue:88
  • `dev-explorer-app button.card` moves (`transition: transform 0.2s ease, box-shadow 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — .esbuild/dev-explorer/public/styles.css:215

What to do

  • Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
AX10 · Code composition9.9 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

AX6 · Interface segregation9.7 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').

Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.

  • `GitGraphDB` declares 17 required operations: `setDirection`, `setOptions`, `getOptions`, `commit`, `branch`, `merge`, `cherryPick`, `checkout`, `prettyPrint`, `clear`, `getBranchesAsObjArray`, `getBranches`, `getCommits`, `getCommitsArray`, `getCurrentBranch`, `getDirection`, `getHead`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — packages/mermaid/src/diagrams/git/gitGraphTypes.ts:90
  • `ArchitectureDB` declares 16 required operations: `clear`, `addService`, `getServices`, `addJunction`, `getJunctions`, `getNodes`, `getNode`, `addGroup`, `getGroups`, `addEdge`, `getEdges`, `addLayoutHint`, `getLayoutHints`, `setElementForId`, `getElementById`, `getDataStructures`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — packages/mermaid/src/diagrams/architecture/architectureTypes.ts:252
  • `UsecaseDB` declares 20 required operations: `getConfig`, `createModel`, `commit`, `getAST`, `getActors`, `getActor`, `getUseCases`, `getUseCase`, `getSystemBoundaries`, `getSystemBoundary`, `getRelationships`, `getNotes`, `getNote`, `getJsonNodes`, `getJsonNode`, `getClassDefs`, `getClassDef`, `getDirection`, `getData`, `clear`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — packages/mermaid/src/diagrams/usecase/usecaseTypes.ts:304

What to do

  • Split fat interfaces into focused role-interfaces so clients depend only on what they use.
AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

GD1 · Unfinished & placeholder code10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Unreviewed-generation residue in this repository's JavaScript/TypeScript: functions whose whole body still throws a "not implemented" error, and placeholder text (lorem ipsum, changeme/replace_me…) left in strings and JSX of non-test, non-generated code. Scored as a quality signature, never as a claim about authorship.

Method: Roslyn syntax scan: NotImplementedException throws and placeholder string literals in non-test, non-generated shipped code. Deterministic, code-shape signature.

IC1 · Incompleteness & stubs6.9 / 10Adequate✓ Tool-verified

Other · Code Health — Unfinished work detected by code SHAPE, not keywords, in this repository's JavaScript/TypeScript: functions that only throw a "not implemented" error, functions that take inputs and return a constant or do nothing, async functions that never await, dead `if (false)` branches, and skeleton classes most of whose methods are holes.

Method: Roslyn syntax scan: incompleteness by code shape (constant-returning methods, async-never-await, #if false branches, guards that return what the code already falls through to, tests an earlier guard already decided, comparisons against NaN, skeleton types), not keyword-gated. Deterministic, code-shape heuristic.

  • `getStyles` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in. — packages/mermaid/src/diagrams/eventmodeling/styles.js:1
  • Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition. (×4) — packages/mermaid/src/diagrams/sequence/svgDraw.js:583, packages/mermaid/src/diagrams/sequence/svgDraw.js:584, packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts:274, …
  • `parse` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — packages/mermaid/src/diagrams/usecase/parser/usecase.chevrotain.ts:10
  • `trace` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — packages/mermaid/src/logger.ts:19
  • `debug` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — packages/mermaid/src/logger.ts:20
  • `info` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — packages/mermaid/src/logger.ts:21
  • `warn` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — packages/mermaid/src/logger.ts:22
  • `error` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — packages/mermaid/src/logger.ts:23
  • `fatal` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it. — packages/mermaid/src/logger.ts:24
  • `runDomusOrthogonalDdlt` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work. — packages/mermaid/src/rendering-util/layout-algorithms/ddlt/backends.ts:69
  • The `if` and its `else` contain the same statements, so no input can make the condition matter. Implement the distinction that was intended, or drop the branch and keep the body. (×2) — packages/mermaid/src/rendering-util/rendering-elements/clusters.js:478, packages/mermaid/src/utils.ts:427
  • A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something. (×16) — e2e/other/pr-check/configuration.spec.js:55, e2e/other/pr-check/dev-explorer-compare.spec.ts:11, packages/mermaid/scripts/docs.spec.ts:192, …
  • A bare `eslint-disable` or `@ts-nocheck` with no rule list switches every lint rule or the whole type checker off for the rest of the file — hidden debt. Disable the specific rule on the specific line, with a justification, instead. (×4) — packages/mermaid/src/diagrams/quadrant-chart/quadrantRenderer.ts:1, packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1, packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:1, …

What to do

  • Finish or delete the unfinished stubs (functions that throw "not implemented", or whose body is empty or a bare constant) — they are dead surface that looks live.
  • Clear the softer debt: re-enable or delete skipped tests, decide whether each empty function is a deliberate no-op (and say so in a comment), and replace blanket `eslint-disable` / `@ts-nocheck` with targeted, justified suppressions.
M1 · Documentation (README)7.4 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.

What to do

  • Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.

Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — Whether an automated pipeline builds and tests every change.

Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.

P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · Observability7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • `packages/mermaid/src/assignWithDepth.ts` reports through `console.*` at line 17 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/assignWithDepth.ts:17
  • `packages/mermaid/src/profiler.ts` reports through `console.*` at line 304 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/profiler.ts:304
  • `packages/mermaid/src/utils/imperativeState.ts` reports through `console.*` at line 12 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/utils/imperativeState.ts:12
  • `packages/mermaid/src/utils/imperativeState.ts` reports through `console.*` at line 14 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/utils/imperativeState.ts:14
  • `packages/mermaid/src/rendering-util/render.ts` reports through `console.*` at line 10 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/rendering-util/render.ts:10
  • `packages/mermaid/src/rendering-util/rendering-elements/shapes/drawRect.ts` reports through `console.*` at line 18 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/rendering-util/rendering-elements/shapes/drawRect.ts:18
  • `packages/mermaid/src/rendering-util/layout-algorithms/ddlt/discoverFixtures.ts` reports through `console.*` at line 110 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/rendering-util/layout-algorithms/ddlt/discoverFixtures.ts:110
  • `packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts` reports through `console.*` at line 75 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts:75
  • `packages/mermaid/src/diagrams/state/shapes.js` reports through `console.*` at line 180 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/diagrams/state/shapes.js:180
  • `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 27 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/diagrams/kanban/kanbanDb.ts:27
  • `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 35 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/diagrams/kanban/kanbanDb.ts:35
  • `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 37 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/diagrams/kanban/kanbanDb.ts:37
  • `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 121 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/diagrams/kanban/kanbanDb.ts:121
  • `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 123 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/diagrams/kanban/kanbanDb.ts:123
  • `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 126 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/diagrams/kanban/kanbanDb.ts:126
  • `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 130 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid/src/diagrams/kanban/kanbanDb.ts:130
  • `packages/mermaid-example-diagram/src/mermaidUtils.ts` reports through `console.*` at line 5 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid-example-diagram/src/mermaidUtils.ts:5
  • `packages/mermaid-zenuml/src/mermaidUtils.ts` reports through `console.*` at line 6 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — packages/mermaid-zenuml/src/mermaidUtils.ts:6

What to do

  • Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
  • Add a health-check endpoint (@godaddy/terminus or a /health route) so orchestrators and load balancers can probe liveness/readiness.
P3 · Security & performance tooling7.0 / 10Strong✓ Tool-verified

Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).

Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.

What to do

  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.

Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.

P5 · DR & Backup0.0 / 10Critical✓ Tool-verified

Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.

Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.

  • A persistence guard (data volume / purge-protection) was found, but no backup, geo-recovery or RTO/RPO controls were evidenced — a volume that survives a container recreate is not a tested restore from catastrophic loss.
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Readiness — Whether releases are traceable — a maintained changelog and explicit version stamping.

Method: Filesystem scan: changelog file presence and version tags in csproj or git tags. Exhaustive, deterministic.

PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

  • `rmSync` in `processDocs` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/mermaid/scripts/docs.mts:665
  • `rmSync` in `on("unlink")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/mermaid/scripts/docs.mts:704
  • `rmdirSync` in `on("unlinkDir")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/mermaid/scripts/docs.mts:705
  • `readFileSync` in `parseMmdFileToLayoutData` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — packages/mermaid/src/rendering-util/layout-algorithms/ddlt/parseToLayoutData.ts:139

What to do

  • TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
R1 · Type Safety8.7 / 10Strong✓ Tool-verified

React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.

Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.

R10 · Code Duplication2.4 / 10Critical✓ Tool-verified

React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.

Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.

  • 94 duplicated blocks under packages/mermaid/src/diagrams/ have copies in at least two of the sibling directories agentflow, architecture, block, c4, class, common (+28 more sibling(s) not listed) — 78 of them are reported below, and 16 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 94 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 94 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 94 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/mermaid/src/diagrams/timeline/svgDraw.js:19
  • 17 duplicated blocks under packages/mermaid/src/ have copies in at least two of the sibling directories diagrams, rendering-util — 11 of them are reported below, and 6 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 17 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 17 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 17 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:1022
  • 17 duplicated blocks under packages/mermaid/src/rendering-util/layout-algorithms/ have copies in at least two of the sibling directories ddlt, elk, grid, layout-utils, swimlanes — 9 of them are reported below, and 8 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 17 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 17 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 17 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/mermaid/src/rendering-util/layout-algorithms/elk/lineHops.ts:26
  • 12 duplicated blocks under packages/parser/src/language/ have copies in at least two of the sibling directories architecture, cynefin, eventmodeling, gitGraph, info, packet (+8 more sibling(s) not listed) — 8 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 12 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 12 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 12 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/parser/src/language/railroad-peg/valueConverter.ts:5
  • 10 duplicated blocks under packages/ have copies in at least two of the sibling directories mermaid, mermaid-example-diagram, mermaid-layout-tidy-tree, mermaid-zenuml — 9 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on. — packages/mermaid-layout-tidy-tree/src/render.ts:11
  • packages/mermaid/src/themes/theme-neo-dark.js:1 · packages/mermaid/src/themes/theme-redux-dark.js:1 — these 2 files are line-for-line copies of one another — 291 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — packages/mermaid/src/themes/theme-neo-dark.js:1
  • packages/mermaid/src/themes/theme-redux-dark-color.js:1 · packages/mermaid/src/themes/theme-redux-dark.js:1 — these 2 files are line-for-line copies of one another — 279 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — packages/mermaid/src/themes/theme-redux-dark-color.js:1
  • packages/mermaid/src/diagrams/timeline/svgDraw.js:19 · packages/mermaid/src/diagrams/user-journey/svgDraw.js:5 — the two spans are one implementation copied and then locally edited — 1894 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/diagrams/timeline/svgDraw.js:19
  • packages/mermaid/src/themes/theme-neo.js:1 · packages/mermaid/src/themes/theme-redux-color.js:1 · packages/mermaid/src/themes/theme-redux.js:1 — these 3 files are line-for-line copies of one another — 247 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — packages/mermaid/src/themes/theme-neo.js:1
  • packages/mermaid/src/themes/theme-default.js:164 · packages/mermaid/src/themes/theme-forest.js:140 — the two spans are one implementation copied and then locally edited — 1875 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/themes/theme-default.js:164
  • packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:11 · packages/mermaid/src/diagrams/timeline/timelineRendererVertical.ts:11 — the two spans are one implementation copied and then locally edited — 857 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:11
  • packages/mermaid/src/diagrams/c4/svgDraw.ts:215 · packages/mermaid/src/diagrams/sequence/svgDraw.js:1633 — the two spans are one implementation copied and then locally edited — 645 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/diagrams/c4/svgDraw.ts:215
  • packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:816 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:458 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:816
  • packages/mermaid/src/rendering-util/rendering-elements/shapes/icon.ts:1 · packages/mermaid/src/rendering-util/rendering-elements/shapes/iconRounded.ts:1 · packages/mermaid/src/rendering-util/rendering-elements/shapes/iconSquare.ts:1 — these 3 files are line-for-line copies of one another — 91 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — packages/mermaid/src/rendering-util/rendering-elements/shapes/icon.ts:1
  • packages/mermaid/src/diagrams/er/erDb.ts:39 · packages/mermaid/src/diagrams/requirement/requirementDb.ts:64 — the two spans are one implementation copied and then locally edited — 497 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/diagrams/er/erDb.ts:39
  • packages/mermaid/src/rendering-util/rendering-elements/clusters.js:56 · packages/mermaid/src/rendering-util/rendering-elements/clusters.js:339 — the two spans are one implementation copied and then locally edited — 592 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/rendering-util/rendering-elements/clusters.js:56
  • packages/mermaid-layout-tidy-tree/src/render.ts:11 · packages/mermaid/src/rendering-util/layout-algorithms/cose-bilkent/render.ts:13 — the two spans are one implementation copied and then locally edited — 549 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid-layout-tidy-tree/src/render.ts:11
  • packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:789 · packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:919 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:789
  • packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts:63 · packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts:133 — the two spans are one implementation copied and then locally edited — 478 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts:63
  • packages/mermaid/src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts:25 · packages/mermaid/src/rendering-util/rendering-elements/shapes/waveEdgedRectangle.ts:28 — the two spans are one implementation copied and then locally edited — 487 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts:25
  • packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1560 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:1120 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1560
  • packages/mermaid/src/diagrams/git/gitGraphAst.ts:112 · packages/mermaid/src/diagrams/git/gitGraphAst.ts:266 — the two spans are one implementation copied and then locally edited — 377 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/diagrams/git/gitGraphAst.ts:112
  • packages/mermaid/src/utils/lineWithOffset.ts:62 · packages/mermaid/src/utils/lineWithOffset.ts:124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. — packages/mermaid/src/utils/lineWithOffset.ts:62
  • packages/parser/src/language/railroad-peg/valueConverter.ts:5 · packages/parser/src/language/railroad/valueConverter.ts:5 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — packages/parser/src/language/railroad-peg/valueConverter.ts:5
  • packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:266 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:134 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:266
  • packages/mermaid/src/rendering-util/rendering-elements/shapes/browser.ts:10 · packages/mermaid/src/rendering-util/rendering-elements/shapes/console.ts:10 — the two spans are one implementation copied and then locally edited — 449 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/rendering-util/rendering-elements/shapes/browser.ts:10
  • packages/parser/src/language/railroad-ebnf/valueConverter.ts:5 · packages/parser/src/language/railroad-peg/valueConverter.ts:5 · packages/parser/src/language/railroad/valueConverter.ts:5 — the 3 copies are spread across 3 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — packages/parser/src/language/railroad-ebnf/valueConverter.ts:5
  • packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts:10 · packages/mermaid/src/rendering-util/rendering-elements/shapes/triangle.ts:12 — the two spans are one implementation copied and then locally edited — 447 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts:10
  • packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:737 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:388 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:737
  • packages/mermaid/src/diagrams/agentflow/types.ts:43 · packages/mermaid/src/diagrams/flowchart/types.ts:25 — the two spans are one implementation copied and then locally edited — 240 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/diagrams/agentflow/types.ts:43
  • packages/mermaid/src/diagrams/kanban/kanbanDb.ts:164 · packages/mermaid/src/diagrams/mindmap/mindmapDb.ts:114 — the two spans are one implementation copied and then locally edited — 246 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/diagrams/kanban/kanbanDb.ts:164
  • packages/mermaid/src/themes/theme-dark.js:166 · packages/mermaid/src/themes/theme-neutral.js:233 — the two spans are one implementation copied and then locally edited — 547 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/themes/theme-dark.js:166
  • packages/mermaid-example-diagram/src/mermaidUtils.ts:2 · packages/mermaid-zenuml/src/mermaidUtils.ts:3 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — packages/mermaid-example-diagram/src/mermaidUtils.ts:2
  • packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:446 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:260 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:446
  • packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1579 · packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1835 — the two spans are one implementation copied and then locally edited — 247 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1579
  • packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts:9 · packages/mermaid/src/rendering-util/rendering-elements/shapes/document.ts:9 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts:9
  • packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1158 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:756 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1158
  • packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:97 · packages/mermaid/src/diagrams/user-journey/journeyRenderer.ts:218 — the two spans are one implementation copied and then locally edited — 461 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:97
  • packages/mermaid/src/themes/theme-default.js:8 · packages/mermaid/src/themes/theme-neutral.js:11 — the two spans are one implementation copied and then locally edited — 321 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — packages/mermaid/src/themes/theme-default.js:8
  • packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1295 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:878 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1295

What to do

  • Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
R11 · Import Boundaries7.7 / 10Strong✓ Tool-verified

React / JS · Architecture — Conformance to the detected frontend architecture layout (feature-sliced / layered src) plus cross-package deep-import rules (D-386).

Method: Conformance to the detected frontend layout (feature-sliced / layered src) plus cross-package deep-import rules, over the module graph. Deterministic.

  • packages/mermaid/scripts/create-types-from-json-schema.mts:13 imports ajv/dist/2019.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/scripts/create-types-from-json-schema.mts:13
  • packages/mermaid/scripts/docs.mts:32 imports @adobe/jsonschema2md/lib/schemaProxy.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/scripts/docs.mts:32
  • packages/mermaid/scripts/docs.mts:34 imports @adobe/jsonschema2md/lib/traverseSchema.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/scripts/docs.mts:34
  • packages/mermaid/scripts/docs.mts:36 imports @adobe/jsonschema2md/lib/markdownBuilder.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/scripts/docs.mts:36
  • packages/mermaid/scripts/docs.mts:38 imports @adobe/jsonschema2md/lib/readmeBuilder.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/scripts/docs.mts:38
  • packages/mermaid/scripts/docs.mts:48 reaches into another package with a relative path (../../examples/src/index.js) — import the package by name instead. — packages/mermaid/scripts/docs.mts:48
  • packages/mermaid/scripts/layered-bench.ts:4 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/scripts/layered-bench.ts:4
  • packages/mermaid/scripts/layered-bench.ts:5 imports dagre-d3-es/src/dagre/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/scripts/layered-bench.ts:5
  • packages/mermaid/src/diagrams/block/renderHelpers.ts:1 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/diagrams/block/renderHelpers.ts:1
  • packages/mermaid/src/diagrams/class/classRenderer.js:2 imports dagre-d3-es/src/dagre/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/diagrams/class/classRenderer.js:2
  • packages/mermaid/src/diagrams/class/classRenderer.js:3 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/diagrams/class/classRenderer.js:3
  • packages/mermaid/src/diagrams/flowchart/flowChartShapes.js:1 imports dagre-d3-es/src/dagre-js/intersect/intersect-polygon.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/diagrams/flowchart/flowChartShapes.js:1
  • packages/mermaid/src/diagrams/flowchart/flowChartShapes.js:2 imports dagre-d3-es/src/dagre-js/intersect/intersect-rect.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/diagrams/flowchart/flowChartShapes.js:2
  • packages/mermaid/src/diagrams/state/stateRenderer.js:2 imports dagre-d3-es/src/dagre/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/diagrams/state/stateRenderer.js:2
  • packages/mermaid/src/diagrams/state/stateRenderer.js:3 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/diagrams/state/stateRenderer.js:3
  • packages/mermaid/src/rendering-util/createGraph.ts:2 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/rendering-util/createGraph.ts:2
  • packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:2 imports dagre-d3-es/src/dagre/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:2
  • packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:3 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:3
  • packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:3 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:3
  • packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:10 imports elkjs/lib/elk.bundled.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead. — packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:10
  • scripts/argos-upload-sheets.ts:15 imports e2e/helpers/argos-metadata.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — scripts/argos-upload-sheets.ts:15
  • scripts/screenshot-order.ts:20 imports e2e/helpers/argos-metadata.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — scripts/screenshot-order.ts:20
  • scripts/screenshot-sheets.ts:18 imports e2e/helpers/argos-metadata.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on. — scripts/screenshot-sheets.ts:18

What to do

  • Fix the listed violations: import through the target package's declared public entry rather than a deep path into its internals or a relative path into its directory (20 rows); move the shared test helper into a source directory production code may depend on (3 rows).
R2 · Cyclomatic Complexity6.0 / 10Adequate✓ Tool-verified

React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.

Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.

  • updateColors has cyclomatic complexity 289 and cognitive complexity 295; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/themes/theme-base.js:32
  • routeEdgesOrthogonal has cyclomatic complexity 287 and cognitive complexity 562; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141
  • updateColors has cyclomatic complexity 216 and cognitive complexity 221; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/themes/theme-redux-dark.js:76
  • updateColors has cyclomatic complexity 215 and cognitive complexity 220; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. (×2) — packages/mermaid/src/themes/theme-neo-dark.js:68, packages/mermaid/src/themes/theme-neo.js:52
  • updateColors has cyclomatic complexity 205 and cognitive complexity 210; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/themes/theme-redux.js:58
  • updateColors has cyclomatic complexity 203 and cognitive complexity 204; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/themes/theme-default.js:146
  • updateColors has cyclomatic complexity 200 and cognitive complexity 200; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/themes/theme-forest.js:113
  • updateColors has cyclomatic complexity 199 and cognitive complexity 201; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/themes/theme-redux-color.js:106
  • updateColors has cyclomatic complexity 195 and cognitive complexity 197; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/themes/theme-redux-dark-color.js:108
  • layered has cyclomatic complexity 190 and cognitive complexity 350; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:297
  • updateColors has cyclomatic complexity 189 and cognitive complexity 188; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/themes/theme-dark.js:115
  • validateLayout has cyclomatic complexity 180 and cognitive complexity 406; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:553
  • updateColors has cyclomatic complexity 173 and cognitive complexity 174; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/themes/theme-neutral.js:128
  • compoundLayout has cyclomatic complexity 89 and cognitive complexity 196; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:467
  • assignCoordinates has cyclomatic complexity 89 and cognitive complexity 133; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase4.coordinates.ts:42
  • position has cyclomatic complexity 83 and cognitive complexity 203; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2340
  • insertEdge has cyclomatic complexity 83 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/rendering-elements/edges.js:706
  • drawMessage has cyclomatic complexity 74 and cognitive complexity 90; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:461
  • positionGridEdgeLabels has cyclomatic complexity 64 and cognitive complexity 162; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:2207
  • routeCrossings has cyclomatic complexity 63 and cognitive complexity 153; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:155
  • layoutContainer has cyclomatic complexity 62 and cognitive complexity 88; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts:65
  • classBox has cyclomatic complexity 55 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/rendering-elements/shapes/classBox.ts:14
  • draw has cyclomatic complexity 54 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1043
  • writeBackToLayoutData has cyclomatic complexity 53 and cognitive complexity 125; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/helpers.ts:275
  • reduceCrossings has cyclomatic complexity 49 and cognitive complexity 77; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1965
  • sparseContainerSegment has cyclomatic complexity 48 and cognitive complexity 90; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:651
  • addVertex has cyclomatic complexity 48 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/diagrams/flowchart/flowDb.ts:188
  • collapseShortTerminalStub has cyclomatic complexity 47 and cognitive complexity 101; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/terminalStub.ts:44
  • addVertex has cyclomatic complexity 46 and cognitive complexity 70; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:322
  • buildOrthogonalPortPath has cyclomatic complexity 45 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:329
  • search has cyclomatic complexity 43 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts:309
  • erBox has cyclomatic complexity 43 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/rendering-elements/shapes/erBox.ts:19
  • (anonymous) has cyclomatic complexity 43 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid-layout-tidy-tree/src/layout.ts:465
  • apply has cyclomatic complexity 42 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/diagrams/sequence/sequenceDb.ts:557
  • routePath has cyclomatic complexity 41 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/rendering-elements/routePath.ts:130
  • anchorLabelsToPolyline has cyclomatic complexity 39 and cognitive complexity 68; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/labelAnchoring.ts:84
  • rank has cyclomatic complexity 39 and cognitive complexity 64; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:948
  • assignDemandCoordinates has cyclomatic complexity 39 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:424
  • drawArrow has cyclomatic complexity 38 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:653
R3 · Large Files5.7 / 10Adequate✓ Tool-verified

React / JS · Code Health — How many source files exceed the large-file threshold.

Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.

  • packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts has 2818 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts has 2651 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts has 2490 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts has 2404 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1
  • packages/mermaid/src/diagrams/agentflow/agentflowDb.ts has 2312 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts has 2165 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:1
  • packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts has 1982 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1
  • packages/mermaid/src/diagrams/sequence/svgDraw.js has 1954 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/sequence/svgDraw.js:1
  • packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts has 1381 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:1
  • packages/mermaid/src/diagrams/flowchart/flowDb.ts has 1375 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/flowchart/flowDb.ts:1
  • packages/mermaid/src/diagrams/git/gitGraphRenderer.ts has 1369 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts has 1212 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts has 1199 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts has 1131 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:1
  • packages/mermaid/src/rendering-util/rendering-elements/edges.js has 1093 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/rendering-elements/edges.js:1
  • packages/mermaid/src/rendering-util/rendering-elements/markers.js has 1055 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/rendering-elements/markers.js:1
  • packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts has 1040 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts has 1018 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:1
  • packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts has 971 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts:1
  • packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts has 965 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts:1
  • packages/mermaid/src/utils.ts has 896 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/utils.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts has 886 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:1
  • packages/mermaid/src/diagrams/gantt/ganttRenderer.js has 817 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/gantt/ganttRenderer.js:1
  • packages/mermaid/src/diagrams/gantt/ganttDb.js has 805 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/gantt/ganttDb.js:1
  • packages/mermaid/src/diagrams/class/classDb.ts has 796 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/class/classDb.ts:1
  • packages/mermaid/src/rendering-util/rendering-elements/clusters.js has 769 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/rendering-elements/clusters.js:1
  • packages/mermaid/src/diagrams/c4/c4Db.ts has 755 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/c4/c4Db.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js has 752 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:1
  • packages/mermaid/src/mermaidAPI.ts has 729 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/mermaidAPI.ts:1
  • packages/mermaid/src/diagrams/state/stateDb.ts has 713 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/state/stateDb.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts has 713 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts has 712 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts:1
  • packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts has 697 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts:1
  • scripts/screenshot-sheets.ts has 690 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — scripts/screenshot-sheets.ts:1
  • packages/mermaid/src/diagrams/sequence/sequenceDb.ts has 674 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/sequence/sequenceDb.ts:1
  • packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts has 654 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:1
  • packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts has 646 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts:1
  • packages/mermaid/src/diagrams/eventmodeling/db.ts has 616 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/eventmodeling/db.ts:1
  • packages/mermaid/src/rendering-util/rendering-elements/shapes.ts has 611 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/rendering-util/rendering-elements/shapes.ts:1
  • packages/mermaid/src/diagrams/architecture/architectureRenderer.ts has 598 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — packages/mermaid/src/diagrams/architecture/architectureRenderer.ts:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage9.7 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.

Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.

  • e2e/platform/bundle-test.js:2 imports './mermaid.esm.mjs', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — e2e/platform/bundle-test.js:2
  • e2e/platform/viewer.js:1 imports './mermaid-example-diagram.esm.mjs', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either (3 further unresolvable import(s) in the same file). The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing. — e2e/platform/viewer.js:1
  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×16) — packages/mermaid-layout-tidy-tree/src/render.ts:1, packages/mermaid-local-editor/static/js/renderer.js:1, packages/mermaid-local-editor/static/js/ui.js:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.

Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.

  • This repository declares test tooling, and the ✓ above records that declaration — but e2e/platform/bundle-test.js and 1 other test file(s) in this workspace cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to. — e2e/platform/bundle-test.js:2
R7 · Dead Code9.4 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).

Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.

  • 947 file(s) (~210120 LoC) were excluded from dead-code analysis. This package's entry point(s) resolved, but the walk stopped one hop in: packages/mermaid/src/diagrams/radar/db.ts imports '../../../../parser/dist/src/language/generated/ast.js', which is not in the scanned tree. That is usually a generated or build-output module, so reachability cannot see past it and no dead-code claim is made about this package. Nothing is necessarily wrong here. — packages/mermaid
  • 2 file(s) (~38 LoC) were excluded from dead-code analysis. This package's entry point(s) resolved, but the walk stopped one hop in: packages/mermaid-layout-elk/src/plugin.spec.ts imports '../dist/mermaid-layout-elk.core.mjs', which is not in the scanned tree. That is usually a generated or build-output module, so reachability cannot see past it and no dead-code claim is made about this package. Nothing is necessarily wrong here. — packages/mermaid-layout-elk
  • 75 file(s) (~4535 LoC) were excluded from dead-code analysis. This package's entry point(s) resolved, but the walk stopped one hop in: packages/parser/tests/eventmodeling.test.ts imports '../src/language/generated/ast.js', which is not in the scanned tree. That is usually a generated or build-output module, so reachability cannot see past it and no dead-code claim is made about this package. Nothing is necessarily wrong here. — packages/parser
  • Unreachable from the 1004 application, 19 tooling and 455 test entry point(s) detected in this repo. Gate removals on `pnpm run build` — an undetected custom entry would make these reachable.
  • no import path from any entry point (1004 application, 19 tooling, 455 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make — vitest.workspace.js
  • Nothing ultimately consumes this binding: its only referrer is the re-export in packages/mermaid-layout-tidy-tree/src/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in packages/mermaid-layout-tidy-tree/src/index.ts in the same commit, or the barrel will import a name that no longer exists. (×2) — packages/mermaid-layout-tidy-tree/src/layouts.ts:13, packages/mermaid-layout-tidy-tree/src/types.ts:67
  • Nothing ultimately consumes this binding: its only referrer is the re-export in packages/parser/src/language/common/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in packages/parser/src/language/common/index.ts in the same commit, or the barrel will import a name that no longer exists. — packages/parser/src/language/common/tokenBuilder.ts:31
  • This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. (×7) — e2e/platform/bundle-test.js:10, packages/mermaid/src/diagrams/mindmap/mindmapRenderer.ts:15, packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js:88, …
  • Nothing in its class calls or references this private method — no member access, no string key, no decorator, and no test reaches it by name. A private member cannot be called from outside its class, so this is the whole search: remove it, or call it where it was meant to be used. — packages/mermaid/src/diagrams/class/classDb.ts:514
  • Nothing in its class reads or assigns this private field (for a constructor parameter property: it is stored and never read), and no string key or test reaches it by name. Remove it, or use it where it was meant to take effect. — packages/mermaid/src/diagrams/xychart/chartBuilder/components/plot/index.ts:27

What to do

  • Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
R8 · Dependency Hygiene7.0 / 10Strong✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

  • Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×4)
  • Declared in packages/mermaid-layout-elk/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it. (×2)

What to do

  • Remove unused dependencies, declare unlisted imports explicitly, and demote type-/test-only packages to devDependencies.
R9 · Circular Imports10.0 / 10Exemplary✓ Tool-verified

React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.

Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.

S1 · Web-Security Posture8.0 / 10Strong✓ Tool-verified

Other · Security — Read from this repository's JavaScript/TypeScript source: cryptographic hygiene (weak hash or cipher, key material fixed in the source) and outbound TLS (certificate validation, protocol version) — facts about code that hold whether or not it serves anything itself. This repository commits the configuration that serves its own HTTP surface, so that configuration was read in full for the security response headers it sets. Of the server controls, two are read where the source shows them: every session or sign-in cookie the code sets is read for HttpOnly, Secure and SameSite at the line that sets it (a raw `Set-Cookie` header, Express, Fastify, Hono, Koa, Next.js, `cookie.serialize`, express-session and cookie-session), and every Node listener for HTTPS enforcement. HSTS, security response headers and input validation are NOT assessed for JavaScript/TypeScript: each is scored as an absence, an absence is only reportable over the production HTTP server, and in this ecosystem the file that opens the port is build output or a framework launcher rather than a file in the source tree. Their absence here is not a finding about this repository.

Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.

  • None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is configured — defense in depth, even when a reverse proxy could set them. This is reported because `netlify.toml` configures this repository's static hosting, including its response headers, so the configuration that would carry these headers is in this repository and was read in full. (−2.0 on this card.) — netlify.toml:1

What to do

  • Set security response headers on the surface this repository serves: an `add_header` directive per header in the nginx/Caddy/Apache config, a `_headers` / `vercel.json` / `netlify.toml` entry for a static host, or `helmet()` in the HTTP server. `Content-Security-Policy` is the one that pays for itself first — it is what contains an injected script once one reaches the page — followed by `X-Content-Type-Options: nosniff` and a frame policy (`X-Frame-Options: DENY`, or CSP `frame-ancestors`). Where the app is served from a build container, the header configuration belongs in the image beside the built assets, so it ships with them rather than depending on where it lands.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X16 · Unfloored truncation loop10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a loop that shortens a string until it fits a length budget has a floor — one with none grinds the value down to the empty string, or past it into a negative-length `Substring`.

Method: Roslyn syntax + semantics: while/do loops whose body's only effect on a string is to drop its last character, checked for whether anything — a direct comparison on the length, a body guard, a break — bounds that length below. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `while`/`do` loop whose body’s one assignment to a value is `x = x.slice(0, -1)` or `x = x.slice|substring|substr(0, x.length - 1)`, driven by a condition that reads `x.length` only as a term of a larger expression — never compared directly, never tested for truthiness, and with no other read of `x` — and whose body has no `break`, `return`, `throw` or `if` naming `x`. Deterministic, provable per finding. Advisory.

X17 · Uncapped recursion over a caller-supplied document2.2 / 10Critical✓ Tool-verified

Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.

Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.

  • `sanitize` is exported and takes `options: any` from its caller, and it calls itself at line 267 (`sanitize`) with a piece of `options` — and nowhere in `sanitize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/mermaid/src/config.ts:267
  • `sanitizeDirective` is exported, takes a document from its caller (line 108) and hands it to `sanitizeDirectiveValue`, which calls itself at line 49 (`sanitizeDirectiveValue`) with a piece of `args` (and at line 78) — and nowhere in `sanitizeDirectiveValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitizeDirectiveValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/mermaid/src/utils/sanitizeDirective.ts:49
  • `collectDescendantIds` is exported and takes `elkNode: any` from its caller, and it calls itself at line 1394 (`collectDescendantIds`) with a piece of `elkNode` — and nowhere in `collectDescendantIds` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `collectDescendantIds` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1394
  • `docTranslator` is exported and takes `node: Stmt` from its caller, and it calls itself at line 333 (`this.docTranslator`) with a piece of `node` (and at line 334, line 378) — and nowhere in `docTranslator` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `docTranslator` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/mermaid/src/diagrams/state/stateDb.ts:333
  • `flattenNodes` is exported and takes `node: MindmapNode` from its caller, and it calls itself at line 302 (`this.flattenNodes`) with a piece of `node` — and nowhere in `flattenNodes` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `flattenNodes` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/mermaid/src/diagrams/mindmap/mindmapDb.ts:302
  • `generateEdges` is exported and takes `node: MindmapNode` from its caller, and it calls itself at line 347 (`this.generateEdges`) with a piece of `node` — and nowhere in `generateEdges` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `generateEdges` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — packages/mermaid/src/diagrams/mindmap/mindmapDb.ts:347

What to do

  • Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
X2 · Cancellation propagation4.0 / 10Weak✓ Tool-verified

Other · Code Health — Whether async functions that make a cancellable request accept or pass on an AbortSignal (adoption curve).

Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.

  • Only 0/2 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
  • `download` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/mermaid/src/docs/.vitepress/scripts/fetch-avatars.ts:12
  • `fetchContributors` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — packages/mermaid/src/docs/.vitepress/scripts/fetch-contributors.ts:14

What to do

  • Thread an AbortSignal through async functions that make requests, so the work stops when its caller gives up.
X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation6.1 / 10Adequate✓ Tool-verified

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

  • `trace` at line 74 is called with an argument built by `JSON.stringify(node)` (line 74), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because trace is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/rendering-elements/clusters.js:74
  • `trace` at line 357 is called with an argument built by `JSON.stringify(node)` (line 357), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because trace is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/rendering-elements/clusters.js:357
  • `debug` at line 496 is called with an argument built by `JSON.stringify(outsidePoint)` (line 497), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/rendering-elements/edges.js:496
  • `debug` at line 812 is called with an argument built by `JSON.stringify(points, null, 2)` (line 815), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/rendering-elements/edges.js:812
  • `trace` at line 231 is called with an argument built by `JSON.stringify(node)` (line 231), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because trace is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/rendering-elements/clusters/swimlane.js:231
  • `debug` at line 1471 is called with an argument built by `JSON.stringify(issues.slice(0, 50))` (line 1477), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:1471
  • `debug` at line 2512 is called with an argument built by `JSON.stringify(points)` (line 2514), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:2512
  • `debug` at line 2577 is called with an argument built by `JSON.stringify(clippedPoints)` (line 2577), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:2577
  • `debug` at line 269 is called with an argument built by `JSON.stringify(e)` (line 269), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:269
  • `debug` at line 270 is called with an argument built by `JSON.stringify(graph.edge(e))` (line 270), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:270
  • `debug` at line 265 is called with an argument built by `JSON.stringify(graph.node(v))` (line 265), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/state/stateRenderer.js:265
  • `debug` at line 273 is called with an argument built by `JSON.stringify(graph.edge(e))` (line 273), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/state/stateRenderer.js:273
  • `debug` at line 387 is called with an argument built by `JSON.stringify(message)` (line 387), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/sequence/sequenceDb.ts:387
  • `debug` at line 427 is called with an argument built by `label.join(' ')` (line 427), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/git/gitGraphAst.ts:427
  • `debug` at line 210 is called with an argument built by `JSON.stringify(classRelation)` (line 210), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/class/classDb.ts:210
  • `debug` at line 211 is called with an argument built by `JSON.stringify(note)` (line 211), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/class/classRenderer.js:211
  • `debug` at line 242 is called with an argument built by `JSON.stringify(g.node(v))` (line 242), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/class/classRenderer.js:242
  • `debug` at line 258 is called with an argument built by `JSON.stringify(g.edge(e))` (line 258), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/class/classRenderer.js:258
  • `debug` at line 89 is called with an argument built by `JSON.stringify(cardinality_1_point)` (line 89), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/class/svgDraw.js:89
  • `debug` at line 90 is called with an argument built by `JSON.stringify(cardinality_2_point)` (line 90), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/class/svgDraw.js:90
  • `debug` at line 578 is called with an argument built by `JSON.stringify(conf, null, 2)` (line 578), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/c4/c4Renderer.ts:578
  • `debug` at line 112 is called with an argument built by `JSON.stringify(child.size)` (line 113), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/block/layout.ts:112
  • `debug` at line 362 is called with an argument built by `JSON.stringify(root, null, 2)` (line 362), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch. — packages/mermaid/src/diagrams/block/layout.ts:362

What to do

  • Each finding names the diagnostic call and the expression inside its argument whose cost scales with a collection. Confirm from the two that the argument is built before the call — that is JavaScript's evaluation order, not a guess — then put the construction behind the level check the logger offers (`if (logger.isLevelEnabled('debug'))` for pino and winston, `isDebugEnabled()` for log4js, the repository's own debug flag where it has one), or hand the logger the object and a format string (`logger.debug({ payload }, 'raw request')`) so the serialising happens only when the line is written. Moving the call is not the fix: it is the join/projection/stringify in the argument that is paid, wherever the call sits.
X24 · Document value interpolated into markup unescaped5.5 / 10Adequate✓ Tool-verified

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

  • `result.innerSvg` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — packages/mermaid-zenuml/src/zenumlRenderer.ts:81
  • `svg` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — packages/mermaid/src/mermaid.ts:186
  • `rules` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup. — packages/mermaid/src/mermaidAPI.ts:618

What to do

  • Each finding names the expression, the attribute it lands in and the line. Confirm the value's origin from the read this analyzer traced, then escape it at the sink or validate it against the shape the attribute accepts before interpolating.
X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 · Per-element action decided by a fixed element7.9 / 10Strong✓ Tool-verified

Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

  • This loop runs once per element of `points`, and the statement it guards acts on the element it is on — `point`. The test deciding whether that statement runs does not: `vertical` reads `points[index]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 94, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out. — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:97

What to do

  • Each finding names the test and the statement it guards, which index the same collection at two different subscripts — one fixed, one the loop variable. Confirm from the two, then decide which subscript the test meant. If it was meant to be per-element, give it the loop variable so each element is judged on itself. If it really is one answer for the whole collection, hoist the test OUT of the loop, where a reader can see it is asked once and where it is not re-evaluated on every pass — leaving it inside, reading a fixed element, is the one arrangement that cannot be right under either reading.
X3 · Exception handling6.5 / 10Adequate✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×3) — packages/mermaid/src/profiler.ts:198, packages/mermaid/src/profiler.ts:230, packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:686

What to do

  • Swallowed exception (empty catch)
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X5 · Nullable reference types4.5 / 10Weak✓ Tool-verified

Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • 9/13 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
  • ~17.2 `!` null assertions per 1k TypeScript source lines — 1889 assertion(s) across the 109611 source line(s) of the 611 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts (1075), packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts (313), packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts (66). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.

What to do

  • The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).

WCAG coverage — what static analysis assessed

Statically assessed 10 of 55 WCAG 2.2 Level A/AA success criteria (18%; ≈20% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 45 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only

Not statically assessed — these 45 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.1.1, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.1, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.3, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

Reference — by lens

The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.

LensScoreRatingImpact
Code Health44%Weak — gated by D1, D2, R10Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture91%ExemplaryStrongest area.
Maturity75%StrongSolid.
Readiness59%Adequate — gated by P5Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security66%Adequate — gated by D29Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Accessibility43%WeakLargest drag on the score — prioritise here.
Performance60%AdequateAcceptable, with room to improve.
Unscored — 3 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not included — 51 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No image/media element found in the parsed markup — AC1 not applicable here.
  • AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
  • AC5 ARIA correctness — No ARIA usage found in the parsed markup — AC5 not applicable here.
  • AX1 Captive dependencies — Not applicable: this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's TypeScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX2 Stateful singletons — Not applicable: TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — compose up failed (exit 15 — the compose project is invalid) — time="2026-11-14T09:34:11Z" level=warning msg="The \"MERMAID_PORT\" variable is not set. Defaulting to a blank string." time="2026-11-14T09:34:11Z" level=warning msg="The \"MERMAID_PORT\" variable is not set. Defaulting to a blank string." no port specified: :<empty>; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no data at rest for these controls to protect. If it does persist personal data (through a hosted backend configured outside this repository, for instance), the controls belong to wherever that data is stored.
  • C2 Access Controls — No access-control surface detected in the analyzed source — this repository stands up no server (no Express, Fastify, Koa, Hono, NestJS or similar app, no Next.js/SvelteKit/Nuxt server route, no edge function), creates no Supabase tables and talks to no hosted backend. Access control is therefore N/A here — a browser application or library is authorized by the server it calls, not by itself; a client-side route guard hides a page and authorizes nothing. If this codebase grows request handlers, the dimension reactivates and a default-deny posture is expected then.
  • C3 Audit Trail — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no sensitive data whose changes an audit trail would record. If it does (through a hosted backend configured outside this repository, for instance), the trail belongs to wherever that data is stored.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no personal data whose lifetime a retention limit would bound. If it does (through a hosted backend configured outside this repository, for instance), the limit belongs wherever that data is stored.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named field (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a TypeORM/MikroORM/sequelize-typescript/NestJS-Mongoose entity, a Mongoose schema, a Sequelize or Drizzle table, a Knex migration or a Prisma model — and no database or data-store client in the source either, so this repository keeps no personal data for a data subject to erase, export or consent over. If it does (through a hosted backend configured outside this repository, for instance), the rights are served wherever that data is stored.
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed TypeScript surface was not measured.
  • D25 ADR Conformance — no ADRs to check
  • D32 Data Compliance (PII/GDPR) — 14 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D4 Code Duplication — This repository's production source (.mts, .ts) is not read by D4's token comparison, which compares .NET source: duplication in it is measured by R10 Code Duplication, the frontend lens's card running the same clone algorithm over the JS/TS token stream. Not scored here — read the R10 card for this repository's duplication.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (1 domain event(s); its domain events are published by services or handlers — no domain entity raises one)
  • ED1 Event-Driven — not scored — this repository shows none of the 3 signals this lens looks for
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript source, so there is no service whose uptime a failing dependency could take down
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — coverage data present for 555 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for tinybench, mitata, benchmark.js, benny or vitest `bench(...)` calls in files that import them (or `*.bench.*` files), or one of those in a package.json, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • R5 Dependency Freshness — uses a pnpm lockfile — dependency freshness not measured here; JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — Not applicable: this check looks for a collection written by a callback on one thread while the body waiting on it touches it on another, and in this repository's languages no collection is reachable from two threads at once. TypeScript/JavaScript runs every callback on the one thread that owns its objects: a callback runs only when the body waiting on it has yielded, never alongside it, and a worker thread receives a COPY of what it is sent. A SharedArrayBuffer carries raw bytes, never an Array, Map or Set, so no collection is reachable from two threads at once. Not a gap in the analyzer and not a finding about your code.
  • X27 Collection changed while being enumerated — Not applicable: this check looks for a loop whose body adds to or removes from the very collection the loop is walking, invalidating the enumerator it holds, and in this repository's languages that cannot happen. JavaScript and TypeScript have no iterator that a change can invalidate: an `Array` is walked by index against its live length, and a `Map` or `Set` by the ECMAScript specification's live entry list, so a body that adds to, removes from or empties what it walks raises nothing — every loop form (`for…of`, `for…in`, `forEach`, `map`, `filter`, `reduce`, `entries()`) on every built-in collection (`Array`, `Map`, `Set`, plain objects, `URLSearchParams`, `Headers`, `FormData`) runs to completion. Such a loop can still skip an element or never end, which is a different defect and not the one this check asks about. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 82 finding(s)
D30 · Dependency Vulnerabilities · High CVE · ×50
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 25 more in this group — see findings.md.
D30 · Dependency Vulnerabilities · Critical CVE · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D28 · Secrets (history) · REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×3
  • Orphaned knowledge packages/mermaid/src/diagrams/sequence/sequenceDb.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge packages/mermaid/src/diagrams/railroad/railroadRenderer.ts:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
AC2 · Forms & labels · <input> without a programmatic label · ×2
  • <input> without a programmatic label .esbuild/dev-explorer/diagram-viewer.ts:1662 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <input> without a programmatic label packages/mermaid-local-editor/static/index.html:18 — This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
D10 · Test Quality · No assertions (empty test) · ×2
  • No assertions (empty test): should limit the number of relationships between the same two entities packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js:575 — Test method has an empty body — it asserts nothing and exercises no code.
  • No assertions (empty test): should not allow multiple relationships between the same two entities unless the roles are different packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js:579 — Test method has an empty body — it asserts nothing and exercises no code.
D30 · Dependency Vulnerabilities · High vulnerability · ×2
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <select> without a programmatic label · ×1
  • <select> without a programmatic label packages/mermaid-local-editor/static/index.html:17 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC2 · Forms & labels · <textarea> without a programmatic label · ×1
  • <textarea> without a programmatic label packages/mermaid-local-editor/static/index.html:27 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D31 · IaC & Container Security · High IaC · ×1
  • REDACTED
Serious — 1175 finding(s)
D10 · Test Quality · No assertions · ×119
  • No assertions: should add to mermaid packages/mermaid-layout-elk/src/plugin.spec.ts:13 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should handle an example-diagram definition packages/mermaid-example-diagram/src/exampleDiagram.spec.js:22 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should return a valid style for an empty type packages/mermaid/src/styles.spec.ts:72 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should return a valid style for diagram ${diagramId} and theme ${themeId} packages/mermaid/src/styles.spec.ts:109 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: (unnamed test) packages/mermaid/src/tests/util.ts:89 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: "${diagramId}" — two identical diagrams produce no duplicate element IDs packages/mermaid/src/rendering-util/multi-diagram-id-uniqueness.spec.ts:288 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: every registered diagram type has a uniqueness test or is explicitly excluded packages/mermaid/src/rendering-util/multi-diagram-id-uniqueness.spec.ts:350 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Level 2: validateLayout — quality breakdown is within reasonable thresholds packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/5-car-fun-sales-wide-tb.ddlt.spec.ts:200 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Level 2: validateLayout — quality breakdown baseline packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/6-legal-constr-sales.ddlt.spec.ts:114 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Level 2: validateLayout — quality breakdown is within reasonable thresholds packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/7-car-sales-constr.ddlt.spec.ts:87 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Level 2: validateLayout — quality breakdown is within reasonable thresholds packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/8-query-process-2.ddlt.spec.ts:233 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Level 2: validateLayout — quality breakdown is within reasonable thresholds packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/query-process.ddlt.spec.ts:173 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: Level 2: validateLayout — quality breakdown is within reasonable thresholds packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/simple-2.ddlt.spec.ts:137 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: super simple packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:17 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should handle relation definitions packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:61 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: hide empty description packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:74 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: handle "as" in state names packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:89 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: handle "as" in state names 1 packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:97 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: handle "as" in state names 2 packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:105 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: handle "as" in state names 3 packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:113 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: scale packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:144 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: description after second state packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:159 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: shall handle descriptions including minus signs packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:168 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should handle state statements packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:177 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: should handle recursive state definitions packages/mermaid/src/diagrams/state/stateDiagram-v2.spec.js:189 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • + 94 more in this group — see findings.md.
D17 · Explicit Debt · TodoComment · ×83
  • TodoComment scripts/tsc-check.ts:63 — // TODO: these don't import cleanly yet due to exotic tsconfig.json requirements — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid-zenuml/src/mermaidUtils.ts:4 — // Todo remove debug code — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid-example-diagram/src/mermaidUtils.ts:3 — // Todo remove debug code — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid-example-diagram/src/diagram-definition.ts:1 — // @ts-ignore: TODO Fix ts errors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/diagrams/xychart/xychartRenderer.ts:40 — // @ts-ignore: TODO Fix ts errors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/diagrams/quadrant-chart/quadrantRenderer.ts:56 — // @ts-ignore: TODO Fix ts errors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/diagrams/quadrant-chart/quadrantRenderer.ts:58 — // @ts-ignore: TODO Fix ts errors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/diagrams/quadrant-chart/quadrantRenderer.ts:61 — // @ts-ignore: TODO Fix ts errors — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/defaultConfig.ts:21 — // TODO: Should we replace these with `null` so that they can go in the JSON Schema? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaid.ts:198 — // TODO: We should be throwing an error object. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaidAPI.spec.ts:344 — // @todo TODO Can't figure out how to spy on the cssImportantStyles method. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaidAPI.spec.ts:384 — // TODO Can't figure out how to spy on the cssImportantStyles method. That would be a much better approach than manually checking the result. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaidAPI.spec.ts:413 — // @todo TODO if a single function in the module can be mocked, do it for createCssStyles and mock the results. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaidAPI.spec.ts:1129 — // { textDiagramType: 'C4Context', expectedType: 'c4' }, TODO : setAccTitle not called in C4 jison parser — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaidAPI.ts:5 — // @ts-ignore TODO: Investigate D3 issue — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:8 — // @ts-ignore TODO: Investigate D3 issue — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaidAPI.ts:152 — // sanitized by the sanitize CSS function TODO where is this method? what should be used to replace it? refactor so that it's always sanitized — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaidAPI.ts:170 — // TODO make a constant — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaidAPI.ts:171 — // TODO make a constant — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/mermaidAPI.ts:734 — // Todo merge with user options — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/styles.spec.ts:48 — // TODO: I'm pretty sure that even in SVG2, this isn't allowed to be a CSS — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/utils.ts:236 — // @ts-ignore TODO: Fix issue with curve type — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/utils.ts:719 — // @ts-ignore TODO: Fix D3 types — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/utils.ts:721 — // @ts-ignore TODO: Fix D3 types — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment packages/mermaid/src/utils.ts:758 — // TODO: Seed is only used for length? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • + 58 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×77
  • FunctionTooLong: router.routeEdgesOrthogonal packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141 — FunctionTooLong — routeEdgesOrthogonal runs 1314 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1214 over it, 13.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: wardleyRenderer.draw packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts:67 — FunctionTooLong — draw runs 759 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 659 over it, 7.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: materializedGeometry.resolveRenderedOrthogonalCrossings packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1915 — FunctionTooLong — resolveRenderedOrthogonalCrossings runs 726 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 626 over it, 7.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: ganttRenderer.draw packages/mermaid/src/diagrams/gantt/ganttRenderer.js:85 — FunctionTooLong — draw runs 519 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 419 over it, 5.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: compound.compoundLayout packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:467 — FunctionTooLong — compoundLayout runs 476 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 376 over it, 4.76× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: layered.layered packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:297 — FunctionTooLong — layered runs 438 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 338 over it, 4.38× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: renderer.draw packages/mermaid/src/diagrams/treemap/renderer.ts:24 — FunctionTooLong — draw runs 362 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 262 over it, 3.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: sequenceRenderer.draw packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1043 — FunctionTooLong — draw runs 339 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 239 over it, 3.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: routerSearch.search packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts:309 — FunctionTooLong — search runs 330 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 230 over it, 3.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: layered.reduceCrossings packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1965 — FunctionTooLong — reduceCrossings runs 286 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 186 over it, 2.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: materializedGeometry.separateSharedRenderedTerminalLanes packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:48 — FunctionTooLong — separateSharedRenderedTerminalLanes runs 268 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 168 over it, 2.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: materializedGeometry.reassignCrossingExternalRailChannels packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1290 — FunctionTooLong — reassignCrossingExternalRailChannels runs 268 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 168 over it, 2.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: edges.insertEdge packages/mermaid/src/rendering-util/rendering-elements/edges.js:706 — FunctionTooLong — insertEdge runs 268 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 168 over it, 2.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: cynefinRenderer.draw packages/mermaid/src/diagrams/cynefin/cynefinRenderer.ts:71 — FunctionTooLong — draw runs 265 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 165 over it, 2.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: labelAnchoring.anchorLabelsToPolyline packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/labelAnchoring.ts:84 — FunctionTooLong — anchorLabelsToPolyline runs 244 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 144 over it, 2.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: phase4.coordinates.assignCoordinates packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase4.coordinates.ts:42 — FunctionTooLong — assignCoordinates runs 239 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 139 over it, 2.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: erBox.erBox packages/mermaid/src/rendering-util/rendering-elements/shapes/erBox.ts:19 — FunctionTooLong — erBox runs 230 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 130 over it, 2.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: sequenceRenderer.drawMessage packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:461 — FunctionTooLong — drawMessage runs 215 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 115 over it, 2.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: compound.routeCrossings packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:155 — FunctionTooLong — routeCrossings runs 214 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 114 over it, 2.14× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: sharedTrackNudging.nudgeSharedInteriorSubpaths packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/sharedTrackNudging.ts:13 — FunctionTooLong — nudgeSharedInteriorSubpaths runs 213 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 113 over it, 2.13× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: layered.position packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2340 — FunctionTooLong — position runs 197 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 97 over it, 1.97× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: layoutCore.layoutContainer packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts:65 — FunctionTooLong — layoutContainer runs 193 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 93 over it, 1.93× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: layered.assignTracks packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1561 — FunctionTooLong — assignTracks runs 191 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 91 over it, 1.91× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: usecaseDb.getData packages/mermaid/src/diagrams/usecase/usecaseDb.ts:295 — FunctionTooLong — getData runs 188 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 88 over it, 1.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: classBox.classBox packages/mermaid/src/rendering-util/rendering-elements/shapes/classBox.ts:14 — FunctionTooLong — classBox runs 188 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 88 over it, 1.88× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 52 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×42
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 443 in router.routeEdgesOrthogonal at line 141. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/themes/theme-redux-color.js packages/mermaid/src/themes/theme-redux-color.js:106 — packages/mermaid/src/themes/theme-redux-color.js changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 195 in Theme.updateColors at line 106. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/themes/theme-redux-color.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/rendering-elements/edges.js packages/mermaid/src/rendering-util/rendering-elements/edges.js:706 — packages/mermaid/src/rendering-util/rendering-elements/edges.js changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in edges.insertEdge at line 706. 16 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/rendering-elements/edges.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:553 — packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 192 in validateLayout.validateLayout at line 553. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/themes/theme-redux-dark-color.js packages/mermaid/src/themes/theme-redux-dark-color.js:108 — packages/mermaid/src/themes/theme-redux-dark-color.js changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 192 in Theme.updateColors at line 108. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/themes/theme-redux-dark-color.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1915 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 158 in materializedGeometry.resolveRenderedOrthogonalCrossings at line 1915. 9 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:2207 — packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 72 in edgeLabels.positionGridEdgeLabels at line 2207. 10 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:424 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in routerPlanning.assignDemandCoordinates at line 424. 13 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/diagrams/flowchart/flowDb.ts packages/mermaid/src/diagrams/flowchart/flowDb.ts:188 — packages/mermaid/src/diagrams/flowchart/flowDb.ts changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in FlowDB.addVertex at line 188. 9 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/diagrams/flowchart/flowDb.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:153 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 60 in routerSparse.sparseSameContainerRoute at line 153. 5 of those changes were fix/bug commits, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/themes/theme-neo.js packages/mermaid/src/themes/theme-neo.js:52 — packages/mermaid/src/themes/theme-neo.js changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 213 in Theme.updateColors at line 52. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/themes/theme-neo.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/themes/theme-redux.js packages/mermaid/src/themes/theme-redux.js:58 — packages/mermaid/src/themes/theme-redux.js changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 202 in Theme.updateColors at line 58. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/themes/theme-redux.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1966 — packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in render.applyElkEdgeLayout at line 1966. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:1033 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in routerCompatibility.prepareRoutingModes at line 1033. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts:309 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 93 in routerSearch.search at line 309. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/themes/theme-neo-dark.js packages/mermaid/src/themes/theme-neo-dark.js:68 — packages/mermaid/src/themes/theme-neo-dark.js changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 213 in Theme.updateColors at line 68. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/themes/theme-neo-dark.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/themes/theme-redux-dark.js packages/mermaid/src/themes/theme-redux-dark.js:76 — packages/mermaid/src/themes/theme-redux-dark.js changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 213 in Theme.updateColors at line 76. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/themes/theme-redux-dark.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts:399 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in GridEdgeRoutingSession.routePlan at line 399. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts:65 — packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in layoutCore.layoutContainer at line 65. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/diagrams/agentflow/agentflowDb.ts packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:322 — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in AgentFlowDB.addVertex at line 322. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/diagrams/agentflow/agentflowDb.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/grid/placement.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/placement.ts:84 — packages/mermaid/src/rendering-util/layout-algorithms/grid/placement.ts changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in placement.readGridConfig at line 84. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/grid/placement.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/mermaidAPI.ts packages/mermaid/src/mermaidAPI.ts:478 — packages/mermaid/src/mermaidAPI.ts changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in mermaidAPI.renderDiagram at line 478. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/mermaidAPI.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:1099 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in routerTopology.buildEndpointRoutingOverlay at line 1099. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/helpers.ts packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/helpers.ts:275 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/helpers.ts changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 39 in helpers.writeBackToLayoutData at line 275. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/helpers.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/lrTransform.ts packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/lrTransform.ts:269 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/lrTransform.ts changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in lrTransform.applyLrDirectionTransform at line 269. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/lrTransform.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • + 17 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×33
  • FileTooLong: direction/materializedGeometry.ts packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts — FileTooLong — 2063 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1563 over it, 4.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: layered/layered.ts packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts — FileTooLong — 1914 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1414 over it, 3.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: grid/edgeLabels.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts — FileTooLong — 1883 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1383 over it, 3.77× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: elk/render.ts packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts — FileTooLong — 1753 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1253 over it, 3.51× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: sequence/svgDraw.js packages/mermaid/src/diagrams/sequence/svgDraw.js — FileTooLong — 1528 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 1028 over it, 3.06× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: sequence/sequenceRenderer.ts packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts — FileTooLong — 1509 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1009 over it, 3.02× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: agentflow/agentflowDb.ts packages/mermaid/src/diagrams/agentflow/agentflowDb.ts — FileTooLong — 1445 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: AgentFlowDB (188-2478). The bar is 500 significant lines; this is 945 over it, 2.89× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: orthogonalRouter/router.ts packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts — FileTooLong — 1394 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: routeEdgesOrthogonal (141-2382). The bar is 500 significant lines; this is 894 over it, 2.79× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: git/gitGraphRenderer.ts packages/mermaid/src/diagrams/git/gitGraphRenderer.ts — FileTooLong — 1096 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 596 over it, 2.19× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: rendering-elements/markers.js packages/mermaid/src/rendering-util/rendering-elements/markers.js — FileTooLong — 1019 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 519 over it, 2.04× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: grid/routerCompatibility.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts — FileTooLong — 975 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 475 over it, 1.95× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: flowchart/flowDb.ts packages/mermaid/src/diagrams/flowchart/flowDb.ts — FileTooLong — 949 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: FlowDB (98-1499). The bar is 500 significant lines; this is 449 over it, 1.90× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: grid/routerTopology.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts — FileTooLong — 923 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 423 over it, 1.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: grid/routerPlanning.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts — FileTooLong — 884 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 384 over it, 1.77× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: layout-utils/validateLayout.ts packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts — FileTooLong — 879 significant lines (blank, comment-only and punctuation-only lines excluded), about 65% of them inside a single declaration: validateLayout (553-1481). The bar is 500 significant lines; this is 379 over it, 1.76× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: layered/compound.ts packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts — FileTooLong — 851 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 351 over it, 1.70× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: rendering-elements/edges.js packages/mermaid/src/rendering-util/rendering-elements/edges.js — FileTooLong — 820 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 320 over it, 1.64× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: parser/usecaseModelBuilder.ts packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts — FileTooLong — 817 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: UsecaseModelBuilder (172-1050). The bar is 500 significant lines; this is 317 over it, 1.63× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: wardley/wardleyRenderer.ts packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts — FileTooLong — 813 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: draw (67-1067). The bar is 500 significant lines; this is 313 over it, 1.63× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: parser/usecase.visitor.ts packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts — FileTooLong — 774 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: UsecaseVisitor (68-975). The bar is 500 significant lines; this is 274 over it, 1.55× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: grid/routerSparse.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts — FileTooLong — 690 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 190 over it, 1.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: grid/routerSession.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts — FileTooLong — 582 significant lines (blank, comment-only and punctuation-only lines excluded), about 75% of them inside a single declaration: GridEdgeRoutingSession (177-736). The bar is 500 significant lines; this is 82 over it, 1.16× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: grid/routerSearch.ts packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts — FileTooLong — 579 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 79 over it, 1.16× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: dagre/index.js packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js — FileTooLong — 578 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 78 over it, 1.16× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: rendering-elements/clusters.js packages/mermaid/src/rendering-util/rendering-elements/clusters.js — FileTooLong — 578 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 78 over it, 1.16× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 8 more in this group — see findings.md.
R11 · Import Boundaries · Boundary violation [package · ×23
  • Boundary violation [package:third-party-deep-import] packages/mermaid/scripts/create-types-from-json-schema.mts:13 — packages/mermaid/scripts/create-types-from-json-schema.mts:13 imports ajv/dist/2019.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/scripts/docs.mts:32 — packages/mermaid/scripts/docs.mts:32 imports @adobe/jsonschema2md/lib/schemaProxy.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/scripts/docs.mts:34 — packages/mermaid/scripts/docs.mts:34 imports @adobe/jsonschema2md/lib/traverseSchema.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/scripts/docs.mts:36 — packages/mermaid/scripts/docs.mts:36 imports @adobe/jsonschema2md/lib/markdownBuilder.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/scripts/docs.mts:38 — packages/mermaid/scripts/docs.mts:38 imports @adobe/jsonschema2md/lib/readmeBuilder.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:relative-cross-package] packages/mermaid/scripts/docs.mts:48 — packages/mermaid/scripts/docs.mts:48 reaches into another package with a relative path (../../examples/src/index.js) — import the package by name instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/scripts/layered-bench.ts:4 — packages/mermaid/scripts/layered-bench.ts:4 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/scripts/layered-bench.ts:5 — packages/mermaid/scripts/layered-bench.ts:5 imports dagre-d3-es/src/dagre/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/diagrams/block/renderHelpers.ts:1 — packages/mermaid/src/diagrams/block/renderHelpers.ts:1 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/diagrams/class/classRenderer.js:2 — packages/mermaid/src/diagrams/class/classRenderer.js:2 imports dagre-d3-es/src/dagre/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/diagrams/class/classRenderer.js:3 — packages/mermaid/src/diagrams/class/classRenderer.js:3 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/diagrams/flowchart/flowChartShapes.js:1 — packages/mermaid/src/diagrams/flowchart/flowChartShapes.js:1 imports dagre-d3-es/src/dagre-js/intersect/intersect-polygon.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/diagrams/flowchart/flowChartShapes.js:2 — packages/mermaid/src/diagrams/flowchart/flowChartShapes.js:2 imports dagre-d3-es/src/dagre-js/intersect/intersect-rect.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/diagrams/state/stateRenderer.js:2 — packages/mermaid/src/diagrams/state/stateRenderer.js:2 imports dagre-d3-es/src/dagre/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/diagrams/state/stateRenderer.js:3 — packages/mermaid/src/diagrams/state/stateRenderer.js:3 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/rendering-util/createGraph.ts:2 — packages/mermaid/src/rendering-util/createGraph.ts:2 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:2 — packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:2 imports dagre-d3-es/src/dagre/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:3 — packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:3 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:3 — packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:3 imports dagre-d3-es/src/graphlib/index.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:third-party-deep-import] packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:10 — packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:10 imports elkjs/lib/elk.bundled.js, reaching past a declared dependency's public entry into its build output — that path is the package's toolchain layout, not its API, and a minor version bump can relocate it with no semver signal. Import from the package's documented entry point instead.
  • Boundary violation [package:test-suite-dependency] scripts/argos-upload-sheets.ts:15 — scripts/argos-upload-sheets.ts:15 imports e2e/helpers/argos-metadata.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
  • Boundary violation [package:test-suite-dependency] scripts/screenshot-order.ts:20 — scripts/screenshot-order.ts:20 imports e2e/helpers/argos-metadata.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
  • Boundary violation [package:test-suite-dependency] scripts/screenshot-sheets.ts:18 — scripts/screenshot-sheets.ts:18 imports e2e/helpers/argos-metadata.ts, a module inside the test suite — test helpers carry no compatibility contract and are maintained for the suite, not as an API, so production code that depends on one is coupled to a module nobody keeps stable. Move the shared helper into a source directory both layers may depend on.
D3 · God Classes · MethodTooLong · ×18
  • MethodTooLong: UsecaseParser.constructor packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts:134 — MethodTooLong — constructor runs 340 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 240 over it, 3.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-base.js:32 — MethodTooLong — updateColors runs 333 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 233 over it, 3.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-forest.js:113 — MethodTooLong — updateColors runs 272 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 172 over it, 2.72× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-default.js:146 — MethodTooLong — updateColors runs 269 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 169 over it, 2.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-redux-dark.js:76 — MethodTooLong — updateColors runs 268 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 168 over it, 2.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-neo.js:52 — MethodTooLong — updateColors runs 261 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 161 over it, 2.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-dark.js:115 — MethodTooLong — updateColors runs 259 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 159 over it, 2.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-redux.js:58 — MethodTooLong — updateColors runs 259 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 159 over it, 2.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-neo-dark.js:68 — MethodTooLong — updateColors runs 258 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 158 over it, 2.58× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-redux-dark-color.js:108 — MethodTooLong — updateColors runs 255 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 155 over it, 2.55× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-neutral.js:128 — MethodTooLong — updateColors runs 247 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 147 over it, 2.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.updateColors packages/mermaid/src/themes/theme-redux-color.js:106 — MethodTooLong — updateColors runs 246 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 146 over it, 2.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: GridEdgeRoutingSession.routePlan packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts:399 — MethodTooLong — routePlan runs 224 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AgentFlowDB.getData packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1671 — MethodTooLong — getData runs 168 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 68 over it, 1.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: FlowDB.getData packages/mermaid/src/diagrams/flowchart/flowDb.ts:1228 — MethodTooLong — getData runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SequenceDB.apply packages/mermaid/src/diagrams/sequence/sequenceDb.ts:557 — MethodTooLong — apply runs 147 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 47 over it, 1.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Theme.constructor packages/mermaid/src/themes/theme-default.js:9 — MethodTooLong — constructor runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ClassDB.getData packages/mermaid/src/diagrams/class/classDb.ts:748 — MethodTooLong — getData runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
R4 · Test Coverage · No test reaches this file · ×16
  • No test reaches this file packages/mermaid-layout-tidy-tree/src/render.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-local-editor/static/js/renderer.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-local-editor/static/js/ui.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-local-editor/static/js/navigation.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-local-editor/static/app.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-example-diagram/src/exampleDiagramRenderer.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/parser/scripts/prepack.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-local-editor/static/js/storage.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-example-diagram/src/styles.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-local-editor/static/js/config.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-example-diagram/src/detector.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-zenuml/src/detector.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-zenuml/src/zenuml-definition.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-layout-tidy-tree/src/layouts.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file packages/mermaid-zenuml/src/parser.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file vitest.workspace.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D15 · Churn × Complexity Hotspots · Repeated repair · ×15
  • Repeated repair: packages/mermaid/src/rendering-util/rendering-elements/edgeStepAnimation.ts packages/mermaid/src/rendering-util/rendering-elements/edgeStepAnimation.ts:88 — packages/mermaid/src/rendering-util/rendering-elements/edgeStepAnimation.ts changed 17 times in last 90 days and 10 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is edgeStepAnimation.escapeCssIdentifierFallback at line 88), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(flowchart): reserve badge space only at edge ends that draw an arrowhead”; “fix(flowchart): keep step badges clear of the arrowhead base”; “fix(flowchart): collect step badge obstacles once per diagram”; “fix(flowchart): hide the step highlight from assistive technology”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/rendering-elements/edgeStepAnimation.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts:130 — packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts changed 6 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is index.createCommonLayoutRenderer.render at line 130), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “Fix label overlap bug”; “fix(class): centre end cardinalities like start ones”; “fix(class): place cardinality labels beside their ends with the ELK layout”; “fix(rendering): clip an edge for the engine that drew it”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/diagrams/flowchart/styles.ts packages/mermaid/src/diagrams/flowchart/styles.ts:49 — packages/mermaid/src/diagrams/flowchart/styles.ts changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is styles.genColor at line 49), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(themes): fill handDrawn lane bodies, and pin tsc-check's floating deps”; “fix(themes): emit a palette rule for every slot that can be stamped”; “fix(flowchart): give subgraph colour slots real source order, and close two seams”; “fix(themes): address review on class and flowchart palette”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/diagrams/flowchart/styles.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/diagrams/er/styles.ts packages/mermaid/src/diagrams/er/styles.ts:64 — packages/mermaid/src/diagrams/er/styles.ts changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 10 (its worst body is styles.getStyles at line 64), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “refactor: hand the ER/requirement CSS-generation fixes to a standalone PR”; “fix(themes): validate look in the ER and requirement stylesheets”; “fix(themes): clear four pre-existing defects the default flip makes visible”; “fix(er): guard an empty border palette, and tighten the palette CSS spec”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/diagrams/er/styles.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/diagrams/common/colorThemeGate.ts packages/mermaid/src/diagrams/common/colorThemeGate.ts:86 — packages/mermaid/src/diagrams/common/colorThemeGate.ts changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is colorThemeGate.colorSlotCount at line 86), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(themes): derive the slot count from the palette, not from a bound”; “fix(themes): keep colorSlotCount's result usable as a loop bound”; “fix(themes): emit a palette rule for every slot that can be stamped”; “fix(flowchart): give subgraph colour slots real source order, and close two seams”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/diagrams/common/colorThemeGate.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/rendering-util/createGraph.ts packages/mermaid/src/rendering-util/createGraph.ts:123 — packages/mermaid/src/rendering-util/createGraph.ts changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is createGraph.createGraphWithElements at line 123), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: orient fork/join bars by flow direction under ELK layout”; “fix: restore edgePaths class on the edge group (#8125)”; “fix(rendering-util): use the generated DOM id for container clusters, and let layouts ask how to measure cluster labels”; “fix(rendering-util): measure ELK cluster labels unwrapped”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/createGraph.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/postProcessing.ts packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/postProcessing.ts:43 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/postProcessing.ts changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is postProcessing.postProcessSwimlaneLayout at line 43), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(swimlane): draw an edge between aligned cross-lane nodes straight”; “fix(swimlane): leave a diamond at its vertex and enter a face centre”; “fix(swimlanes): move lane title bands clear of rails in lanes with no direction”; “fix(swimlanes): split shared terminal lanes again after crossing cleanup”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/postProcessing.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/diagrams/block/styles.ts packages/mermaid/src/diagrams/block/styles.ts:41 — packages/mermaid/src/diagrams/block/styles.ts changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is styles.genColor at line 41), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(block): take the node border width from the theme”; “fix(block): colour composites only, matching the flowchart”; “fix(block): apply the redux colour palette to block diagrams”; “fix: restore edgePaths class on the edge group (#8125)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/diagrams/block/styles.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/rendering-util/rendering-elements/shapes/question.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/question.ts:20 — packages/mermaid/src/rendering-util/rendering-elements/shapes/question.ts changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is question.question at line 20), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(flowchart): size non-rectangular shapes from the label's height too”; “fix(flowchart): preserve stadium caps and exempt selected shapes from label wrapping”; “fix(elk): address review on #8152”; “fix(rendering): drop the half-pixel bias in intersectLine”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/rendering-elements/shapes/question.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/diagrams/requirement/styles.js packages/mermaid/src/diagrams/requirement/styles.js:50 — packages/mermaid/src/diagrams/requirement/styles.js changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is styles.getStyles at line 50), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “refactor: hand the ER/requirement CSS-generation fixes to a standalone PR”; “fix(themes): validate look in the ER and requirement stylesheets”; “fix(themes): clear four pre-existing defects the default flip makes visible”; “fix(er, requirement): stop emitting invalid CSS for the colour-theme palettes”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/diagrams/requirement/styles.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: scripts/tsc-check.ts scripts/tsc-check.ts:152 — scripts/tsc-check.ts changed 5 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is tsc-check.main at line 152), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “Use fix of failing tsc-check from #8180”; “fix(ci): pin tsc-check's type dependencies to what mermaid declares”; “fix(themes): fill handDrawn lane bodies, and pin tsc-check's floating deps”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- scripts/tsc-check.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/rendering-util/layout-algorithms/layered/render.ts packages/mermaid/src/rendering-util/layout-algorithms/layered/render.ts:39 — packages/mermaid/src/rendering-util/layout-algorithms/layered/render.ts changed 4 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 8 (its worst body is render.copyPlain at line 39), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(layered): wide subgraph titles, subgraph-to-member edges, self-nested subgraphs”; “fix(layered): address review on the layered layout PR”; “fix(layered): restore nested fields and keep render options on dagre fallback”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/layout-algorithms/layered/render.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/rendering-util/rendering-elements/shapes/circle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/circle.ts:10 — packages/mermaid/src/rendering-util/rendering-elements/shapes/circle.ts changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is circle.circle at line 10), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(flowchart): size circles from their label, not minNodeWidth”; “fix(flowchart): size non-rectangular shapes from the label's height too”; “fix(flowchart): preserve stadium caps and exempt selected shapes from label wrapping”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/rendering-elements/shapes/circle.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/rendering-util/rendering-elements/shapes/doubleCircle.ts packages/mermaid/src/rendering-util/rendering-elements/shapes/doubleCircle.ts:10 — packages/mermaid/src/rendering-util/rendering-elements/shapes/doubleCircle.ts changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is doubleCircle.doublecircle at line 10), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(flowchart): size circles from their label, not minNodeWidth”; “fix(flowchart): size non-rectangular shapes from the label's height too”; “fix(flowchart): preserve stadium caps and exempt selected shapes from label wrapping”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/rendering-util/rendering-elements/shapes/doubleCircle.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: packages/mermaid/src/diagrams/block/renderHelpers.ts packages/mermaid/src/diagrams/block/renderHelpers.ts:215 — packages/mermaid/src/diagrams/block/renderHelpers.ts changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is renderHelpers.insertEdges at line 215), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(block): colour composites only, matching the flowchart”; “fix(block): apply the redux colour palette to block diagrams”; “Fixed block rendering due to failing SS in applitools”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-15..2026-11-13, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-15 13:01:32 +00:00' --until='2026-11-13 13:01:32 +00:00' --full-history --no-merges -- packages/mermaid/src/diagrams/block/renderHelpers.ts`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
D10 · Test Quality · Skipped test · ×14
  • Skipped test: markdownToLines - No auto wrapping packages/mermaid/src/rendering-util/handle-markdown-text.spec.ts:207 — Skipped — switched off by test.skip
  • Skipped test: continues reroute scanning against current edge points after each fix packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/__tests__/postProcessing.spec.ts:83 — Skipped — switched off by it.skip
  • Skipped test: should handle if statements packages/mermaid/src/diagrams/state/stateDiagram.spec.js:384 — Skipped — switched off by it.skip
  • Skipped test: should reset a branch packages/mermaid/src/diagrams/git/gitGraph.spec.ts:92 — Skipped — switched off by it.skip
  • Skipped test: reset can take an argument packages/mermaid/src/diagrams/git/gitGraph.spec.ts:111 — Skipped — switched off by it.skip
  • Skipped test: should handle fast forwardable merges packages/mermaid/src/diagrams/git/gitGraph.spec.ts:131 — Skipped — switched off by it.skip
  • Skipped test: should handle ff merge when history walk has two parents (merge commit) packages/mermaid/src/diagrams/git/gitGraph.spec.ts:191 — Skipped — switched off by it.skip
  • Skipped test: it should handle huge diagrams packages/mermaid/src/diagrams/flowchart/parser/flow-huge.spec.js:17 — Skipped — switched off by it.skip
  • Skipped test: should be possible to use @ syntax to add labels with trail spaces packages/mermaid/src/diagrams/flowchart/parser/flow-node-data.spec.js:556 — Skipped — switched off by it.skip
  • Skipped test: should handle subgraph without id and space in title packages/mermaid/src/diagrams/flowchart/parser/subgraph.spec.js:64 — Skipped — switched off by it.skip
  • Skipped test: [skipped test] can contain àáâäæãåā packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js:124 — Skipped — switched off by it.skip
  • Skipped test: should handle a leading newline packages/mermaid/src/diagrams/class/classDiagram.spec.ts:293 — Skipped — switched off by it.skip
  • Skipped test: should handle arrowMarkerAbsolute explicitly set to "false" as false e2e/other/pr-check/configuration.spec.js:55 — Skipped — switched off by test.skip
  • Skipped test: (unnamed test) e2e/other/pr-check/dev-explorer-compare.spec.ts:11 — Skipped — switched off by test.skip
D30 · Dependency Vulnerabilities · Medium CVE · ×13
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D3 · God Classes · ClassTooLong · ×10
  • ClassTooLong: AgentFlowDB packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:188 — ClassTooLong — 1319 significant lines (blank, comment-only and punctuation-only lines excluded), 77 methods. The bar is 400 significant lines; this is 919 over it, 3.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: FlowDB packages/mermaid/src/diagrams/flowchart/flowDb.ts:98 — ClassTooLong — 872 significant lines (blank, comment-only and punctuation-only lines excluded), 51 methods. The bar is 400 significant lines; this is 472 over it, 2.18× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: UsecaseVisitor packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts:68 — ClassTooLong — 716 significant lines (blank, comment-only and punctuation-only lines excluded), 70 methods. The bar is 400 significant lines; this is 316 over it, 1.79× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: UsecaseModelBuilder packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:172 — ClassTooLong — 677 significant lines (blank, comment-only and punctuation-only lines excluded), 51 methods. The bar is 400 significant lines; this is 277 over it, 1.69× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: validateLayout packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:1 — ClassTooLong — 573 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods. The bar is 400 significant lines; this is 173 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ClassDB packages/mermaid/src/diagrams/class/classDb.ts:37 — ClassTooLong — 529 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 129 over it, 1.32× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SequenceDB packages/mermaid/src/diagrams/sequence/sequenceDb.ts:115 — ClassTooLong — 441 significant lines (blank, comment-only and punctuation-only lines excluded), 35 methods. The bar is 400 significant lines; this is 41 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: layered packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1 — ClassTooLong — 438 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 38 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GridEdgeRoutingSession packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts:177 — ClassTooLong — 436 significant lines (blank, comment-only and punctuation-only lines excluded), 12 methods. The bar is 400 significant lines; this is 36 over it, 1.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: UsecaseParser packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts:84 — ClassTooLong — 409 significant lines (blank, comment-only and punctuation-only lines excluded), 5 methods. The bar is 400 significant lines; this is 9 over it, 1.02× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D8 · Code Coverage · Low coverage · ×9
  • Low coverage: .build/jisonTransformer.ts .build/jisonTransformer.ts:1 — 20.0% line coverage (1/5).
  • Low coverage: .build/jsonSchema.ts .build/jsonSchema.ts:1 — 12.9% line coverage (4/31).
  • Low coverage: .esbuild/jisonPlugin.ts .esbuild/jisonPlugin.ts:1 — 20.0% line coverage (1/5).
  • Low coverage: .esbuild/jsonSchemaPlugin.ts .esbuild/jsonSchemaPlugin.ts:1 — 9.1% line coverage (1/11).
  • Low coverage: packages/mermaid/scripts/docs.mts packages/mermaid/scripts/docs.mts:1 — 37.6% line coverage (89/237).
  • Low coverage: packages/mermaid/src/diagrams/agentflow/parser/agentflow.jison packages/mermaid/src/diagrams/agentflow/parser/agentflow.jison:1 — 46.9% line coverage (321/684).
  • Low coverage: packages/mermaid/src/diagrams/block/parser/block.jison packages/mermaid/src/diagrams/block/parser/block.jison:1 — 44.2% line coverage (227/514).
  • Low coverage: packages/mermaid/src/diagrams/c4/parser/c4Diagram.jison packages/mermaid/src/diagrams/c4/parser/c4Diagram.jison:1 — 49.9% line coverage (258/517).
  • Low coverage: packages/mermaid/src/diagrams/class/svgDraw.js packages/mermaid/src/diagrams/class/svgDraw.js:1 — 7.5% line coverage (10/134).
D3 · God Classes · TooManyMethods · ×7
  • TooManyMethods: AgentFlowDB packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:188 — TooManyMethods — 77 methods. The bar is 30 methods; this is 47 over it, 2.57× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: UsecaseVisitor packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts:68 — TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: FlowDB packages/mermaid/src/diagrams/flowchart/flowDb.ts:98 — TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: UsecaseModelBuilder packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:172 — TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ClassDB packages/mermaid/src/diagrams/class/classDb.ts:37 — TooManyMethods — 45 methods. The bar is 30 methods; this is 15 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: StateDB packages/mermaid/src/diagrams/state/stateDb.ts:211 — TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SequenceDB packages/mermaid/src/diagrams/sequence/sequenceDb.ts:115 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D29 · Static Analysis (SAST) · REDACTED · ×6
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
IC1 · Incompleteness & stubs · Both branches are identical · ×6
  • Both branches are identical — the condition decides nothing packages/mermaid/src/diagrams/sequence/svgDraw.js:583 — Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
  • Both branches are identical — the condition decides nothing packages/mermaid/src/diagrams/sequence/svgDraw.js:584 — Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
  • Both branches are identical — the condition decides nothing packages/mermaid/src/rendering-util/rendering-elements/clusters.js:478 — The `if` and its `else` contain the same statements, so no input can make the condition matter. Implement the distinction that was intended, or drop the branch and keep the body.
  • Both branches are identical — the condition decides nothing packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts:274 — Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
  • Both branches are identical — the condition decides nothing packages/mermaid/src/rendering-util/rendering-elements/shapes/trapezoid.ts:13 — Both arms of this conditional expression are the same, so no input can make the condition matter. Implement the distinction that was intended, or drop the condition.
  • Both branches are identical — the condition decides nothing packages/mermaid/src/utils.ts:427 — The `if` and its `else` contain the same statements, so no input can make the condition matter. Implement the distinction that was intended, or drop the branch and keep the body.
IC1 · Incompleteness & stubs · Empty method body · ×6
  • Empty method body — does nothing with its inputs packages/mermaid/src/logger.ts:19 — `trace` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
  • Empty method body — does nothing with its inputs packages/mermaid/src/logger.ts:20 — `debug` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
  • Empty method body — does nothing with its inputs packages/mermaid/src/logger.ts:21 — `info` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
  • Empty method body — does nothing with its inputs packages/mermaid/src/logger.ts:22 — `warn` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
  • Empty method body — does nothing with its inputs packages/mermaid/src/logger.ts:23 — `error` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
  • Empty method body — does nothing with its inputs packages/mermaid/src/logger.ts:24 — `fatal` takes parameters but its body is empty — it accepts inputs and does nothing. Either implement it or remove it.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×6
  • Recursive walk over a caller-supplied document has no depth cap packages/mermaid/src/config.ts:267 — `sanitize` is exported and takes `options: any` from its caller, and it calls itself at line 267 (`sanitize`) with a piece of `options` — and nowhere in `sanitize` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitize` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap packages/mermaid/src/utils/sanitizeDirective.ts:49 — `sanitizeDirective` is exported, takes a document from its caller (line 108) and hands it to `sanitizeDirectiveValue`, which calls itself at line 49 (`sanitizeDirectiveValue`) with a piece of `args` (and at line 78) — and nowhere in `sanitizeDirectiveValue` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `sanitizeDirectiveValue` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1394 — `collectDescendantIds` is exported and takes `elkNode: any` from its caller, and it calls itself at line 1394 (`collectDescendantIds`) with a piece of `elkNode` — and nowhere in `collectDescendantIds` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `collectDescendantIds` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap packages/mermaid/src/diagrams/state/stateDb.ts:333 — `docTranslator` is exported and takes `node: Stmt` from its caller, and it calls itself at line 333 (`this.docTranslator`) with a piece of `node` (and at line 334, line 378) — and nowhere in `docTranslator` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `docTranslator` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap packages/mermaid/src/diagrams/mindmap/mindmapDb.ts:302 — `flattenNodes` is exported and takes `node: MindmapNode` from its caller, and it calls itself at line 302 (`this.flattenNodes`) with a piece of `node` — and nowhere in `flattenNodes` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `flattenNodes` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
  • Recursive walk over a caller-supplied document has no depth cap packages/mermaid/src/diagrams/mindmap/mindmapDb.ts:347 — `generateEdges` is exported and takes `node: MindmapNode` from its caller, and it calls itself at line 347 (`this.generateEdges`) with a piece of `node` — and nowhere in `generateEdges` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. JavaScript sets no limit of its own on that nesting: `JSON.parse` accepts any depth, so a 100,000-byte body — inside Express's default 100kb limit — parses to 50,000 levels, and a walk like this one throws `RangeError: Maximum call stack size exceeded` long before it reaches the bottom. Wherever that throw lands, the work fails: a request errors, and a walk running outside any `try` — an event handler, a timer, a promise nobody awaits — takes the Node process down with every other request in flight. Thread a depth argument through `generateEdges` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
D12 · Dependency Hygiene · Deprecated · ×5
  • Deprecated: @types/rollup-plugin-visualizer package.json:121 — @types/rollup-plugin-visualizer 5.0.3, declared in package.json, is marked deprecated by its publisher: "This is a stub types definition. rollup-plugin-visualizer provides its own type definitions, so you do not need this installed.". Replace it with the package or version that message names, or record why this one must stay.
  • Deprecated: eslint package.json:136 — eslint 9.35.0, declared in package.json, is marked deprecated by its publisher: "This version is no longer supported. Please see https://eslint.org/version-support for other options.". Replace it with the package or version that message names, or record why this one must stay.
  • Deprecated: eslint-plugin-markdown package.json:144 — eslint-plugin-markdown 5.1.0, declared in package.json, is marked deprecated by its publisher: "Please use @eslint/markdown instead". Replace it with the package or version that message names, or record why this one must stay.
  • Deprecated: katex packages/mermaid-layout-elk/package.json:56 — katex 0.18.11, declared in packages/mermaid-layout-elk/package.json, is marked deprecated by its publisher: "Accidentally published with breaking changes. Use 0.19.0 instead.". Replace it with the package or version that message names, or record why this one must stay.
  • Deprecated: katex packages/mermaid/package.json:91 — katex 0.18.11, declared in packages/mermaid/package.json, is marked deprecated by its publisher: "Accidentally published with breaking changes. Use 0.19.0 instead.". Replace it with the package or version that message names, or record why this one must stay.
D35 · Change Coupling · Change coupling · ×5
  • Change coupling: chartTitle.ts ↔ index.ts packages/mermaid/src/diagrams/xychart/chartBuilder/components/chartTitle.ts:1 — `packages/mermaid/src/diagrams/xychart/chartBuilder/components/chartTitle.ts` and `packages/mermaid/src/diagrams/xychart/chartBuilder/index.ts` change together 86% of the time (12 of the 14 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `037ba2fa` chore: Rename Group to SVGGroup; `0d348b79` Updated code review changes; `7c7d5881` Fixed all review comment (at that commit the file was still `packages/mermaid/src/diagrams/xychart/chartBuilder/components/ChartTitle.ts`) — run `git show` on any of them.
  • Change coupling: index.ts ↔ chartTitle.ts packages/mermaid/src/diagrams/xychart/chartBuilder/components/axis/index.ts:1 — `packages/mermaid/src/diagrams/xychart/chartBuilder/components/axis/index.ts` and `packages/mermaid/src/diagrams/xychart/chartBuilder/components/chartTitle.ts` change together 80% of the time (12 of the 15 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 12 shared commits counted here, the most recent 3 are `037ba2fa` chore: Rename Group to SVGGroup; `0d348b79` Updated code review changes; `7c7d5881` Fixed all review comment (at that commit the file was still `packages/mermaid/src/diagrams/xychart/chartBuilder/components/ChartTitle.ts`) — run `git show` on any of them.
  • Change coupling: linePlot.ts ↔ xychartDb.ts packages/mermaid/src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts:1 — `packages/mermaid/src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts` and `packages/mermaid/src/diagrams/xychart/xychartDb.ts` change together 75% of the time (9 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `b9074fca` feat(xychart): add per-point text labels for line charts; `fae648c2` Added the file name changes; `7c7d5881` Fixed all review comment (at that commit the file was still `packages/mermaid/src/diagrams/xychart/chartBuilder/components/plot/LinePlot.ts`) — run `git show` on any of them.
  • Change coupling: kanbanDb.ts ↔ clusters.js packages/mermaid/src/diagrams/kanban/kanbanDb.ts:1 — `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` and `packages/mermaid/src/rendering-util/rendering-elements/clusters.js` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `33c7c720` Merge pull request #7276 from mermaid-js/markdown-specific-changes; `0197c089` revert adding kanban section to shape; `dffaf9fa` fix for kanban section shape — run `git show` on any of them.
  • Change coupling: orchestrator.ts ↔ xychartDb.ts packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts:1 — `packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts` and `packages/mermaid/src/diagrams/xychart/xychartDb.ts` change together 58% of the time (11 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 11 shared commits counted here, the most recent 3 are `037ba2fa` chore: Rename Group to SVGGroup; `0d348b79` Updated code review changes; `fae648c2` Added the file name changes — run `git show` on any of them.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×4
  • Animation without a prefers-reduced-motion guard packages/mermaid-local-editor/static/styles.css:16 — `#toolbar` moves (`transition: transform 0.25s ease, opacity 0.2s ease, height 0.25s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard packages/mermaid/src/docs/.vitepress/theme/Tooltip.vue:84 — `.mermaid-chart-tooltip.showing` moves (`animation: tooltipFadeIn 0.3s ease 0.4s forwards`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard packages/mermaid/src/docs/.vitepress/theme/Tooltip.vue:88 — `.mermaid-chart-tooltip.hiding` moves (`animation: tooltipFadeOut 0.3s ease forwards`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
  • Animation without a prefers-reduced-motion guard .esbuild/dev-explorer/public/styles.css:215 — `dev-explorer-app button.card` moves (`transition: transform 0.2s ease, box-shadow 0.2s ease`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×4
  • Sync-over-async blocking packages/mermaid/scripts/docs.mts:665 — `rmSync` in `processDocs` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking packages/mermaid/scripts/docs.mts:704 — `rmSync` in `on("unlink")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking packages/mermaid/scripts/docs.mts:705 — `rmdirSync` in `on("unlinkDir")` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking packages/mermaid/src/rendering-util/layout-algorithms/ddlt/parseToLayoutData.ts:139 — `readFileSync` in `parseMmdFileToLayoutData` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
AC3 · Page structure · Page without a main landmark · ×3
  • Page without a main landmark .esbuild/dev-explorer/public/compare-pane.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark .esbuild/dev-explorer/public/index.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. This document's body is only the mount point <dev-explorer-app>, so there is no content here to wrap — render the <main> from the component mounted into it.
  • Page without a main landmark packages/mermaid-local-editor/static/index.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
D2 · Cognitive Complexity · layered.reduceCrossings · ×3
  • layered.reduceCrossings::count (cognitive 59) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2023 — layered.reduceCrossings::count has cognitive complexity 59 (threshold 15). Drivers by points: loops 12 (38 pts), if/else 8 (18 pts), boolean chains 3 (nesting depth added 36). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: 3 other methods here (layered.reduceCrossings, layered.reduceCrossings::sweep, layered.reduceCrossings::transpose) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • layered.reduceCrossings::sweep (cognitive 48) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2164 — layered.reduceCrossings::sweep has cognitive complexity 48 (threshold 15). Drivers by points: if/else 8 (23 pts), ternaries 7 (14 pts), loops 5 (10 pts), boolean chains 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (layered.reduceCrossings, layered.reduceCrossings::count, layered.reduceCrossings::transpose) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • layered.reduceCrossings::transpose (cognitive 21) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2253 — layered.reduceCrossings::transpose has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (layered.reduceCrossings, layered.reduceCrossings::count, layered.reduceCrossings::sweep) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
X24 · Document value interpolated into markup unescaped · Untrusted text written into markup unescaped · ×3
  • Untrusted text written into markup unescaped packages/mermaid-zenuml/src/zenumlRenderer.ts:81 — `result.innerSvg` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped packages/mermaid/src/mermaid.ts:186 — `svg` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
  • Untrusted text written into markup unescaped packages/mermaid/src/mermaidAPI.ts:618 — `rules` is text this program did not author, and it is written into the text of an element through `innerHTML` with nothing encoding it for that place. Whoever controls the value controls the markup: it can close the element or attribute it sits in and open a script of its own. Encode it for HTML at this site, render it through the framework's escaping output, or sanitise it if it must stay markup.
X3 · Exception handling · Swallowed exception (empty catch) · ×3
  • Swallowed exception (empty catch) packages/mermaid/src/profiler.ts:198 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/mermaid/src/profiler.ts:230 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:686 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
AC6 · Visual & motion safety · Focus outline removed in CSS without a · ×2
  • Focus outline removed in CSS without a :focus replacement packages/mermaid/src/docs/.vitepress/theme/Mermaid.vue:137 — `.editable-code:focus` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
  • Focus outline removed in CSS without a :focus replacement .esbuild/dev-explorer/public/styles.css:479 — `dev-explorer-app .cm-content` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 215) · ×2
  • updateColors (cyclomatic 215) packages/mermaid/src/themes/theme-neo-dark.js:68 — updateColors has cyclomatic complexity 215 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • updateColors (cyclomatic 215) packages/mermaid/src/themes/theme-neo.js:52 — updateColors has cyclomatic complexity 215 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · layered.reduceCrossings · ×2
  • layered.reduceCrossings::count (cyclomatic 25) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2023 — layered.reduceCrossings::count has cyclomatic complexity 25 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: 2 other methods here (layered.reduceCrossings, layered.reduceCrossings::sweep) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • layered.reduceCrossings::sweep (cyclomatic 22) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2164 — layered.reduceCrossings::sweep has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (layered.reduceCrossings, layered.reduceCrossings::count) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · updateColors (cognitive 220) · ×2
  • updateColors (cognitive 220) packages/mermaid/src/themes/theme-neo-dark.js:68 — updateColors has cognitive complexity 220 (threshold 15). Drivers by points: boolean chains 196, loops 6 (8 pts), if/else 6 (7 pts), ternaries 7, other 2 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
  • updateColors (cognitive 220) packages/mermaid/src/themes/theme-neo.js:52 — updateColors has cognitive complexity 220 (threshold 15). Drivers by points: boolean chains 196, loops 6 (8 pts), if/else 6 (7 pts), ternaries 7, other 2 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · router.routeEdgesOrthogonal · ×2
  • router.routeEdgesOrthogonal::crossingPenalty (cognitive 37) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:300 — router.routeEdgesOrthogonal::crossingPenalty has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (router.routeEdgesOrthogonal, router.routeEdgesOrthogonal::fixPipeCrossings) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • router.routeEdgesOrthogonal::fixPipeCrossings (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:2051 — router.routeEdgesOrthogonal::fixPipeCrossings has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (11 pts), if/else 2 (8 pts) (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline. This shape REPEATS in the file: 2 other methods here (router.routeEdgesOrthogonal, router.routeEdgesOrthogonal::crossingPenalty) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · materializedGeometry.reassignCrossingExternalRailChannels · ×2
  • materializedGeometry.reassignCrossingExternalRailChannels::candidateIsSafe (cognitive 28) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1574 — materializedGeometry.reassignCrossingExternalRailChannels::candidateIsSafe has cognitive complexity 28 (threshold 15). Drivers by points: if/else 4 (14 pts), loops 6 (13 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (materializedGeometry.reassignCrossingExternalRailChannels, materializedGeometry.reassignCrossingExternalRailChannels::externalRailForSegment) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • materializedGeometry.reassignCrossingExternalRailChannels::externalRailForSegment (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1369 — materializedGeometry.reassignCrossingExternalRailChannels::externalRailForSegment has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 6 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (materializedGeometry.reassignCrossingExternalRailChannels, materializedGeometry.reassignCrossingExternalRailChannels::candidateIsSafe) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×2
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED
  • REDACTED
  • REDACTED
IC1 · Incompleteness & stubs · Fake-async · ×2
  • Fake-async — async method never awaits packages/mermaid/src/diagrams/usecase/parser/usecase.chevrotain.ts:10 — `parse` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
  • Fake-async — async method never awaits packages/mermaid/src/rendering-util/layout-algorithms/ddlt/backends.ts:69 — `runDomusOrthogonalDdlt` is declared `async` but never awaits anything, so it runs synchronously while pretending to be asynchronous. Drop `async` or do the real async work.
R10 · Code Duplication · Duplicated block (56 lines × 2 locations) · ×2
  • Duplicated block (56 lines × 2 locations) packages/mermaid/src/utils/lineWithOffset.ts:62 — packages/mermaid/src/utils/lineWithOffset.ts:62 · packages/mermaid/src/utils/lineWithOffset.ts:124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (56 lines × 2 locations) packages/parser/src/language/railroad-peg/valueConverter.ts:5 — packages/parser/src/language/railroad-peg/valueConverter.ts:5 · packages/parser/src/language/railroad/valueConverter.ts:5 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block with local edits (51 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (51 matched lines × 2 locations) packages/mermaid/src/diagrams/agentflow/types.ts:43 — packages/mermaid/src/diagrams/agentflow/types.ts:43 · packages/mermaid/src/diagrams/flowchart/types.ts:25 — the two spans are one implementation copied and then locally edited — 240 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (51 matched lines × 2 locations) packages/mermaid/src/diagrams/kanban/kanbanDb.ts:164 — packages/mermaid/src/diagrams/kanban/kanbanDb.ts:164 · packages/mermaid/src/diagrams/mindmap/mindmapDb.ts:114 — the two spans are one implementation copied and then locally edited — 246 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (43 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (43 matched lines × 2 locations) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:97 — packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:97 · packages/mermaid/src/diagrams/user-journey/journeyRenderer.ts:218 — the two spans are one implementation copied and then locally edited — 461 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (43 matched lines × 2 locations) packages/mermaid/src/themes/theme-default.js:8 — packages/mermaid/src/themes/theme-default.js:8 · packages/mermaid/src/themes/theme-neutral.js:11 — the two spans are one implementation copied and then locally edited — 321 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 215, cognitive 220) · ×2
  • Complex function updateColors (cyclomatic 215, cognitive 220) packages/mermaid/src/themes/theme-neo-dark.js:68 — updateColors has cyclomatic complexity 215 and cognitive complexity 220; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
  • Complex function updateColors (cyclomatic 215, cognitive 220) packages/mermaid/src/themes/theme-neo.js:52 — updateColors has cyclomatic complexity 215 and cognitive complexity 220; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R4 · Test Coverage · This test file cannot be loaded · ×2
  • This test file cannot be loaded e2e/platform/bundle-test.js:2 — e2e/platform/bundle-test.js:2 imports './mermaid.esm.mjs', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either. The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
  • This test file cannot be loaded e2e/platform/viewer.js:1 — e2e/platform/viewer.js:1 imports './mermaid-example-diagram.esm.mjs', which names no file in this repository — and no rule in its .gitignore chain could cover one, so no build writes it either (3 further unresolvable import(s) in the same file). The import throws as the runner collects this file, so none of its test cases run and nothing it was written to verify is verified. Restore the missing module or delete the test. It is excluded from the reachability measured above, because a file that cannot load reaches nothing.
X2 · Cancellation propagation · Async function without AbortSignal · ×2
  • Async function without AbortSignal: download packages/mermaid/src/docs/.vitepress/scripts/fetch-avatars.ts:12 — `download` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: fetchContributors packages/mermaid/src/docs/.vitepress/scripts/fetch-contributors.ts:14 — `fetchContributors` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 289) · ×1
  • updateColors (cyclomatic 289) packages/mermaid/src/themes/theme-base.js:32 — updateColors has cyclomatic complexity 289 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · router.routeEdgesOrthogonal (cyclomatic 240) · ×1
  • router.routeEdgesOrthogonal (cyclomatic 240) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141 — router.routeEdgesOrthogonal has cyclomatic complexity 240 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (router.routeEdgesOrthogonal::crossingPenalty) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 216) · ×1
  • updateColors (cyclomatic 216) packages/mermaid/src/themes/theme-redux-dark.js:76 — updateColors has cyclomatic complexity 216 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · layered.layered (cyclomatic 215) · ×1
  • layered.layered (cyclomatic 215) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:297 — layered.layered has cyclomatic complexity 215 (threshold 15). Of this number, 189 points are the body's own statements and 26 belong to 13 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 205) · ×1
  • updateColors (cyclomatic 205) packages/mermaid/src/themes/theme-redux.js:58 — updateColors has cyclomatic complexity 205 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 203) · ×1
  • updateColors (cyclomatic 203) packages/mermaid/src/themes/theme-default.js:146 — updateColors has cyclomatic complexity 203 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 200) · ×1
  • updateColors (cyclomatic 200) packages/mermaid/src/themes/theme-forest.js:113 — updateColors has cyclomatic complexity 200 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 199) · ×1
  • updateColors (cyclomatic 199) packages/mermaid/src/themes/theme-redux-color.js:106 — updateColors has cyclomatic complexity 199 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 196) · ×1
  • updateColors (cyclomatic 196) packages/mermaid/src/themes/theme-redux-dark-color.js:108 — updateColors has cyclomatic complexity 196 (threshold 15). Of this number, 195 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · validateLayout.validateLayout (cyclomatic 192) · ×1
  • validateLayout.validateLayout (cyclomatic 192) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:553 — validateLayout.validateLayout has cyclomatic complexity 192 (threshold 15). Of this number, 175 points are the body's own statements and 17 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 189) · ×1
  • updateColors (cyclomatic 189) packages/mermaid/src/themes/theme-dark.js:115 — updateColors has cyclomatic complexity 189 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · updateColors (cyclomatic 173) · ×1
  • updateColors (cyclomatic 173) packages/mermaid/src/themes/theme-neutral.js:128 — updateColors has cyclomatic complexity 173 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · materializedGeometry.resolveRenderedOrthogonalCrossings (cyclomatic 158) · ×1
  • materializedGeometry.resolveRenderedOrthogonalCrossings (cyclomatic 158) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1915 — materializedGeometry.resolveRenderedOrthogonalCrossings has cyclomatic complexity 158 (threshold 15). Of this number, 23 points are the body's own statements and 135 belong to 36 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · materializedGeometry.separateSharedRenderedTerminalLanes (cyclomatic 101) · ×1
  • materializedGeometry.separateSharedRenderedTerminalLanes (cyclomatic 101) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:48 — materializedGeometry.separateSharedRenderedTerminalLanes has cyclomatic complexity 101 (threshold 15). Of this number, 19 points are the body's own statements and 82 belong to 14 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · compound.routeCrossings (cyclomatic 95) · ×1
  • compound.routeCrossings (cyclomatic 95) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:155 — compound.routeCrossings has cyclomatic complexity 95 (threshold 15). Of this number, 63 points are the body's own statements and 32 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · compound.compoundLayout (cyclomatic 87) · ×1
  • compound.compoundLayout (cyclomatic 87) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:467 — compound.compoundLayout has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (compound.compoundLayout::place) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · layered.position (cyclomatic 83) · ×1
  • layered.position (cyclomatic 83) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2340 — layered.position has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · insertEdge (cyclomatic 83) · ×1
  • insertEdge (cyclomatic 83) packages/mermaid/src/rendering-util/rendering-elements/edges.js:706 — insertEdge has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · labelAnchoring.anchorLabelsToPolyline (cyclomatic 80) · ×1
  • labelAnchoring.anchorLabelsToPolyline (cyclomatic 80) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/labelAnchoring.ts:84 — labelAnchoring.anchorLabelsToPolyline has cyclomatic complexity 80 (threshold 15). Of this number, 33 points are the body's own statements and 47 belong to 13 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · materializedGeometry.reassignCrossingExternalRailChannels (cyclomatic 77) · ×1
  • materializedGeometry.reassignCrossingExternalRailChannels (cyclomatic 77) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1290 — materializedGeometry.reassignCrossingExternalRailChannels has cyclomatic complexity 77 (threshold 15). Most of this is not in the body itself: 15 of the 77 points are its own statements and the rest belongs to 11 function items inside it that branch (externalRailForSegment, candidateIsSafe, connectedComponents, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · phase4.coordinates.assignCoordinates (cyclomatic 74) · ×1
  • phase4.coordinates.assignCoordinates (cyclomatic 74) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase4.coordinates.ts:42 — phase4.coordinates.assignCoordinates has cyclomatic complexity 74 (threshold 15). Of this number, 67 points are the body's own statements and 7 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sequenceRenderer.drawMessage (cyclomatic 74) · ×1
  • sequenceRenderer.drawMessage (cyclomatic 74) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:461 — sequenceRenderer.drawMessage has cyclomatic complexity 74 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · renderer.draw (cyclomatic 73) · ×1
  • renderer.draw (cyclomatic 73) packages/mermaid/src/diagrams/treemap/renderer.ts:24 — renderer.draw has cyclomatic complexity 73 (threshold 15). Of this number, 24 points are the body's own statements and 49 belong to 18 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sharedTrackNudging.nudgeSharedInteriorSubpaths (cyclomatic 72) · ×1
  • sharedTrackNudging.nudgeSharedInteriorSubpaths (cyclomatic 72) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/sharedTrackNudging.ts:13 — sharedTrackNudging.nudgeSharedInteriorSubpaths has cyclomatic complexity 72 (threshold 15). Of this number, 16 points are the body's own statements and 56 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · edgeLabels.positionGridEdgeLabels (cyclomatic 72) · ×1
  • edgeLabels.positionGridEdgeLabels (cyclomatic 72) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:2207 — edgeLabels.positionGridEdgeLabels has cyclomatic complexity 72 (threshold 15). Of this number, 57 points are the body's own statements and 15 belong to 8 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routerPlanning.assignDemandCoordinates (cyclomatic 68) · ×1
  • routerPlanning.assignDemandCoordinates (cyclomatic 68) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:424 — routerPlanning.assignDemandCoordinates has cyclomatic complexity 68 (threshold 15). Of this number, 40 points are the body's own statements and 28 belong to 10 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · wardleyRenderer.draw (cyclomatic 66) · ×1
  • wardleyRenderer.draw (cyclomatic 66) packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts:67 — wardleyRenderer.draw has cyclomatic complexity 66 (threshold 15). Of this number, 16 points are the body's own statements and 50 belong to 28 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · classBox.classBox (cyclomatic 62) · ×1
  • classBox.classBox (cyclomatic 62) packages/mermaid/src/rendering-util/rendering-elements/shapes/classBox.ts:14 — classBox.classBox has cyclomatic complexity 62 (threshold 15). Of this number, 46 points are the body's own statements and 16 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sequenceRenderer.draw (cyclomatic 58) · ×1
  • sequenceRenderer.draw (cyclomatic 58) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1043 — sequenceRenderer.draw has cyclomatic complexity 58 (threshold 15). Of this number, 54 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · routePath.routePath (cyclomatic 56) · ×1
  • routePath.routePath (cyclomatic 56) packages/mermaid/src/rendering-util/rendering-elements/routePath.ts:130 — routePath.routePath has cyclomatic complexity 56 (threshold 15). Of this number, 39 points are the body's own statements and 17 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · materializedGeometry.shortcutRedundantOrthogonalJogs (cyclomatic 55) · ×1
  • materializedGeometry.shortcutRedundantOrthogonalJogs (cyclomatic 55) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1667 — materializedGeometry.shortcutRedundantOrthogonalJogs has cyclomatic complexity 55 (threshold 15). Of this number, 16 points are the body's own statements and 39 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · phase2.crossCounts.computeSubtreeCrossCounts (cyclomatic 53) · ×1
  • phase2.crossCounts.computeSubtreeCrossCounts (cyclomatic 53) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.crossCounts.ts:12 — phase2.crossCounts.computeSubtreeCrossCounts has cyclomatic complexity 53 (threshold 15). Of this number, 33 points are the body's own statements and 20 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · terminalStub.collapseShortTerminalStub (cyclomatic 51) · ×1
  • terminalStub.collapseShortTerminalStub (cyclomatic 51) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/terminalStub.ts:44 — terminalStub.collapseShortTerminalStub has cyclomatic complexity 51 (threshold 15). Of this number, 43 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routerSparse.sparseContainerSegment (cyclomatic 51) · ×1
  • routerSparse.sparseContainerSegment (cyclomatic 51) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:651 — routerSparse.sparseContainerSegment has cyclomatic complexity 51 (threshold 15). Of this number, 45 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layered.settle (cyclomatic 50) · ×1
  • layered.settle (cyclomatic 50) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1306 — layered.settle has cyclomatic complexity 50 (threshold 15). Of this number, 37 points are the body's own statements and 13 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layered.reduceCrossings (cyclomatic 49) · ×1
  • layered.reduceCrossings (cyclomatic 49) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1965 — layered.reduceCrossings has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (layered.reduceCrossings::count, layered.reduceCrossings::sweep) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · FlowDB.addVertex (cyclomatic 48) · ×1
  • FlowDB.addVertex (cyclomatic 48) packages/mermaid/src/diagrams/flowchart/flowDb.ts:188 — FlowDB.addVertex has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layoutCore.layoutContainer (cyclomatic 46) · ×1
  • layoutCore.layoutContainer (cyclomatic 46) packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts:65 — layoutCore.layoutContainer has cyclomatic complexity 46 (threshold 15). Of this number, 44 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · geometry.buildOrthogonalPortPath (cyclomatic 45) · ×1
  • geometry.buildOrthogonalPortPath (cyclomatic 45) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:329 — geometry.buildOrthogonalPortPath has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · siblingSharedFaceRouting.straightenCollinearSiblingDetours (cyclomatic 43) · ×1
  • siblingSharedFaceRouting.straightenCollinearSiblingDetours (cyclomatic 43) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/siblingSharedFaceRouting.ts:84 — siblingSharedFaceRouting.straightenCollinearSiblingDetours has cyclomatic complexity 43 (threshold 15). Of this number, 32 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GridEdgeRoutingSession.routePlan (cyclomatic 43) · ×1
  • GridEdgeRoutingSession.routePlan (cyclomatic 43) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts:399 — GridEdgeRoutingSession.routePlan has cyclomatic complexity 43 (threshold 15). Of this number, 33 points are the body's own statements and 10 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentFlowDB.addVertex (cyclomatic 43) · ×1
  • AgentFlowDB.addVertex (cyclomatic 43) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:322 — AgentFlowDB.addVertex has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · materializedGeometry.shiftLeftLaneTitleBandsLeftOfRails (cyclomatic 42) · ×1
  • materializedGeometry.shiftLeftLaneTitleBandsLeftOfRails (cyclomatic 42) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:926 — materializedGeometry.shiftLeftLaneTitleBandsLeftOfRails has cyclomatic complexity 42 (threshold 15). Most of this is not in the body itself: 15 of the 42 points are its own statements and the rest belongs to 4 function items inside it that branch (validTitleRect, leftLaneTitleFor, verticalSegmentIntersectsTitle, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · materializedGeometry.swapDestinationTerminalTailsToReduceCrossings (cyclomatic 42) · ×1
  • materializedGeometry.swapDestinationTerminalTailsToReduceCrossings (cyclomatic 42) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1066 — materializedGeometry.swapDestinationTerminalTailsToReduceCrossings has cyclomatic complexity 42 (threshold 15). Of this number, 18 points are the body's own statements and 24 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SequenceDB.apply (cyclomatic 42) · ×1
  • SequenceDB.apply (cyclomatic 42) packages/mermaid/src/diagrams/sequence/sequenceDb.ts:557 — SequenceDB.apply has cyclomatic complexity 42 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · erBox.erBox (cyclomatic 41) · ×1
  • erBox.erBox (cyclomatic 41) packages/mermaid/src/rendering-util/rendering-elements/shapes/erBox.ts:19 — erBox.erBox has cyclomatic complexity 41 (threshold 15). Of this number, 36 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · index.run (cyclomatic 41) · ×1
  • index.run (cyclomatic 41) packages/mermaid/src/rendering-util/layout-algorithms/layered/index.ts:144 — index.run has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 10 of the 41 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 185, a function literal at line 302, a function literal at line 237, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · FlowDB.getData (cyclomatic 41) · ×1
  • FlowDB.getData (cyclomatic 41) packages/mermaid/src/diagrams/flowchart/flowDb.ts:1228 — FlowDB.getData has cyclomatic complexity 41 (threshold 15). Of this number, 22 points are the body's own statements and 19 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · materializedGeometry.liftTopLaneTitleBandsAboveRails (cyclomatic 40) · ×1
  • materializedGeometry.liftTopLaneTitleBandsAboveRails (cyclomatic 40) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:796 — materializedGeometry.liftTopLaneTitleBandsAboveRails has cyclomatic complexity 40 (threshold 15). Most of this is not in the body itself: 14 of the 40 points are its own statements and the rest belongs to 3 function items inside it that branch (topLaneTitleFor, validTitleRect, horizontalSegmentIntersectsTitle). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · AgentFlowDB.getData (cyclomatic 40) · ×1
  • AgentFlowDB.getData (cyclomatic 40) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1671 — AgentFlowDB.getData has cyclomatic complexity 40 (threshold 15). Of this number, 16 points are the body's own statements and 24 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layered.rank (cyclomatic 39) · ×1
  • layered.rank (cyclomatic 39) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:948 — layered.rank has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · helpers.writeBackToLayoutData (cyclomatic 39) · ×1
  • helpers.writeBackToLayoutData (cyclomatic 39) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/helpers.ts:275 — helpers.writeBackToLayoutData has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routerTopology.buildEndpointRoutingOverlay (cyclomatic 39) · ×1
  • routerTopology.buildEndpointRoutingOverlay (cyclomatic 39) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:1099 — routerTopology.buildEndpointRoutingOverlay has cyclomatic complexity 39 (threshold 15). Of this number, 21 points are the body's own statements and 18 belong to 8 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · materializedGeometry.liftObstacleHuggingSameSideRails (cyclomatic 38) · ×1
  • materializedGeometry.liftObstacleHuggingSameSideRails (cyclomatic 38) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:587 — materializedGeometry.liftObstacleHuggingSameSideRails has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 11 of the 38 points are its own statements and the rest belongs to 6 function items inside it that branch (candidateIsSafe, a function literal at line 670, strictCrossingCount, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · routerCompatibility.prepareRoutingModes (cyclomatic 38) · ×1
  • routerCompatibility.prepareRoutingModes (cyclomatic 38) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:1033 — routerCompatibility.prepareRoutingModes has cyclomatic complexity 38 (threshold 15). Of this number, 31 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · svgDraw.drawText (cyclomatic 38) · ×1
  • svgDraw.drawText (cyclomatic 38) packages/mermaid/src/diagrams/sequence/svgDraw.js:192 — svgDraw.drawText has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · materializedGeometry.collapseRedundantRectangularDoglegs · ×1
  • materializedGeometry.collapseRedundantRectangularDoglegs::withoutDogleg (cyclomatic 37) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:493 — materializedGeometry.collapseRedundantRectangularDoglegs::withoutDogleg has cyclomatic complexity 37 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AgentFlowDB.getSemanticModel (cyclomatic 37) · ×1
  • AgentFlowDB.getSemanticModel (cyclomatic 37) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:2003 — AgentFlowDB.getSemanticModel has cyclomatic complexity 37 (threshold 15). Of this number, 20 points are the body's own statements and 17 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · gitGraphRenderer.drawArrow (cyclomatic 37) · ×1
  • gitGraphRenderer.drawArrow (cyclomatic 37) packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:653 — gitGraphRenderer.drawArrow has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · svgDraw.drawEdges (cyclomatic 36) · ×1
  • svgDraw.drawEdges (cyclomatic 36) packages/mermaid/src/diagrams/architecture/svgDraw.ts:25 — svgDraw.drawEdges has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to one function literal inside it that branches (line 38). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · compound.compoundLayout · ×1
  • compound.compoundLayout::place (cyclomatic 35) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:801 — compound.compoundLayout::place has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (compound.compoundLayout) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · routerPlanning.endpointCandidates (cyclomatic 34) · ×1
  • routerPlanning.endpointCandidates (cyclomatic 34) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:949 — routerPlanning.endpointCandidates has cyclomatic complexity 34 (threshold 15). Of this number, 19 points are the body's own statements and 15 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layered.snap (cyclomatic 33) · ×1
  • layered.snap (cyclomatic 33) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1443 — layered.snap has cyclomatic complexity 33 (threshold 15). Of this number, 20 points are the body's own statements and 13 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layered.assignTracks (cyclomatic 33) · ×1
  • layered.assignTracks (cyclomatic 33) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1561 — layered.assignTracks has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (layered.assignTracks::lay) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · routerSparse.sparseSameContainerRoute · ×1
  • routerSparse.sparseSameContainerRoute::searchPairs (cyclomatic 33) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:222 — routerSparse.sparseSameContainerRoute::searchPairs has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (routerSparse.sparseSameContainerRoute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · detourSimplification.simplifyDetouredEdges (cyclomatic 32) · ×1
  • detourSimplification.simplifyDetouredEdges (cyclomatic 32) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/detourSimplification.ts:20 — detourSimplification.simplifyDetouredEdges has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (detourSimplification.simplifyDetouredEdges::pathConflictCount) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · routerSearch.search (cyclomatic 32) · ×1
  • routerSearch.search (cyclomatic 32) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts:309 — routerSearch.search has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (routerSearch.search::relaxArc) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · routerSparse.sparseSelfLoopRoute (cyclomatic 32) · ×1
  • routerSparse.sparseSelfLoopRoute (cyclomatic 32) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:464 — routerSparse.sparseSelfLoopRoute has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · cynefinRenderer.draw (cyclomatic 31) · ×1
  • cynefinRenderer.draw (cyclomatic 31) packages/mermaid/src/diagrams/cynefin/cynefinRenderer.ts:71 — cynefinRenderer.draw has cyclomatic complexity 31 (threshold 15). Of this number, 24 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · draw · ×1
  • draw::makeGrid (cyclomatic 31) packages/mermaid/src/diagrams/gantt/ganttRenderer.js:649 — draw::makeGrid has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layered.assignTracks · ×1
  • layered.assignTracks::lay (cyclomatic 30) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1619 — layered.assignTracks::lay has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (layered.assignTracks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · c4Db.updateElStyle (cyclomatic 30) · ×1
  • c4Db.updateElStyle (cyclomatic 30) packages/mermaid/src/diagrams/c4/c4Db.ts:494 — c4Db.updateElStyle has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · render.findCyclicEntryNodes (cyclomatic 30) · ×1
  • render.findCyclicEntryNodes (cyclomatic 30) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:531 — render.findCyclicEntryNodes has cyclomatic complexity 30 (threshold 15). Of this number, 26 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · portSwap.portSwapToLShape (cyclomatic 30) · ×1
  • portSwap.portSwapToLShape (cyclomatic 30) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/portSwap.ts:107 — portSwap.portSwapToLShape has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · sequenceRenderer.getMaxMessageWidthPerActor (cyclomatic 30) · ×1
  • sequenceRenderer.getMaxMessageWidthPerActor (cyclomatic 30) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1488 — sequenceRenderer.getMaxMessageWidthPerActor has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · lrTransform.applyLrDirectionTransform (cyclomatic 29) · ×1
  • lrTransform.applyLrDirectionTransform (cyclomatic 29) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/lrTransform.ts:269 — lrTransform.applyLrDirectionTransform has cyclomatic complexity 29 (threshold 15). Of this number, 28 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · xychartRenderer.draw (cyclomatic 29) · ×1
  • xychartRenderer.draw (cyclomatic 29) packages/mermaid/src/diagrams/xychart/xychartRenderer.ts:13 — xychartRenderer.draw has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 10 of the 29 points are its own statements and the rest belongs to 12 function items inside it that branch (getGroup, getTextAnchor, a function literal at line 127, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · sequenceRenderer.calculateLoopBounds (cyclomatic 28) · ×1
  • sequenceRenderer.calculateLoopBounds (cyclomatic 28) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:2041 — sequenceRenderer.calculateLoopBounds has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · render.applyElkEdgeLayout (cyclomatic 27) · ×1
  • render.applyElkEdgeLayout (cyclomatic 27) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1966 — render.applyElkEdgeLayout has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 8 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2019, 1988). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · validation.validateSwimlanesLayout (cyclomatic 27) · ×1
  • validation.validateSwimlanesLayout (cyclomatic 27) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/validation.ts:54 — validation.validateSwimlanesLayout has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · placement.readGridConfig (cyclomatic 27) · ×1
  • placement.readGridConfig (cyclomatic 27) packages/mermaid/src/rendering-util/layout-algorithms/grid/placement.ts:84 — placement.readGridConfig has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · agentflowDb.stripLineTrailingCommas (cyclomatic 27) · ×1
  • agentflowDb.stripLineTrailingCommas (cyclomatic 27) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:125 — agentflowDb.stripLineTrailingCommas has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · vennRenderer.draw (cyclomatic 27) · ×1
  • vennRenderer.draw (cyclomatic 27) packages/mermaid/src/diagrams/venn/vennRenderer.ts:31 — vennRenderer.draw has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 13 of the 27 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 121, 173, 220). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · layered.alignLabels (cyclomatic 26) · ×1
  • layered.alignLabels (cyclomatic 26) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1188 — layered.alignLabels has cyclomatic complexity 26 (threshold 15). Of this number, 14 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · orthogonalEdgeClipping.outlineEndpoint (cyclomatic 26) · ×1
  • orthogonalEdgeClipping.outlineEndpoint (cyclomatic 26) packages/mermaid/src/rendering-util/rendering-elements/orthogonalEdgeClipping.js:19 — orthogonalEdgeClipping.outlineEndpoint has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · routerConstraint.canonicalizeOrthogonalPolyline (cyclomatic 26) · ×1
  • routerConstraint.canonicalizeOrthogonalPolyline (cyclomatic 26) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerConstraint.ts:40 — routerConstraint.canonicalizeOrthogonalPolyline has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · assignWithDepth.assignWithDepth (cyclomatic 25) · ×1
  • assignWithDepth.assignWithDepth (cyclomatic 25) packages/mermaid/src/assignWithDepth.ts:30 — assignWithDepth.assignWithDepth has cyclomatic complexity 25 (threshold 15). Of this number, 16 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · dataFetcher.dataFetcher (cyclomatic 25) · ×1
  • dataFetcher.dataFetcher (cyclomatic 25) packages/mermaid/src/diagrams/state/dataFetcher.ts:241 — dataFetcher.dataFetcher has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · boxDrawingPreprocessor.preprocessBoxDrawing (cyclomatic 25) · ×1
  • boxDrawingPreprocessor.preprocessBoxDrawing (cyclomatic 25) packages/mermaid/src/diagrams/treeView/boxDrawingPreprocessor.ts:67 — boxDrawingPreprocessor.preprocessBoxDrawing has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · kanbanItem.kanbanItem (cyclomatic 24) · ×1
  • kanbanItem.kanbanItem (cyclomatic 24) packages/mermaid/src/rendering-util/rendering-elements/shapes/kanbanItem.ts:23 — kanbanItem.kanbanItem has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · layered.pastLabels (cyclomatic 24) · ×1
  • layered.pastLabels (cyclomatic 24) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1888 — layered.pastLabels has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · mermaidAPI.renderDiagram (cyclomatic 24) · ×1
  • mermaidAPI.renderDiagram (cyclomatic 24) packages/mermaid/src/mermaidAPI.ts:478 — mermaidAPI.renderDiagram has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · lineJump.applyLineJumpsToSvg (cyclomatic 24) · ×1
  • lineJump.applyLineJumpsToSvg (cyclomatic 24) packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts:653 — lineJump.applyLineJumpsToSvg has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · render.straightenEdgeTerminals (cyclomatic 24) · ×1
  • render.straightenEdgeTerminals (cyclomatic 24) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1904 — render.straightenEdgeTerminals has cyclomatic complexity 24 (threshold 15). Of this number, 14 points are the body's own statements and 10 belong to 3 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · edgeLabels.blockedCenterIntervals (cyclomatic 24) · ×1
  • edgeLabels.blockedCenterIntervals (cyclomatic 24) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:965 — edgeLabels.blockedCenterIntervals has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routerSearch.search · ×1
  • routerSearch.search::relaxArc (cyclomatic 24) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts:546 — routerSearch.search::relaxArc has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (routerSearch.search) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · routerTopology.buildVisibilityGraph (cyclomatic 24) · ×1
  • routerTopology.buildVisibilityGraph (cyclomatic 24) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:796 — routerTopology.buildVisibilityGraph has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 880, addArcPair, a function literal at line 851, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · blockDB.populateBlockDatabase (cyclomatic 24) · ×1
  • blockDB.populateBlockDatabase (cyclomatic 24) packages/mermaid/src/diagrams/block/blockDB.ts:105 — blockDB.populateBlockDatabase has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · stateRenderer.renderDoc (cyclomatic 24) · ×1
  • stateRenderer.renderDoc (cyclomatic 24) packages/mermaid/src/diagrams/state/stateRenderer.js:89 — stateRenderer.renderDoc has cyclomatic complexity 24 (threshold 15). Of this number, 16 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · phase2.gravity.assignLayers_Gravity (cyclomatic 23) · ×1
  • phase2.gravity.assignLayers_Gravity (cyclomatic 23) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.gravity.ts:18 — phase2.gravity.assignLayers_Gravity has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 10 of the 23 points are its own statements and the rest belongs to 3 function items inside it that branch (relaxOrder, a function literal at line 30, clampFeasible). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · routerPlanning.resolveAmbiguousEndpointSides (cyclomatic 23) · ×1
  • routerPlanning.resolveAmbiguousEndpointSides (cyclomatic 23) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:258 — routerPlanning.resolveAmbiguousEndpointSides has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · gitGraphRenderer.drawCommitBullet (cyclomatic 23) · ×1
  • gitGraphRenderer.drawCommitBullet (cyclomatic 23) packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:226 — gitGraphRenderer.drawCommitBullet has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · usecaseDb.getData (cyclomatic 23) · ×1
  • usecaseDb.getData (cyclomatic 23) packages/mermaid/src/diagrams/usecase/usecaseDb.ts:295 — usecaseDb.getData has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PropertyOrderCollector.readString (cyclomatic 23) · ×1
  • PropertyOrderCollector.readString (cyclomatic 23) packages/mermaid/src/diagrams/usecase/parser/usecaseJson.ts:201 — PropertyOrderCollector.readString has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UsecaseModelBuilder.applyMetadataAssignments (cyclomatic 23) · ×1
  • UsecaseModelBuilder.applyMetadataAssignments (cyclomatic 23) packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:620 — UsecaseModelBuilder.applyMetadataAssignments has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · scoreLayout.computeNeighborhoodPreservation (cyclomatic 23) · ×1
  • scoreLayout.computeNeighborhoodPreservation (cyclomatic 23) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts:362 — scoreLayout.computeNeighborhoodPreservation has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · requirementBox.requirementBox (cyclomatic 22) · ×1
  • requirementBox.requirementBox (cyclomatic 22) packages/mermaid/src/rendering-util/rendering-elements/shapes/requirementBox.ts:15 — requirementBox.requirementBox has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · geometry.orthogonalSegmentsCross (cyclomatic 22) · ×1
  • geometry.orthogonalSegmentsCross (cyclomatic 22) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:515 — geometry.orthogonalSegmentsCross has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · router.routeEdgesOrthogonal · ×1
  • router.routeEdgesOrthogonal::crossingPenalty (cyclomatic 22) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:300 — router.routeEdgesOrthogonal::crossingPenalty has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (router.routeEdgesOrthogonal) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · groups.buildGridForest (cyclomatic 22) · ×1
  • groups.buildGridForest (cyclomatic 22) packages/mermaid/src/rendering-util/layout-algorithms/grid/groups.ts:21 — groups.buildGridForest has cyclomatic complexity 22 (threshold 15). Of this number, 15 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routerPlanning.buildEndpointPlan (cyclomatic 22) · ×1
  • routerPlanning.buildEndpointPlan (cyclomatic 22) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:145 — routerPlanning.buildEndpointPlan has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UsecaseModelBuilder.collectElement (cyclomatic 22) · ×1
  • UsecaseModelBuilder.collectElement (cyclomatic 22) packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:358 — UsecaseModelBuilder.collectElement has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · util.labelHelper (cyclomatic 21) · ×1
  • util.labelHelper (cyclomatic 21) packages/mermaid/src/rendering-util/rendering-elements/shapes/util.ts:50 — util.labelHelper has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · layoutData.toLayoutGraph (cyclomatic 21) · ×1
  • layoutData.toLayoutGraph (cyclomatic 21) packages/mermaid/src/rendering-util/layout-algorithms/layered/layoutData.ts:166 — layoutData.toLayoutGraph has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · edges.insertEdgeLabel (cyclomatic 21) · ×1
  • edges.insertEdgeLabel (cyclomatic 21) packages/mermaid/src/rendering-util/rendering-elements/edges.js:78 — edges.insertEdgeLabel has cyclomatic complexity 21 (threshold 15). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentFlowDB.addSubGraph (cyclomatic 21) · ×1
  • AgentFlowDB.addSubGraph (cyclomatic 21) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1150 — AgentFlowDB.addSubGraph has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · QuadrantBuilder.getAxisLabels (cyclomatic 21) · ×1
  • QuadrantBuilder.getAxisLabels (cyclomatic 21) packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts:286 — QuadrantBuilder.getAxisLabels has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · styles.getStyles (cyclomatic 21) · ×1
  • styles.getStyles (cyclomatic 21) packages/mermaid/src/diagrams/state/styles.js:101 — styles.getStyles has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · layout.setBlockSizes (cyclomatic 21) · ×1
  • layout.setBlockSizes (cyclomatic 21) packages/mermaid/src/diagrams/block/layout.ts:72 — layout.setBlockSizes has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · drawActorTypeCollections (cyclomatic 21) · ×1
  • drawActorTypeCollections (cyclomatic 21) packages/mermaid/src/diagrams/sequence/svgDraw.js:516 — drawActorTypeCollections has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · drawActorTypeDatabase (cyclomatic 21) · ×1
  • drawActorTypeDatabase (cyclomatic 21) packages/mermaid/src/diagrams/sequence/svgDraw.js:999 — drawActorTypeDatabase has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sanitizeDirective.sanitizeDirectiveValue (cyclomatic 20) · ×1
  • sanitizeDirective.sanitizeDirectiveValue (cyclomatic 20) packages/mermaid/src/utils/sanitizeDirective.ts:39 — sanitizeDirective.sanitizeDirectiveValue has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · anchoredNodes.pinAnchoredNodes (cyclomatic 20) · ×1
  • anchoredNodes.pinAnchoredNodes (cyclomatic 20) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts:337 — anchoredNodes.pinAnchoredNodes has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentFlowDB.rethrowMetadataYamlError (cyclomatic 20) · ×1
  • AgentFlowDB.rethrowMetadataYamlError (cyclomatic 20) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:586 — AgentFlowDB.rethrowMetadataYamlError has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · gitGraphAst.merge (cyclomatic 20) · ×1
  • gitGraphAst.merge (cyclomatic 20) packages/mermaid/src/diagrams/git/gitGraphAst.ts:152 — gitGraphAst.merge has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · gitGraphAst.cherryPick (cyclomatic 20) · ×1
  • gitGraphAst.cherryPick (cyclomatic 20) packages/mermaid/src/diagrams/git/gitGraphAst.ts:261 — gitGraphAst.cherryPick has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · gitGraphRenderer.drawBranches (cyclomatic 20) · ×1
  • gitGraphRenderer.drawBranches (cyclomatic 20) packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:867 — gitGraphRenderer.drawBranches has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to one function literal inside it that branches (line 878). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · SequenceDB.addActor (cyclomatic 20) · ×1
  • SequenceDB.addActor (cyclomatic 20) packages/mermaid/src/diagrams/sequence/sequenceDb.ts:155 — SequenceDB.addActor has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PropertyOrderCollector.consumeNumber (cyclomatic 20) · ×1
  • PropertyOrderCollector.consumeNumber (cyclomatic 20) packages/mermaid/src/diagrams/usecase/parser/usecaseJson.ts:286 — PropertyOrderCollector.consumeNumber has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · wardleyParser.populateDb (cyclomatic 20) · ×1
  • wardleyParser.populateDb (cyclomatic 20) packages/mermaid/src/diagrams/wardley/wardleyParser.ts:68 — wardleyParser.populateDb has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 99, 148, 174, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · scoreLayout.scoreLayout (cyclomatic 20) · ×1
  • scoreLayout.scoreLayout (cyclomatic 20) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts:503 — scoreLayout.scoreLayout has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layout.calculateEdgePositions (cyclomatic 19) · ×1
  • layout.calculateEdgePositions (cyclomatic 19) packages/mermaid-layout-tidy-tree/src/layout.ts:455 — layout.calculateEdgePositions has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to one function literal inside it that branches (line 465). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · gridPlacement.validateGridPlacementCoordinates (cyclomatic 19) · ×1
  • gridPlacement.validateGridPlacementCoordinates (cyclomatic 19) packages/mermaid/src/utils/gridPlacement.ts:89 — gridPlacement.validateGridPlacementCoordinates has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClassMember.parseMember (cyclomatic 19) · ×1
  • ClassMember.parseMember (cyclomatic 19) packages/mermaid/src/diagrams/class/classTypes.ts:80 — ClassMember.parseMember has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layered.straighten (cyclomatic 19) · ×1
  • layered.straighten (cyclomatic 19) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1812 — layered.straighten has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · c4Db.addRel (cyclomatic 19) · ×1
  • c4Db.addRel (cyclomatic 19) packages/mermaid/src/diagrams/c4/c4Db.ts:86 — c4Db.addRel has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · mermaid-graphlib.adjustClustersAndEdges (cyclomatic 19) · ×1
  • mermaid-graphlib.adjustClustersAndEdges (cyclomatic 19) packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:200 — mermaid-graphlib.adjustClustersAndEdges has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · lineJump.rewriteEdgePath (cyclomatic 19) · ×1
  • lineJump.rewriteEdgePath (cyclomatic 19) packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts:421 — lineJump.rewriteEdgePath has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · render.sanitizeElkEdgePoints (cyclomatic 19) · ×1
  • render.sanitizeElkEdgePoints (cyclomatic 19) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:2504 — render.sanitizeElkEdgePoints has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · phase2.crossLaneAdjust.adjustCrossLaneSources (cyclomatic 19) · ×1
  • phase2.crossLaneAdjust.adjustCrossLaneSources (cyclomatic 19) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.crossLaneAdjust.ts:8 — phase2.crossLaneAdjust.adjustCrossLaneSources has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · edgeLabels.rerouteSegmentAroundRect (cyclomatic 19) · ×1
  • edgeLabels.rerouteSegmentAroundRect (cyclomatic 19) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1691 — edgeLabels.rerouteSegmentAroundRect has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routerSparse.sparseSameContainerRoute (cyclomatic 19) · ×1
  • routerSparse.sparseSameContainerRoute (cyclomatic 19) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:153 — routerSparse.sparseSameContainerRoute has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (routerSparse.sparseSameContainerRoute::searchPairs) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · QuadrantBuilder.getDefaultConfig (cyclomatic 19) · ×1
  • QuadrantBuilder.getDefaultConfig (cyclomatic 19) packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts:153 — QuadrantBuilder.getDefaultConfig has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · sequenceRenderer.buildMessageModel (cyclomatic 19) · ×1
  • sequenceRenderer.buildMessageModel (cyclomatic 19) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1867 — sequenceRenderer.buildMessageModel has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · kanbanDb.addNode (cyclomatic 19) · ×1
  • kanbanDb.addNode (cyclomatic 19) packages/mermaid/src/diagrams/kanban/kanbanDb.ts:99 — kanbanDb.addNode has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · db.calculateSwimlaneProps (cyclomatic 19) · ×1
  • db.calculateSwimlaneProps (cyclomatic 19) packages/mermaid/src/diagrams/eventmodeling/db.ts:233 — db.calculateSwimlaneProps has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · getStyles (cyclomatic 19) · ×1
  • getStyles (cyclomatic 19) packages/mermaid/src/diagrams/git/styles.js:118 — getStyles has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · drawActorTypeParticipant (cyclomatic 19) · ×1
  • drawActorTypeParticipant (cyclomatic 19) packages/mermaid/src/diagrams/sequence/svgDraw.js:391 — drawActorTypeParticipant has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · gridPlacement.sanitizeGridPlacements (cyclomatic 18) · ×1
  • gridPlacement.sanitizeGridPlacements (cyclomatic 18) packages/mermaid/src/utils/gridPlacement.ts:138 — gridPlacement.sanitizeGridPlacements has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · regexes.matchFrontMatter (cyclomatic 18) · ×1
  • regexes.matchFrontMatter (cyclomatic 18) packages/mermaid/src/diagram-api/regexes.ts:135 — regexes.matchFrontMatter has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · anchoredNodes.clearAnchoredOverlaps (cyclomatic 18) · ×1
  • anchoredNodes.clearAnchoredOverlaps (cyclomatic 18) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts:263 — anchoredNodes.clearAnchoredOverlaps has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · driving-tree.buildDrivingTree (cyclomatic 18) · ×1
  • driving-tree.buildDrivingTree (cyclomatic 18) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/driving-tree.ts:34 — driving-tree.buildDrivingTree has cyclomatic complexity 18 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · geometry.segmentsCross (cyclomatic 18) · ×1
  • geometry.segmentsCross (cyclomatic 18) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/geometry.ts:158 — geometry.segmentsCross has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · edgeLabels.labelPlacementWithExtendedDetour (cyclomatic 18) · ×1
  • edgeLabels.labelPlacementWithExtendedDetour (cyclomatic 18) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1897 — edgeLabels.labelPlacementWithExtendedDetour has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routerCompatibility.labelAwareSelfLoopCandidates (cyclomatic 18) · ×1
  • routerCompatibility.labelAwareSelfLoopCandidates (cyclomatic 18) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:489 — routerCompatibility.labelAwareSelfLoopCandidates has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · layout.layoutBlocks (cyclomatic 18) · ×1
  • layout.layoutBlocks (cyclomatic 18) packages/mermaid/src/diagrams/block/layout.ts:209 — layout.layoutBlocks has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UsecaseModelBuilder.applyActorProperty (cyclomatic 18) · ×1
  • UsecaseModelBuilder.applyActorProperty (cyclomatic 18) packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:721 — UsecaseModelBuilder.applyActorProperty has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · svgDraw.drawEdge (cyclomatic 18) · ×1
  • svgDraw.drawEdge (cyclomatic 18) packages/mermaid/src/diagrams/class/svgDraw.js:7 — svgDraw.drawEdge has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · drawActorTypeQueue (cyclomatic 18) · ×1
  • drawActorTypeQueue (cyclomatic 18) packages/mermaid/src/diagrams/sequence/svgDraw.js:641 — drawActorTypeQueue has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · swimlane (cyclomatic 18) · ×1
  • swimlane (cyclomatic 18) packages/mermaid/src/rendering-util/rendering-elements/clusters/swimlane.js:16 — swimlane has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · layout.intersection (cyclomatic 17) · ×1
  • layout.intersection (cyclomatic 17) packages/mermaid-layout-tidy-tree/src/layout.ts:389 — layout.intersection has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · linedCylinder.linedCylinder (cyclomatic 17) · ×1
  • linedCylinder.linedCylinder (cyclomatic 17) packages/mermaid/src/rendering-util/rendering-elements/shapes/linedCylinder.ts:63 — linedCylinder.linedCylinder has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · waveEdgedRectangle.waveEdgedRectangle (cyclomatic 17) · ×1
  • waveEdgedRectangle.waveEdgedRectangle (cyclomatic 17) packages/mermaid/src/rendering-util/rendering-elements/shapes/waveEdgedRectangle.ts:14 — waveEdgedRectangle.waveEdgedRectangle has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · layered.sortByBary (cyclomatic 17) · ×1
  • layered.sortByBary (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:254 — layered.sortByBary has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · render.straightenFront (cyclomatic 17) · ×1
  • render.straightenFront (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1724 — render.straightenFront has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · detourSimplification.simplifyDetouredEdges · ×1
  • detourSimplification.simplifyDetouredEdges::pathConflictCount (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/detourSimplification.ts:75 — detourSimplification.simplifyDetouredEdges::pathConflictCount has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (detourSimplification.simplifyDetouredEdges) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · laneOrdering.buildWeightedLaneEdges (cyclomatic 17) · ×1
  • laneOrdering.buildWeightedLaneEdges (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/laneOrdering.ts:74 — laneOrdering.buildWeightedLaneEdges has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · edgeLabels.labelPlacementWithDetour (cyclomatic 17) · ×1
  • edgeLabels.labelPlacementWithDetour (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1992 — edgeLabels.labelPlacementWithDetour has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routerTopology.buildPairedPortal (cyclomatic 17) · ×1
  • routerTopology.buildPairedPortal (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:941 — routerTopology.buildPairedPortal has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClassDB.getData (cyclomatic 17) · ×1
  • ClassDB.getData (cyclomatic 17) packages/mermaid/src/diagrams/class/classDb.ts:748 — ClassDB.getData has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ArchitectureDB.addEdge (cyclomatic 17) · ×1
  • ArchitectureDB.addEdge (cyclomatic 17) packages/mermaid/src/diagrams/architecture/architectureDb.ts:192 — ArchitectureDB.addEdge has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ArchitectureDB.getDataStructures (cyclomatic 17) · ×1
  • ArchitectureDB.getDataStructures (cyclomatic 17) packages/mermaid/src/diagrams/architecture/architectureDb.ts:293 — ArchitectureDB.getDataStructures has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UsecaseModelBuilder.validateRelationship (cyclomatic 17) · ×1
  • UsecaseModelBuilder.validateRelationship (cyclomatic 17) packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:897 — UsecaseModelBuilder.validateRelationship has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · usecaseRenderer.annotateUsecaseElements (cyclomatic 17) · ×1
  • usecaseRenderer.annotateUsecaseElements (cyclomatic 17) packages/mermaid/src/diagrams/usecase/usecaseRenderer.ts:144 — usecaseRenderer.annotateUsecaseElements has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · parseToLayoutData.stampRendererFields (cyclomatic 17) · ×1
  • parseToLayoutData.stampRendererFields (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/ddlt/parseToLayoutData.ts:38 — parseToLayoutData.stampRendererFields has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · scoreLayout.hasDiagonalRenderedEndpoint (cyclomatic 17) · ×1
  • scoreLayout.hasDiagonalRenderedEndpoint (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts:180 — scoreLayout.hasDiagonalRenderedEndpoint has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · scoreLayout.computeRankFaithfulness (cyclomatic 17) · ×1
  • scoreLayout.computeRankFaithfulness (cyclomatic 17) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts:275 — scoreLayout.computeRankFaithfulness has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · drawActorTypeEntity (cyclomatic 17) · ×1
  • drawActorTypeEntity (cyclomatic 17) packages/mermaid/src/diagrams/sequence/svgDraw.js:891 — drawActorTypeEntity has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · logger.setLogLevel (cyclomatic 16) · ×1
  • logger.setLogLevel (cyclomatic 16) packages/mermaid/src/logger.ts:32 — logger.setLogLevel has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · utils.detectDirective (cyclomatic 16) · ×1
  • utils.detectDirective (cyclomatic 16) packages/mermaid/src/utils.ts:159 — utils.detectDirective has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tiltedCylinder.tiltedCylinder (cyclomatic 16) · ×1
  • tiltedCylinder.tiltedCylinder (cyclomatic 16) packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts:57 — tiltedCylinder.tiltedCylinder has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · layered.sideEnds (cyclomatic 16) · ×1
  • layered.sideEnds (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1058 — layered.sideEnds has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · lineWithOffset.getLineFunctionsWithOffset.x (cyclomatic 16) · ×1
  • lineWithOffset.getLineFunctionsWithOffset.x (cyclomatic 16) packages/mermaid/src/utils/lineWithOffset.ts:62 — lineWithOffset.getLineFunctionsWithOffset.x has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (lineWithOffset.getLineFunctionsWithOffset.y) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · lineWithOffset.getLineFunctionsWithOffset.y (cyclomatic 16) · ×1
  • lineWithOffset.getLineFunctionsWithOffset.y (cyclomatic 16) packages/mermaid/src/utils/lineWithOffset.ts:124 — lineWithOffset.getLineFunctionsWithOffset.y has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (lineWithOffset.getLineFunctionsWithOffset.x) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · mermaid-graphlib.extractor (cyclomatic 16) · ×1
  • mermaid-graphlib.extractor (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:311 — mermaid-graphlib.extractor has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · phase3.ordering.transposeImprove (cyclomatic 16) · ×1
  • phase3.ordering.transposeImprove (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase3.ordering.ts:185 — phase3.ordering.transposeImprove has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · labelSpacing.deriveGridContainerLabelGaps (cyclomatic 16) · ×1
  • labelSpacing.deriveGridContainerLabelGaps (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/labelSpacing.ts:133 — labelSpacing.deriveGridContainerLabelGaps has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · routerPlanning.allocateEndpointSlots (cyclomatic 16) · ×1
  • routerPlanning.allocateEndpointSlots (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:844 — routerPlanning.allocateEndpointSlots has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · routerCompatibility.routeWithinContainer (cyclomatic 16) · ×1
  • routerCompatibility.routeWithinContainer (cyclomatic 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:182 — routerCompatibility.routeWithinContainer has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ganttDb.getStartDate (cyclomatic 16) · ×1
  • ganttDb.getStartDate (cyclomatic 16) packages/mermaid/src/diagrams/gantt/ganttDb.js:305 — ganttDb.getStartDate has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · styles.getStyles (cyclomatic 16) · ×1
  • styles.getStyles (cyclomatic 16) packages/mermaid/src/diagrams/user-journey/styles.js:3 — styles.getStyles has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · timelineRenderer.draw (cyclomatic 16) · ×1
  • timelineRenderer.draw (cyclomatic 16) packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:29 — timelineRenderer.draw has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · styles.genSections (cyclomatic 16) · ×1
  • styles.genSections (cyclomatic 16) packages/mermaid/src/diagrams/mindmap/styles.ts:5 — styles.genSections has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · sankeyRenderer.draw (cyclomatic 16) · ×1
  • sankeyRenderer.draw (cyclomatic 16) packages/mermaid/src/diagrams/sankey/sankeyRenderer.ts:67 — sankeyRenderer.draw has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · runner.matchExpected (cyclomatic 16) · ×1
  • runner.matchExpected (cyclomatic 16) packages/mermaid/src/diagrams/agentflow/conformance/runner.ts:193 — runner.matchExpected has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D10 · Test Quality · Test project verifies nothing · ×1
  • Test project verifies nothing: packages/mermaid-example-diagram packages/mermaid-example-diagram/src/exampleDiagram.spec.js:22 — No conventional assertion call was detected in 1 of 1 tests in `packages/mermaid-example-diagram` — the project as a whole, not one method. Two things look like this: verification that happens indirectly (an approval/verifier harness or BDD step methods), or a suite that genuinely checks nothing. If it is the latter, this project passes unconditionally and cannot fail.
D17 · Explicit Debt · TodoComment repeated across 10 files · ×1
  • TodoComment repeated across 10 files packages/mermaid/src/rendering-util/rendering-elements/shapes/classBox.ts:48 — The identical TodoComment appears in 10 files (10 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 10 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// @ts-ignore TODO: Fix rough typings". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
D17 · Explicit Debt · HackComment · ×1
  • HackComment packages/mermaid/src/diagrams/architecture/architectureRenderer.ts:495 — // Hacky fix for: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose/issues/67 — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D2 · Cognitive Complexity · router.routeEdgesOrthogonal (cognitive 514) · ×1
  • router.routeEdgesOrthogonal (cognitive 514) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141 — router.routeEdgesOrthogonal has cognitive complexity 514 (threshold 15). Drivers by points: if/else 188 (451 pts), ternaries 48 (124 pts), boolean chains 119, loops 56 (104 pts), match/switch 1 (nesting depth added 387). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: 2 other methods here (router.routeEdgesOrthogonal::crossingPenalty, router.routeEdgesOrthogonal::fixPipeCrossings) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · validateLayout.validateLayout (cognitive 424) · ×1
  • validateLayout.validateLayout (cognitive 424) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:553 — validateLayout.validateLayout has cognitive complexity 424 (threshold 15). Drivers by points: if/else 72 (220 pts), ternaries 26 (87 pts), loops 39 (74 pts), boolean chains 43 (nesting depth added 244). Of this number, 411 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · layered.layered (cognitive 334) · ×1
  • layered.layered (cognitive 334) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:297 — layered.layered has cognitive complexity 334 (threshold 15). Drivers by points: if/else 73 (154 pts), loops 59 (99 pts), ternaries 25 (46 pts), boolean chains 35 (nesting depth added 142). Of this number, 301 points are the body's own statements and 33 belong to 13 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · updateColors (cognitive 295) · ×1
  • updateColors (cognitive 295) packages/mermaid/src/themes/theme-base.js:32 — updateColors has cognitive complexity 295 (threshold 15). Drivers by points: boolean chains 262, other 10, if/else 8 (9 pts), loops 6 (8 pts), ternaries 6 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · updateColors (cognitive 221) · ×1
  • updateColors (cognitive 221) packages/mermaid/src/themes/theme-redux-dark.js:76 — updateColors has cognitive complexity 221 (threshold 15). Drivers by points: boolean chains 196, loops 6 (8 pts), if/else 6 (7 pts), ternaries 7, other 3 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · updateColors (cognitive 210) · ×1
  • updateColors (cognitive 210) packages/mermaid/src/themes/theme-redux.js:58 — updateColors has cognitive complexity 210 (threshold 15). Drivers by points: boolean chains 184, loops 7 (9 pts), if/else 6 (7 pts), ternaries 7, other 3 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · updateColors (cognitive 204) · ×1
  • updateColors (cognitive 204) packages/mermaid/src/themes/theme-default.js:146 — updateColors has cognitive complexity 204 (threshold 15). Drivers by points: boolean chains 184, other 10, loops 4 (5 pts), if/else 3, ternaries 2 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · updateColors (cognitive 201) · ×1
  • updateColors (cognitive 201) packages/mermaid/src/themes/theme-redux-color.js:106 — updateColors has cognitive complexity 201 (threshold 15). Drivers by points: boolean chains 178, loops 7, ternaries 7, if/else 4 (5 pts), other 4 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · updateColors (cognitive 200) · ×1
  • updateColors (cognitive 200) packages/mermaid/src/themes/theme-forest.js:113 — updateColors has cognitive complexity 200 (threshold 15). Drivers by points: boolean chains 182, other 10, loops 4, if/else 2, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · updateColors (cognitive 198) · ×1
  • updateColors (cognitive 198) packages/mermaid/src/themes/theme-redux-dark-color.js:108 — updateColors has cognitive complexity 198 (threshold 15). Drivers by points: boolean chains 176, ternaries 7, loops 6, if/else 4 (5 pts), other 4 (nesting depth added 1). Of this number, 197 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · layered.position (cognitive 197) · ×1
  • layered.position (cognitive 197) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2340 — layered.position has cognitive complexity 197 (threshold 15). Drivers by points: if/else 23 (72 pts), loops 30 (62 pts), ternaries 17 (54 pts), boolean chains 9 (nesting depth added 118). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · updateColors (cognitive 188) · ×1
  • updateColors (cognitive 188) packages/mermaid/src/themes/theme-dark.js:115 — updateColors has cognitive complexity 188 (threshold 15). Drivers by points: boolean chains 176, loops 6, other 3, ternaries 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · compound.compoundLayout (cognitive 177) · ×1
  • compound.compoundLayout (cognitive 177) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:467 — compound.compoundLayout has cognitive complexity 177 (threshold 15). Drivers by points: if/else 71 (145 pts), loops 48 (90 pts), ternaries 26 (65 pts), boolean chains 33 (nesting depth added 155). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (compound.compoundLayout::place) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · edgeLabels.positionGridEdgeLabels (cognitive 174) · ×1
  • edgeLabels.positionGridEdgeLabels (cognitive 174) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:2207 — edgeLabels.positionGridEdgeLabels has cognitive complexity 174 (threshold 15). Drivers by points: if/else 39 (112 pts), loops 19 (44 pts), boolean chains 11, ternaries 2 (5 pts), error handling 1 (2 pts) (nesting depth added 102). Of this number, 154 points are the body's own statements and 20 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · updateColors (cognitive 174) · ×1
  • updateColors (cognitive 174) packages/mermaid/src/themes/theme-neutral.js:128 — updateColors has cognitive complexity 174 (threshold 15). Drivers by points: boolean chains 160, loops 6, if/else 2 (3 pts), other 3, ternaries 2 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · compound.routeCrossings (cognitive 154) · ×1
  • compound.routeCrossings (cognitive 154) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:155 — compound.routeCrossings has cognitive complexity 154 (threshold 15). Drivers by points: if/else 19 (54 pts), ternaries 12 (38 pts), loops 18 (36 pts), boolean chains 26 (nesting depth added 79). Of this number, 135 points are the body's own statements and 19 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.separateSharedRenderedTerminalLanes (cognitive 138) · ×1
  • materializedGeometry.separateSharedRenderedTerminalLanes (cognitive 138) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:48 — materializedGeometry.separateSharedRenderedTerminalLanes has cognitive complexity 138 (threshold 15). Drivers by points: if/else 30 (54 pts), ternaries 18 (35 pts), boolean chains 34, loops 5 (15 pts) (nesting depth added 51). Of this number, 57 points are the body's own statements and 81 belong to 14 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.settle (cognitive 125) · ×1
  • layered.settle (cognitive 125) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1306 — layered.settle has cognitive complexity 125 (threshold 15). Drivers by points: if/else 14 (46 pts), loops 11 (38 pts), ternaries 10 (30 pts), boolean chains 11 (nesting depth added 79). Of this number, 114 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · phase4.coordinates.assignCoordinates (cognitive 114) · ×1
  • phase4.coordinates.assignCoordinates (cognitive 114) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase4.coordinates.ts:42 — phase4.coordinates.assignCoordinates has cognitive complexity 114 (threshold 15). Drivers by points: loops 31 (45 pts), if/else 21 (42 pts), ternaries 9 (19 pts), boolean chains 8 (nesting depth added 45). Of this number, 107 points are the body's own statements and 7 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · helpers.writeBackToLayoutData (cognitive 104) · ×1
  • helpers.writeBackToLayoutData (cognitive 104) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/helpers.ts:275 — helpers.writeBackToLayoutData has cognitive complexity 104 (threshold 15). Drivers by points: if/else 20 (56 pts), loops 13 (39 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 64). Of this number, 103 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · routerPlanning.assignDemandCoordinates (cognitive 104) · ×1
  • routerPlanning.assignDemandCoordinates (cognitive 104) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:424 — routerPlanning.assignDemandCoordinates has cognitive complexity 104 (threshold 15). Drivers by points: if/else 19 (43 pts), ternaries 12 (31 pts), boolean chains 24, loops 5 (6 pts) (nesting depth added 44). Of this number, 62 points are the body's own statements and 42 belong to 10 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gitGraphRenderer.drawArrow (cognitive 94) · ×1
  • gitGraphRenderer.drawArrow (cognitive 94) packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:653 — gitGraphRenderer.drawArrow has cognitive complexity 94 (threshold 15). Drivers by points: if/else 38 (82 pts), boolean chains 8, ternaries 2 (4 pts) (nesting depth added 46). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · routerSearch.search (cognitive 93) · ×1
  • routerSearch.search (cognitive 93) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts:309 — routerSearch.search has cognitive complexity 93 (threshold 15). Drivers by points: if/else 35 (47 pts), boolean chains 23, loops 10 (14 pts), ternaries 4 (9 pts) (nesting depth added 21). Of this number, 49 points are the body's own statements and 44 belong to 10 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerSparse.sparseContainerSegment (cognitive 93) · ×1
  • routerSparse.sparseContainerSegment (cognitive 93) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:651 — routerSparse.sparseContainerSegment has cognitive complexity 93 (threshold 15). Drivers by points: if/else 18 (50 pts), boolean chains 21, loops 4 (11 pts), ternaries 4 (10 pts), error handling 1 (nesting depth added 45). Of this number, 87 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · renderer.draw (cognitive 93) · ×1
  • renderer.draw (cognitive 93) packages/mermaid/src/diagrams/treemap/renderer.ts:24 — renderer.draw has cognitive complexity 93 (threshold 15). Drivers by points: if/else 30 (45 pts), ternaries 21 (24 pts), boolean chains 19, loops 3 (4 pts), error handling 1 (nesting depth added 19). Of this number, 25 points are the body's own statements and 68 belong to 18 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.swapDestinationTerminalTailsToReduceCrossings (cognitive 91) · ×1
  • materializedGeometry.swapDestinationTerminalTailsToReduceCrossings (cognitive 91) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1066 — materializedGeometry.swapDestinationTerminalTailsToReduceCrossings has cognitive complexity 91 (threshold 15). Drivers by points: if/else 19 (52 pts), loops 14 (30 pts), boolean chains 8, ternaries 1 (nesting depth added 49). Of this number, 46 points are the body's own statements and 45 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · terminalStub.collapseShortTerminalStub (cognitive 88) · ×1
  • terminalStub.collapseShortTerminalStub (cognitive 88) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/terminalStub.ts:44 — terminalStub.collapseShortTerminalStub has cognitive complexity 88 (threshold 15). Drivers by points: if/else 29 (81 pts), loops 5 (13 pts), boolean chains 12, ternaries 2 (5 pts) (nesting depth added 63). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function. This shape REPEATS in the file: one other method here (terminalStub.collapseShortTerminalStub::segmentCrossesOtherEdge) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · insertEdge (cognitive 85) · ×1
  • insertEdge (cognitive 85) packages/mermaid/src/rendering-util/rendering-elements/edges.js:706 — insertEdge has cognitive complexity 85 (threshold 15). Drivers by points: ternaries 16 (36 pts), if/else 21 (26 pts), boolean chains 16, match/switch 3, other 3, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · wardleyRenderer.draw (cognitive 82) · ×1
  • wardleyRenderer.draw (cognitive 82) packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts:67 — wardleyRenderer.draw has cognitive complexity 82 (threshold 15). Drivers by points: if/else 32 (43 pts), ternaries 19 (21 pts), boolean chains 11, loops 3 (7 pts) (nesting depth added 17). Of this number, 21 points are the body's own statements and 61 belong to 28 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · detourSimplification.simplifyDetouredEdges (cognitive 81) · ×1
  • detourSimplification.simplifyDetouredEdges (cognitive 81) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/detourSimplification.ts:20 — detourSimplification.simplifyDetouredEdges has cognitive complexity 81 (threshold 15). Drivers by points: if/else 32 (86 pts), loops 9 (18 pts), boolean chains 10 (nesting depth added 63). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (detourSimplification.simplifyDetouredEdges::pathConflictCount) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · siblingSharedFaceRouting.straightenCollinearSiblingDetours (cognitive 76) · ×1
  • siblingSharedFaceRouting.straightenCollinearSiblingDetours (cognitive 76) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/siblingSharedFaceRouting.ts:84 — siblingSharedFaceRouting.straightenCollinearSiblingDetours has cognitive complexity 76 (threshold 15). Drivers by points: if/else 26 (59 pts), boolean chains 6, ternaries 4 (6 pts), loops 4 (5 pts) (nesting depth added 36). Of this number, 61 points are the body's own statements and 15 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlowDB.addVertex (cognitive 74) · ×1
  • FlowDB.addVertex (cognitive 74) packages/mermaid/src/diagrams/flowchart/flowDb.ts:188 — FlowDB.addVertex has cognitive complexity 74 (threshold 15). Drivers by points: if/else 39 (65 pts), boolean chains 9 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.reduceCrossings (cognitive 73) · ×1
  • layered.reduceCrossings (cognitive 73) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1965 — layered.reduceCrossings has cognitive complexity 73 (threshold 15). Drivers by points: if/else 44 (110 pts), loops 50 (102 pts), ternaries 22 (30 pts), boolean chains 14 (nesting depth added 126). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 3 other methods here (layered.reduceCrossings::count, layered.reduceCrossings::sweep, layered.reduceCrossings::transpose) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · layoutCore.layoutContainer (cognitive 69) · ×1
  • layoutCore.layoutContainer (cognitive 69) packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts:65 — layoutCore.layoutContainer has cognitive complexity 69 (threshold 15). Drivers by points: ternaries 21 (33 pts), if/else 11 (21 pts), loops 10 (14 pts), boolean chains 1 (nesting depth added 26). Of this number, 68 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · render.findCyclicEntryNodes (cognitive 68) · ×1
  • render.findCyclicEntryNodes (cognitive 68) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:531 — render.findCyclicEntryNodes has cognitive complexity 68 (threshold 15). Drivers by points: if/else 12 (35 pts), loops 11 (24 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 40). Of this number, 56 points are the body's own statements and 12 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.assignTracks · ×1
  • layered.assignTracks::lay (cognitive 67) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1619 — layered.assignTracks::lay has cognitive complexity 67 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 13 (27 pts), ternaries 4 (8 pts), boolean chains 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (layered.assignTracks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AgentFlowDB.addVertex (cognitive 67) · ×1
  • AgentFlowDB.addVertex (cognitive 67) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:322 — AgentFlowDB.addVertex has cognitive complexity 67 (threshold 15). Drivers by points: if/else 33 (49 pts), boolean chains 9, error handling 2 (6 pts), ternaries 1 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentFlowDB.getSemanticModel (cognitive 67) · ×1
  • AgentFlowDB.getSemanticModel (cognitive 67) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:2003 — AgentFlowDB.getSemanticModel has cognitive complexity 67 (threshold 15). Drivers by points: if/else 25 (49 pts), loops 4 (10 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 31). Of this number, 46 points are the body's own statements and 21 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sequenceRenderer.drawMessage (cognitive 67) · ×1
  • sequenceRenderer.drawMessage (cognitive 67) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:461 — sequenceRenderer.drawMessage has cognitive complexity 67 (threshold 15). Drivers by points: if/else 36 (46 pts), boolean chains 21 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · routePath.routePath (cognitive 66) · ×1
  • routePath.routePath (cognitive 66) packages/mermaid/src/rendering-util/rendering-elements/routePath.ts:130 — routePath.routePath has cognitive complexity 66 (threshold 15). Drivers by points: if/else 13 (23 pts), ternaries 10 (22 pts), boolean chains 16, loops 3 (5 pts) (nesting depth added 24). Of this number, 55 points are the body's own statements and 11 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · xychartRenderer.draw (cognitive 65) · ×1
  • xychartRenderer.draw (cognitive 65) packages/mermaid/src/diagrams/xychart/xychartRenderer.ts:13 — xychartRenderer.draw has cognitive complexity 65 (threshold 15). Drivers by points: if/else 10 (26 pts), ternaries 6 (17 pts), loops 4 (12 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 36). Of this number, 23 points are the body's own statements and 42 belong to 12 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.rank (cognitive 64) · ×1
  • layered.rank (cognitive 64) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:948 — layered.rank has cognitive complexity 64 (threshold 15). Drivers by points: if/else 17 (35 pts), loops 15 (21 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GridEdgeRoutingSession.routePlan (cognitive 64) · ×1
  • GridEdgeRoutingSession.routePlan (cognitive 64) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts:399 — GridEdgeRoutingSession.routePlan has cognitive complexity 64 (threshold 15). Drivers by points: ternaries 18 (39 pts), if/else 10 (13 pts), boolean chains 9, loops 2 (3 pts) (nesting depth added 25). Of this number, 44 points are the body's own statements and 20 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · compound.compoundLayout · ×1
  • compound.compoundLayout::place (cognitive 63) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:801 — compound.compoundLayout::place has cognitive complexity 63 (threshold 15). Drivers by points: loops 12 (24 pts), if/else 8 (19 pts), ternaries 7 (14 pts), boolean chains 6 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (compound.compoundLayout) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · portSwap.portSwapToLShape (cognitive 62) · ×1
  • portSwap.portSwapToLShape (cognitive 62) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/portSwap.ts:107 — portSwap.portSwapToLShape has cognitive complexity 62 (threshold 15). Drivers by points: if/else 17 (41 pts), boolean chains 10, ternaries 2 (8 pts), loops 2 (3 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · classBox.classBox (cognitive 60) · ×1
  • classBox.classBox (cognitive 60) packages/mermaid/src/rendering-util/rendering-elements/shapes/classBox.ts:14 — classBox.classBox has cognitive complexity 60 (threshold 15). Drivers by points: if/else 25 (32 pts), boolean chains 19, ternaries 5 (9 pts) (nesting depth added 11). Of this number, 41 points are the body's own statements and 19 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.assignTracks (cognitive 60) · ×1
  • layered.assignTracks (cognitive 60) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1561 — layered.assignTracks has cognitive complexity 60 (threshold 15). Drivers by points: if/else 30 (74 pts), loops 27 (49 pts), boolean chains 19, ternaries 5 (9 pts) (nesting depth added 70). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (layered.assignTracks::lay) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · labelAnchoring.anchorLabelsToPolyline (cognitive 60) · ×1
  • labelAnchoring.anchorLabelsToPolyline (cognitive 60) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/labelAnchoring.ts:84 — labelAnchoring.anchorLabelsToPolyline has cognitive complexity 60 (threshold 15). Drivers by points: if/else 39 (95 pts), ternaries 9 (21 pts), loops 11 (17 pts), boolean chains 13 (nesting depth added 74). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (labelAnchoring.anchorLabelsToPolyline::tryPool) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · routerTopology.buildEndpointRoutingOverlay (cognitive 60) · ×1
  • routerTopology.buildEndpointRoutingOverlay (cognitive 60) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:1099 — routerTopology.buildEndpointRoutingOverlay has cognitive complexity 60 (threshold 15). Drivers by points: ternaries 8 (21 pts), if/else 8 (18 pts), loops 10 (14 pts), boolean chains 7 (nesting depth added 27). Of this number, 43 points are the body's own statements and 17 belong to 8 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · svgDraw.drawEdges (cognitive 59) · ×1
  • svgDraw.drawEdges (cognitive 59) packages/mermaid/src/diagrams/architecture/svgDraw.ts:25 — svgDraw.drawEdges has cognitive complexity 59 (threshold 15). Drivers by points: if/else 23 (37 pts), ternaries 6 (19 pts), boolean chains 3 (nesting depth added 27). None of this is in the body itself: all 59 points belong to one function literal inside it that branches (line 38). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · routerSparse.sparseSelfLoopRoute (cognitive 57) · ×1
  • routerSparse.sparseSelfLoopRoute (cognitive 57) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:464 — routerSparse.sparseSelfLoopRoute has cognitive complexity 57 (threshold 15). Drivers by points: if/else 15 (34 pts), boolean chains 10, loops 3 (6 pts), ternaries 2 (5 pts), error handling 1 (2 pts) (nesting depth added 26). Of this number, 55 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlowDB.getData (cognitive 56) · ×1
  • FlowDB.getData (cognitive 56) packages/mermaid/src/diagrams/flowchart/flowDb.ts:1228 — FlowDB.getData has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (28 pts), loops 11 (14 pts), boolean chains 7, ternaries 7 (nesting depth added 16). Of this number, 37 points are the body's own statements and 19 belong to 5 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · geometry.buildOrthogonalPortPath (cognitive 56) · ×1
  • geometry.buildOrthogonalPortPath (cognitive 56) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:329 — geometry.buildOrthogonalPortPath has cognitive complexity 56 (threshold 15). Drivers by points: boolean chains 25, if/else 11 (22 pts), ternaries 4 (9 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerCompatibility.prepareRoutingModes (cognitive 54) · ×1
  • routerCompatibility.prepareRoutingModes (cognitive 54) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:1033 — routerCompatibility.prepareRoutingModes has cognitive complexity 54 (threshold 15). Drivers by points: if/else 17 (37 pts), boolean chains 12, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 22). Of this number, 49 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · blockDB.populateBlockDatabase (cognitive 54) · ×1
  • blockDB.populateBlockDatabase (cognitive 54) packages/mermaid/src/diagrams/block/blockDB.ts:105 — blockDB.populateBlockDatabase has cognitive complexity 54 (threshold 15). Drivers by points: if/else 20 (48 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · erBox.erBox (cognitive 52) · ×1
  • erBox.erBox (cognitive 52) packages/mermaid/src/rendering-util/rendering-elements/shapes/erBox.ts:19 — erBox.erBox has cognitive complexity 52 (threshold 15). Drivers by points: if/else 26 (35 pts), boolean chains 10, ternaries 2 (4 pts), loops 3 (nesting depth added 11). Of this number, 44 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.alignLabels (cognitive 51) · ×1
  • layered.alignLabels (cognitive 51) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1188 — layered.alignLabels has cognitive complexity 51 (threshold 15). Drivers by points: if/else 6 (22 pts), loops 6 (16 pts), ternaries 7, boolean chains 6 (nesting depth added 26). Of this number, 39 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validation.validateSwimlanesLayout (cognitive 51) · ×1
  • validation.validateSwimlanesLayout (cognitive 51) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/validation.ts:54 — validation.validateSwimlanesLayout has cognitive complexity 51 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 7 (13 pts), boolean chains 5, ternaries 1 (4 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · phase2.crossCounts.computeSubtreeCrossCounts (cognitive 51) · ×1
  • phase2.crossCounts.computeSubtreeCrossCounts (cognitive 51) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.crossCounts.ts:12 — phase2.crossCounts.computeSubtreeCrossCounts has cognitive complexity 51 (threshold 15). Drivers by points: if/else 26 (54 pts), loops 16 (19 pts), boolean chains 6, ternaries 2 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (phase2.crossCounts.computeSubtreeCrossCounts::lcaIndex) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · routerSparse.sparseSameContainerRoute · ×1
  • routerSparse.sparseSameContainerRoute::searchPairs (cognitive 51) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:222 — routerSparse.sparseSameContainerRoute::searchPairs has cognitive complexity 51 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 13, ternaries 4 (7 pts), error handling 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (routerSparse.sparseSameContainerRoute) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AgentFlowDB.getData (cognitive 51) · ×1
  • AgentFlowDB.getData (cognitive 51) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1671 — AgentFlowDB.getData has cognitive complexity 51 (threshold 15). Drivers by points: if/else 18 (29 pts), loops 9 (10 pts), boolean chains 8, ternaries 4 (nesting depth added 12). Of this number, 26 points are the body's own statements and 25 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ArchitectureDB.getDataStructures (cognitive 50) · ×1
  • ArchitectureDB.getDataStructures (cognitive 50) packages/mermaid/src/diagrams/architecture/architectureDb.ts:293 — ArchitectureDB.getDataStructures has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (40 pts), loops 4 (9 pts), boolean chains 1 (nesting depth added 34). Of this number, 33 points are the body's own statements and 17 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cynefinRenderer.draw (cognitive 50) · ×1
  • cynefinRenderer.draw (cognitive 50) packages/mermaid/src/diagrams/cynefin/cynefinRenderer.ts:71 — cynefinRenderer.draw has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (32 pts), ternaries 4 (8 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 20). Of this number, 37 points are the body's own statements and 13 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dataFetcher.dataFetcher (cognitive 49) · ×1
  • dataFetcher.dataFetcher (cognitive 49) packages/mermaid/src/diagrams/state/dataFetcher.ts:241 — dataFetcher.dataFetcher has cognitive complexity 49 (threshold 15). Drivers by points: if/else 22 (44 pts), boolean chains 5 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · c4Db.updateElStyle (cognitive 48) · ×1
  • c4Db.updateElStyle (cognitive 48) packages/mermaid/src/diagrams/c4/c4Db.ts:494 — c4Db.updateElStyle has cognitive complexity 48 (threshold 15). Drivers by points: if/else 29 (39 pts), boolean chains 9 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sequenceRenderer.getMaxMessageWidthPerActor (cognitive 48) · ×1
  • sequenceRenderer.getMaxMessageWidthPerActor (cognitive 48) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1488 — sequenceRenderer.getMaxMessageWidthPerActor has cognitive complexity 48 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 14, ternaries 3 (9 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.snap (cognitive 47) · ×1
  • layered.snap (cognitive 47) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1443 — layered.snap has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 8 (11 pts), ternaries 3 (8 pts), boolean chains 6 (nesting depth added 18). Of this number, 35 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · renderDoc (cognitive 47) · ×1
  • renderDoc (cognitive 47) packages/mermaid/src/diagrams/state/stateRenderer.js:89 — renderDoc has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (31 pts), ternaries 7 (12 pts), boolean chains 2, loops 2 (nesting depth added 18). Of this number, 32 points are the body's own statements and 15 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · index.run (cognitive 45) · ×1
  • index.run (cognitive 45) packages/mermaid/src/rendering-util/layout-algorithms/layered/index.ts:144 — index.run has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 14 (18 pts), if/else 12 (15 pts), boolean chains 9, loops 3 (nesting depth added 7). Most of this is not in the body itself: 10 of the 45 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 185, a function literal at line 302, a function literal at line 237, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · layout.setBlockSizes (cognitive 45) · ×1
  • layout.setBlockSizes (cognitive 45) packages/mermaid/src/diagrams/block/layout.ts:72 — layout.setBlockSizes has cognitive complexity 45 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 6 (15 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · scoreLayout.computeNeighborhoodPreservation (cognitive 45) · ×1
  • scoreLayout.computeNeighborhoodPreservation (cognitive 45) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts:362 — scoreLayout.computeNeighborhoodPreservation has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 5 (10 pts), ternaries 3 (10 pts), boolean chains 4 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · edgeLabels.labelPlacementWithExtendedDetour (cognitive 44) · ×1
  • edgeLabels.labelPlacementWithExtendedDetour (cognitive 44) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1897 — edgeLabels.labelPlacementWithExtendedDetour has cognitive complexity 44 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 4 (9 pts), ternaries 2 (5 pts), boolean chains 2 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.pastLabels (cognitive 43) · ×1
  • layered.pastLabels (cognitive 43) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1888 — layered.pastLabels has cognitive complexity 43 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 8 (18 pts), boolean chains 6 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sharedTrackNudging.nudgeSharedInteriorSubpaths (cognitive 43) · ×1
  • sharedTrackNudging.nudgeSharedInteriorSubpaths (cognitive 43) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/sharedTrackNudging.ts:13 — sharedTrackNudging.nudgeSharedInteriorSubpaths has cognitive complexity 43 (threshold 15). Drivers by points: if/else 27 (57 pts), loops 10 (23 pts), boolean chains 22, ternaries 8 (nesting depth added 43). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (sharedTrackNudging.nudgeSharedInteriorSubpaths::candidateIsSafe) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · sequenceRenderer.draw (cognitive 43) · ×1
  • sequenceRenderer.draw (cognitive 43) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1043 — sequenceRenderer.draw has cognitive complexity 43 (threshold 15). Drivers by points: if/else 20 (26 pts), ternaries 5, boolean chains 4, error handling 1 (3 pts), loops 3, match/switch 1 (2 pts) (nesting depth added 9). Of this number, 38 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · edgeLabels.labelPlacementWithDetour (cognitive 42) · ×1
  • edgeLabels.labelPlacementWithDetour (cognitive 42) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1992 — edgeLabels.labelPlacementWithDetour has cognitive complexity 42 (threshold 15). Drivers by points: if/else 9 (28 pts), loops 4 (9 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsecaseModelBuilder.applyMetadataAssignments (cognitive 42) · ×1
  • UsecaseModelBuilder.applyMetadataAssignments (cognitive 42) packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:620 — UsecaseModelBuilder.applyMetadataAssignments has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 5 (11 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lrTransform.applyLrDirectionTransform (cognitive 41) · ×1
  • lrTransform.applyLrDirectionTransform (cognitive 41) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/lrTransform.ts:269 — lrTransform.applyLrDirectionTransform has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (26 pts), loops 8 (9 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 12). Of this number, 40 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.resolveRenderedOrthogonalCrossings (cognitive 40) · ×1
  • materializedGeometry.resolveRenderedOrthogonalCrossings (cognitive 40) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1915 — materializedGeometry.resolveRenderedOrthogonalCrossings has cognitive complexity 40 (threshold 15). Drivers by points: if/else 53 (110 pts), loops 56 (91 pts), boolean chains 33, ternaries 8 (10 pts), match/switch 1 (nesting depth added 94). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (materializedGeometry.resolveRenderedOrthogonalCrossings::bestPairedReplacement) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · agentflowDb.stripLineTrailingCommas (cognitive 40) · ×1
  • agentflowDb.stripLineTrailingCommas (cognitive 40) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:125 — agentflowDb.stripLineTrailingCommas has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 6, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · edgeLabels.blockedCenterIntervals (cognitive 39) · ×1
  • edgeLabels.blockedCenterIntervals (cognitive 39) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:965 — edgeLabels.blockedCenterIntervals has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 3 (4 pts), boolean chains 3, ternaries 3 (nesting depth added 16). Of this number, 35 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerPlanning.endpointCandidates (cognitive 39) · ×1
  • routerPlanning.endpointCandidates (cognitive 39) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:949 — routerPlanning.endpointCandidates has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 11 (20 pts), boolean chains 9, if/else 7 (9 pts), loops 1 (nesting depth added 11). Of this number, 27 points are the body's own statements and 12 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerConstraint.canonicalizeOrthogonalPolyline (cognitive 39) · ×1
  • routerConstraint.canonicalizeOrthogonalPolyline (cognitive 39) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerConstraint.ts:40 — routerConstraint.canonicalizeOrthogonalPolyline has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 6 (9 pts), boolean chains 6, ternaries 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · genColor (cognitive 39) · ×1
  • genColor (cognitive 39) packages/mermaid/src/diagrams/git/styles.js:30 — genColor has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 6 (22 pts), if/else 7 (11 pts), loops 3 (6 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · phase2.crossLaneAdjust.adjustCrossLaneSources (cognitive 38) · ×1
  • phase2.crossLaneAdjust.adjustCrossLaneSources (cognitive 38) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.crossLaneAdjust.ts:8 — phase2.crossLaneAdjust.adjustCrossLaneSources has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 4 (7 pts), boolean chains 4 (nesting depth added 18). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · groups.buildGridForest (cognitive 38) · ×1
  • groups.buildGridForest (cognitive 38) packages/mermaid/src/rendering-util/layout-algorithms/grid/groups.ts:21 — groups.buildGridForest has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (33 pts), loops 5 (nesting depth added 17). Of this number, 25 points are the body's own statements and 13 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerTopology.buildVisibilityGraph (cognitive 38) · ×1
  • routerTopology.buildVisibilityGraph (cognitive 38) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:796 — routerTopology.buildVisibilityGraph has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 6 (19 pts), loops 6 (10 pts), if/else 2 (5 pts), boolean chains 4 (nesting depth added 20). Of this number, 28 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · svgDraw.drawText (cognitive 38) · ×1
  • svgDraw.drawText (cognitive 38) packages/mermaid/src/diagrams/sequence/svgDraw.js:192 — svgDraw.drawText has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 6, match/switch 2 (4 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · boxDrawingPreprocessor.preprocessBoxDrawing (cognitive 38) · ×1
  • boxDrawingPreprocessor.preprocessBoxDrawing (cognitive 38) packages/mermaid/src/diagrams/treeView/boxDrawingPreprocessor.ts:67 — boxDrawingPreprocessor.preprocessBoxDrawing has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (25 pts), loops 6 (10 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · draw · ×1
  • draw::makeGrid (cognitive 38) packages/mermaid/src/diagrams/gantt/ganttRenderer.js:649 — draw::makeGrid has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (22 pts), match/switch 2 (9 pts), boolean chains 6, other 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gitGraphRenderer.drawCommitBullet (cognitive 37) · ×1
  • gitGraphRenderer.drawCommitBullet (cognitive 37) packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:226 — gitGraphRenderer.drawCommitBullet has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 14 (30 pts), if/else 5 (7 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layout.layoutBlocks (cognitive 36) · ×1
  • layout.layoutBlocks (cognitive 36) packages/mermaid/src/diagrams/block/layout.ts:209 — layout.layoutBlocks has cognitive complexity 36 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PropertyOrderCollector.readString (cognitive 36) · ×1
  • PropertyOrderCollector.readString (cognitive 36) packages/mermaid/src/diagrams/usecase/parser/usecaseJson.ts:201 — PropertyOrderCollector.readString has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (33 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gridPlacement.validateGridPlacementCoordinates (cognitive 35) · ×1
  • gridPlacement.validateGridPlacementCoordinates (cognitive 35) packages/mermaid/src/utils/gridPlacement.ts:89 — gridPlacement.validateGridPlacementCoordinates has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 2 (7 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lineJump.rewriteEdgePath (cognitive 35) · ×1
  • lineJump.rewriteEdgePath (cognitive 35) packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts:421 — lineJump.rewriteEdgePath has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (6 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fixCorners (cognitive 34) · ×1
  • fixCorners (cognitive 34) packages/mermaid/src/rendering-util/rendering-elements/edges.js:632 — fixCorners has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 4 (20 pts), if/else 6 (12 pts), boolean chains 1, loops 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · assignWithDepth.assignWithDepth (cognitive 33) · ×1
  • assignWithDepth.assignWithDepth (cognitive 33) packages/mermaid/src/assignWithDepth.ts:30 — assignWithDepth.assignWithDepth has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 5 (nesting depth added 13). Most of this is not in the body itself: 12 of the 33 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 57, 41). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · layered.straighten (cognitive 33) · ×1
  • layered.straighten (cognitive 33) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1812 — layered.straighten has cognitive complexity 33 (threshold 15). Drivers by points: loops 8 (18 pts), if/else 4 (11 pts), boolean chains 4 (nesting depth added 17). Of this number, 32 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · lineJump.applyLineJumpsToSvg (cognitive 33) · ×1
  • lineJump.applyLineJumpsToSvg (cognitive 33) packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts:653 — lineJump.applyLineJumpsToSvg has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 5, boolean chains 4, ternaries 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.shiftLeftLaneTitleBandsLeftOfRails (cognitive 33) · ×1
  • materializedGeometry.shiftLeftLaneTitleBandsLeftOfRails (cognitive 33) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:926 — materializedGeometry.shiftLeftLaneTitleBandsLeftOfRails has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (20 pts), loops 4 (7 pts), boolean chains 6 (nesting depth added 8). Of this number, 19 points are the body's own statements and 14 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · vennRenderer.draw (cognitive 33) · ×1
  • vennRenderer.draw (cognitive 33) packages/mermaid/src/diagrams/venn/vennRenderer.ts:31 — vennRenderer.draw has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 10, ternaries 4 (5 pts), loops 2 (3 pts) (nesting depth added 6). Most of this is not in the body itself: 14 of the 33 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 121, 173, 220). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · mermaidAPI.renderDiagram (cognitive 32) · ×1
  • mermaidAPI.renderDiagram (cognitive 32) packages/mermaid/src/mermaidAPI.ts:478 — mermaidAPI.renderDiagram has cognitive complexity 32 (threshold 15). Drivers by points: if/else 20 (25 pts), error handling 3, boolean chains 2, ternaries 2 (nesting depth added 5). Of this number, 27 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · lineJump.findEdgeIntersections (cognitive 32) · ×1
  • lineJump.findEdgeIntersections (cognitive 32) packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts:210 — lineJump.findEdgeIntersections has cognitive complexity 32 (threshold 15). Drivers by points: if/else 4 (16 pts), loops 4 (10 pts), ternaries 1 (5 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · render.applyElkEdgeLayout (cognitive 32) · ×1
  • render.applyElkEdgeLayout (cognitive 32) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1966 — render.applyElkEdgeLayout has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 6). Most of this is not in the body itself: 12 of the 32 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 2019, 1988). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · phase2.gravity.assignLayers_Gravity (cognitive 32) · ×1
  • phase2.gravity.assignLayers_Gravity (cognitive 32) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.gravity.ts:18 — phase2.gravity.assignLayers_Gravity has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 6 (7 pts), ternaries 2 (4 pts), boolean chains 3 (nesting depth added 11). Most of this is not in the body itself: 15 of the 32 points are its own statements and the rest belongs to 3 function items inside it that branch (relaxOrder, a function literal at line 30, clampFeasible). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · edgeLabels.rerouteSegmentAroundRect (cognitive 32) · ×1
  • edgeLabels.rerouteSegmentAroundRect (cognitive 32) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1691 — edgeLabels.rerouteSegmentAroundRect has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (26 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · usecaseDb.getData (cognitive 32) · ×1
  • usecaseDb.getData (cognitive 32) packages/mermaid/src/diagrams/usecase/usecaseDb.ts:295 — usecaseDb.getData has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 8 (16 pts), loops 8, boolean chains 4, if/else 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · requirementBox.requirementBox (cognitive 31) · ×1
  • requirementBox.requirementBox (cognitive 31) packages/mermaid/src/rendering-util/rendering-elements/shapes/requirementBox.ts:15 — requirementBox.requirementBox has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 7 (13 pts), boolean chains 3 (nesting depth added 8). Of this number, 26 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · edges.insertEdgeLabel (cognitive 31) · ×1
  • edges.insertEdgeLabel (cognitive 31) packages/mermaid/src/rendering-util/rendering-elements/edges.js:78 — edges.insertEdgeLabel has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 5, ternaries 1 (nesting depth added 9). Of this number, 27 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · subgraphFeedbackEdges.findSubgraphFeedbackEdges (cognitive 31) · ×1
  • subgraphFeedbackEdges.findSubgraphFeedbackEdges (cognitive 31) packages/mermaid/src/rendering-util/layout-algorithms/elk/subgraphFeedbackEdges.ts:42 — subgraphFeedbackEdges.findSubgraphFeedbackEdges has cognitive complexity 31 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 5 (11 pts), boolean chains 2 (nesting depth added 17). Of this number, 27 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layout.intersection (cognitive 30) · ×1
  • layout.intersection (cognitive 30) packages/mermaid-layout-tidy-tree/src/layout.ts:389 — layout.intersection has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 6 (11 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.liftTopLaneTitleBandsAboveRails (cognitive 30) · ×1
  • materializedGeometry.liftTopLaneTitleBandsAboveRails (cognitive 30) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:796 — materializedGeometry.liftTopLaneTitleBandsAboveRails has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 4 (7 pts), boolean chains 6 (nesting depth added 8). Of this number, 18 points are the body's own statements and 12 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.shortcutRedundantOrthogonalJogs (cognitive 30) · ×1
  • materializedGeometry.shortcutRedundantOrthogonalJogs (cognitive 30) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1667 — materializedGeometry.shortcutRedundantOrthogonalJogs has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (39 pts), loops 13 (28 pts), boolean chains 16, ternaries 5 (6 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (materializedGeometry.shortcutRedundantOrthogonalJogs::candidateIsSafe) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · labelSpacing.deriveGridContainerLabelGaps (cognitive 30) · ×1
  • labelSpacing.deriveGridContainerLabelGaps (cognitive 30) packages/mermaid/src/rendering-util/layout-algorithms/grid/labelSpacing.ts:133 — labelSpacing.deriveGridContainerLabelGaps has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (20 pts), boolean chains 5, ternaries 2 (4 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · usecaseRenderer.annotateUsecaseElements (cognitive 30) · ×1
  • usecaseRenderer.annotateUsecaseElements (cognitive 30) packages/mermaid/src/diagrams/usecase/usecaseRenderer.ts:144 — usecaseRenderer.annotateUsecaseElements has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 6 (17 pts), if/else 6 (9 pts), boolean chains 3, loops 1 (nesting depth added 14). Of this number, 26 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · svgDraw.drawRels (cognitive 29) · ×1
  • svgDraw.drawRels (cognitive 29) packages/mermaid/src/diagrams/c4/svgDraw.ts:26 — svgDraw.drawRels has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (17 pts), ternaries 4 (8 pts), boolean chains 3, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.reassignCrossingExternalRailChannels (cognitive 29) · ×1
  • materializedGeometry.reassignCrossingExternalRailChannels (cognitive 29) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1290 — materializedGeometry.reassignCrossingExternalRailChannels has cognitive complexity 29 (threshold 15). Drivers by points: if/else 28 (70 pts), loops 26 (49 pts), ternaries 10 (17 pts), boolean chains 11 (nesting depth added 72). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (materializedGeometry.reassignCrossingExternalRailChannels::externalRailForSegment, materializedGeometry.reassignCrossingExternalRailChannels::candidateIsSafe) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AgentFlowDB.addSubGraph (cognitive 29) · ×1
  • AgentFlowDB.addSubGraph (cognitive 29) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1150 — AgentFlowDB.addSubGraph has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 4, loops 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 9). Of this number, 19 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · drawNode (cognitive 29) · ×1
  • drawNode (cognitive 29) packages/mermaid/src/diagrams/timeline/svgDraw.js:498 — drawNode has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 7 (19 pts), if/else 4 (7 pts), other 3 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · gridPlacement.sanitizeGridPlacements (cognitive 28) · ×1
  • gridPlacement.sanitizeGridPlacements (cognitive 28) packages/mermaid/src/utils/gridPlacement.ts:138 — gridPlacement.sanitizeGridPlacements has cognitive complexity 28 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 3 (6 pts), ternaries 2 (5 pts), boolean chains 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · edges.intersection (cognitive 28) · ×1
  • edges.intersection (cognitive 28) packages/mermaid/src/rendering-util/rendering-elements/edges.js:495 — edges.intersection has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 6 (11 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · endpointClip.snapEndpointToBoundary (cognitive 28) · ×1
  • endpointClip.snapEndpointToBoundary (cognitive 28) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/endpointClip.ts:106 — endpointClip.snapEndpointToBoundary has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerPlanning.buildEndpointPlan (cognitive 28) · ×1
  • routerPlanning.buildEndpointPlan (cognitive 28) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:145 — routerPlanning.buildEndpointPlan has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 5 (10 pts), boolean chains 5, loops 1 (nesting depth added 12). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerPlanning.resolveAmbiguousEndpointSides (cognitive 28) · ×1
  • routerPlanning.resolveAmbiguousEndpointSides (cognitive 28) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:258 — routerPlanning.resolveAmbiguousEndpointSides has cognitive complexity 28 (threshold 15). Drivers by points: loops 8 (11 pts), if/else 5 (9 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 9). Of this number, 19 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scoreLayout.scoreLayout (cognitive 28) · ×1
  • scoreLayout.scoreLayout (cognitive 28) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts:503 — scoreLayout.scoreLayout has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 10 (15 pts), if/else 4 (8 pts), loops 4, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · drawActorTypeCollections (cognitive 28) · ×1
  • drawActorTypeCollections (cognitive 28) packages/mermaid/src/diagrams/sequence/svgDraw.js:516 — drawActorTypeCollections has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (22 pts), ternaries 3, boolean chains 2, other 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · sanitizeDirective.sanitizeDirectiveValue (cognitive 27) · ×1
  • sanitizeDirective.sanitizeDirectiveValue (cognitive 27) packages/mermaid/src/utils/sanitizeDirective.ts:39 — sanitizeDirective.sanitizeDirectiveValue has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · kanbanItem.kanbanItem (cognitive 27) · ×1
  • kanbanItem.kanbanItem (cognitive 27) packages/mermaid/src/rendering-util/rendering-elements/shapes/kanbanItem.ts:23 — kanbanItem.kanbanItem has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 16, if/else 6 (7 pts), ternaries 2 (4 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · sharedTrackNudging.nudgeSharedInteriorSubpaths · ×1
  • sharedTrackNudging.nudgeSharedInteriorSubpaths::candidateIsSafe (cognitive 27) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/sharedTrackNudging.ts:72 — sharedTrackNudging.nudgeSharedInteriorSubpaths::candidateIsSafe has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (7 pts), boolean chains 2, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (sharedTrackNudging.nudgeSharedInteriorSubpaths) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · edgeLabels.polylineHasSelfConflict (cognitive 27) · ×1
  • edgeLabels.polylineHasSelfConflict (cognitive 27) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:92 — edgeLabels.polylineHasSelfConflict has cognitive complexity 27 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 3 (9 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · renderHelpers.insertEdges (cognitive 27) · ×1
  • renderHelpers.insertEdges (cognitive 27) packages/mermaid/src/diagrams/block/renderHelpers.ts:215 — renderHelpers.insertEdges has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 3 (12 pts), if/else 4 (11 pts), boolean chains 2, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · drawActorTypeDatabase (cognitive 27) · ×1
  • drawActorTypeDatabase (cognitive 27) packages/mermaid/src/diagrams/sequence/svgDraw.js:999 — drawActorTypeDatabase has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 5, boolean chains 2, other 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ClassMember.parseMember (cognitive 26) · ×1
  • ClassMember.parseMember (cognitive 26) packages/mermaid/src/diagrams/class/classTypes.ts:80 — ClassMember.parseMember has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 4 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · edges.positionEdgeLabel (cognitive 26) · ×1
  • edges.positionEdgeLabel (cognitive 26) packages/mermaid/src/rendering-util/rendering-elements/edges.js:305 — edges.positionEdgeLabel has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 5 (13 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.collapseRedundantRectangularDoglegs · ×1
  • materializedGeometry.collapseRedundantRectangularDoglegs::candidateIsSafe (cognitive 26) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:444 — materializedGeometry.collapseRedundantRectangularDoglegs::candidateIsSafe has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (materializedGeometry.collapseRedundantRectangularDoglegs) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · gitGraphAst.cherryPick (cognitive 26) · ×1
  • gitGraphAst.cherryPick (cognitive 26) packages/mermaid/src/diagrams/git/gitGraphAst.ts:261 — gitGraphAst.cherryPick has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8, ternaries 3 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · journeyRenderer.drawActorLegend (cognitive 26) · ×1
  • journeyRenderer.drawActorLegend (cognitive 26) packages/mermaid/src/diagrams/user-journey/journeyRenderer.ts:19 — journeyRenderer.drawActorLegend has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 1 (4 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 14). None of this is in the body itself: all 26 points belong to 3 function literals inside it that branch (lines 53, 25, 94). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · kanbanDb.addNode (cognitive 26) · ×1
  • kanbanDb.addNode (cognitive 26) packages/mermaid/src/diagrams/kanban/kanbanDb.ts:99 — kanbanDb.addNode has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 5, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PropertyOrderCollector.consumeNumber (cognitive 26) · ×1
  • PropertyOrderCollector.consumeNumber (cognitive 26) packages/mermaid/src/diagrams/usecase/parser/usecaseJson.ts:286 — PropertyOrderCollector.consumeNumber has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 8, loops 3 (6 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · drawActorTypeParticipant (cognitive 26) · ×1
  • drawActorTypeParticipant (cognitive 26) packages/mermaid/src/diagrams/sequence/svgDraw.js:391 — drawActorTypeParticipant has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 2, other 1, ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · layered.sortByBary (cognitive 25) · ×1
  • layered.sortByBary (cognitive 25) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:254 — layered.sortByBary has cognitive complexity 25 (threshold 15). Drivers by points: loops 9 (20 pts), boolean chains 4, if/else 1 (nesting depth added 11). Of this number, 23 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · layered.alignPorts (cognitive 25) · ×1
  • layered.alignPorts (cognitive 25) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1132 — layered.alignPorts has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 3 (8 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · render.internalEdgePoints (cognitive 25) · ×1
  • render.internalEdgePoints (cognitive 25) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1420 — render.internalEdgePoints has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 3 (11 pts), if/else 2 (6 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · render.straightenEdgeTerminals (cognitive 25) · ×1
  • render.straightenEdgeTerminals (cognitive 25) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1904 — render.straightenEdgeTerminals has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (9 pts), loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 7). Of this number, 19 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.liftObstacleHuggingSameSideRails (cognitive 25) · ×1
  • materializedGeometry.liftObstacleHuggingSameSideRails (cognitive 25) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:587 — materializedGeometry.liftObstacleHuggingSameSideRails has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (38 pts), loops 11 (23 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (materializedGeometry.liftObstacleHuggingSameSideRails::candidateIsSafe) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · phase3.ordering.transposeImprove (cognitive 25) · ×1
  • phase3.ordering.transposeImprove (cognitive 25) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase3.ordering.ts:185 — phase3.ordering.transposeImprove has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (5 pts), boolean chains 4, ternaries 3 (nesting depth added 9). Of this number, 21 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClassDB.getData (cognitive 25) · ×1
  • ClassDB.getData (cognitive 25) packages/mermaid/src/diagrams/class/classDb.ts:748 — ClassDB.getData has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 7 (14 pts), loops 5, if/else 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · vennRenderer.renderTextNodes (cognitive 25) · ×1
  • vennRenderer.renderTextNodes (cognitive 25) packages/mermaid/src/diagrams/venn/vennRenderer.ts:247 — vennRenderer.renderTextNodes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 3 (4 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · drawActorTypeQueue (cognitive 25) · ×1
  • drawActorTypeQueue (cognitive 25) packages/mermaid/src/diagrams/sequence/svgDraw.js:641 — drawActorTypeQueue has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 2, other 1, ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · createContainerGroup (cognitive 25) · ×1
  • createContainerGroup (cognitive 25) packages/mermaid/src/rendering-util/rendering-elements/clusters.js:524 — createContainerGroup has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 3 (5 pts), boolean chains 1, other 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mermaid-graphlib.adjustClustersAndEdges (cognitive 24) · ×1
  • mermaid-graphlib.adjustClustersAndEdges (cognitive 24) packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:200 — mermaid-graphlib.adjustClustersAndEdges has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 4, loops 1 (nesting depth added 7). Of this number, 13 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · geometry.intersection (cognitive 24) · ×1
  • geometry.intersection (cognitive 24) packages/mermaid/src/rendering-util/layout-algorithms/elk/geometry.ts:46 — geometry.intersection has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 6 (11 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · anchoredNodes.clearAnchoredOverlaps (cognitive 24) · ×1
  • anchoredNodes.clearAnchoredOverlaps (cognitive 24) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts:263 — anchoredNodes.clearAnchoredOverlaps has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 6, loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 9). Of this number, 17 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · detourSimplification.simplifyDetouredEdges · ×1
  • detourSimplification.simplifyDetouredEdges::pathConflictCount (cognitive 24) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/detourSimplification.ts:75 — detourSimplification.simplifyDetouredEdges::pathConflictCount has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (detourSimplification.simplifyDetouredEdges) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · driving-tree.buildDrivingTree (cognitive 24) · ×1
  • driving-tree.buildDrivingTree (cognitive 24) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/driving-tree.ts:34 — driving-tree.buildDrivingTree has cognitive complexity 24 (threshold 15). Drivers by points: loops 12 (13 pts), if/else 6 (11 pts) (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · routerPlanning.prepareEdgeRoutes (cognitive 24) · ×1
  • routerPlanning.prepareEdgeRoutes (cognitive 24) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:1043 — routerPlanning.prepareEdgeRoutes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (6 pts), boolean chains 3, ternaries 1 (nesting depth added 10). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QuadrantBuilder.getAxisLabels (cognitive 24) · ×1
  • QuadrantBuilder.getAxisLabels (cognitive 24) packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts:286 — QuadrantBuilder.getAxisLabels has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (16 pts), boolean chains 4, if/else 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sequenceRenderer.calculateLoopBounds (cognitive 24) · ×1
  • sequenceRenderer.calculateLoopBounds (cognitive 24) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:2041 — sequenceRenderer.calculateLoopBounds has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (14 pts), ternaries 2 (6 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 13). Of this number, 19 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · swimlane (cognitive 24) · ×1
  • swimlane (cognitive 24) packages/mermaid/src/rendering-util/rendering-elements/clusters/swimlane.js:16 — swimlane has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 7, other 2, boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · utils.detectDirective (cognitive 23) · ×1
  • utils.detectDirective (cognitive 23) packages/mermaid/src/utils.ts:159 — utils.detectDirective has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (12 pts), if/else 3 (5 pts), boolean chains 4, error handling 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · utils.calculatePoint (cognitive 23) · ×1
  • utils.calculatePoint (cognitive 23) packages/mermaid/src/utils.ts:333 — utils.calculatePoint has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · c4Renderer.drawInsideBoundary (cognitive 23) · ×1
  • c4Renderer.drawInsideBoundary (cognitive 23) packages/mermaid/src/diagrams/c4/c4Renderer.ts:435 — c4Renderer.drawInsideBoundary has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 4, ternaries 1 (3 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · phase3.ordering.reorderLayer (cognitive 23) · ×1
  • phase3.ordering.reorderLayer (cognitive 23) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase3.ordering.ts:110 — phase3.ordering.reorderLayer has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (8 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ganttRenderer.draw · ×1
  • ganttRenderer.draw::drawExcludeDays (cognitive 23) packages/mermaid/src/diagrams/gantt/ganttRenderer.js:547 — ganttRenderer.draw::drawExcludeDays has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ganttRenderer.draw) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · StateDB.addState (cognitive 23) · ×1
  • StateDB.addState (cognitive 23) packages/mermaid/src/diagrams/state/stateDb.ts:398 — StateDB.addState has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), ternaries 4 (8 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · architectureRenderer.getAlignments (cognitive 23) · ×1
  • architectureRenderer.getAlignments (cognitive 23) packages/mermaid/src/diagrams/architecture/architectureRenderer.ts:155 — architectureRenderer.getAlignments has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 4 (7 pts), boolean chains 1 (nesting depth added 8). None of this is in the body itself: all 23 points belong to 3 function items inside it that branch (flattenAlignments, a function literal at line 218, a function literal at line 274). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · usecaseDb.flattenJsonRows · ×1
  • usecaseDb.flattenJsonRows::visit (cognitive 23) packages/mermaid/src/diagrams/usecase/usecaseDb.ts:164 — usecaseDb.flattenJsonRows::visit has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 3 (7 pts), ternaries 2 (7 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.orient (cognitive 22) · ×1
  • layered.orient (cognitive 22) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:908 — layered.orient has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 5 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · c4Db.updateRelStyle (cognitive 22) · ×1
  • c4Db.updateRelStyle (cognitive 22) packages/mermaid/src/diagrams/c4/c4Db.ts:593 — c4Db.updateRelStyle has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5 (nesting depth added 4). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · edgeLabelNodes.createEdgeLabelNodes (cognitive 22) · ×1
  • edgeLabelNodes.createEdgeLabelNodes (cognitive 22) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/edgeLabelNodes.ts:38 — edgeLabelNodes.createEdgeLabelNodes has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4 (8 pts), boolean chains 2, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · laneOrdering.buildWeightedLaneEdges (cognitive 22) · ×1
  • laneOrdering.buildWeightedLaneEdges (cognitive 22) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/laneOrdering.ts:74 — laneOrdering.buildWeightedLaneEdges has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerCompatibility.separateRouteFromOccupied (cognitive 22) · ×1
  • routerCompatibility.separateRouteFromOccupied (cognitive 22) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:80 — routerCompatibility.separateRouteFromOccupied has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 2 (9 pts), loops 3 (6 pts), if/else 2 (5 pts), boolean chains 2 (nesting depth added 13). Of this number, 12 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentFlowDB.rethrowMetadataYamlError (cognitive 22) · ×1
  • AgentFlowDB.rethrowMetadataYamlError (cognitive 22) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:586 — AgentFlowDB.rethrowMetadataYamlError has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, loops 2 (3 pts), ternaries 2, error handling 1 (nesting depth added 6). Of this number, 20 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gitGraphRenderer.drawBranches (cognitive 22) · ×1
  • gitGraphRenderer.drawBranches (cognitive 22) packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:867 — gitGraphRenderer.drawBranches has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 8 (10 pts), boolean chains 1 (nesting depth added 4). None of this is in the body itself: all 22 points belong to one function literal inside it that branches (line 878). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ganttDb.getStartDate (cognitive 22) · ×1
  • ganttDb.getStartDate (cognitive 22) packages/mermaid/src/diagrams/gantt/ganttDb.js:305 — ganttDb.getStartDate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 8). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceDB.apply (cognitive 22) · ×1
  • SequenceDB.apply (cognitive 22) packages/mermaid/src/diagrams/sequence/sequenceDb.ts:557 — SequenceDB.apply has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sequenceRenderer.addActorRenderingData (cognitive 22) · ×1
  • sequenceRenderer.addActorRenderingData (cognitive 22) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:743 — sequenceRenderer.addActorRenderingData has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sequenceRenderer.buildMessageModel (cognitive 22) · ×1
  • sequenceRenderer.buildMessageModel (cognitive 22) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1867 — sequenceRenderer.buildMessageModel has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 4, boolean chains 3 (nesting depth added 5). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scoreLayout.computeRankFaithfulness (cognitive 22) · ×1
  • scoreLayout.computeRankFaithfulness (cognitive 22) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts:275 — scoreLayout.computeRankFaithfulness has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 8 (9 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layoutData.toLayoutGraph (cognitive 21) · ×1
  • layoutData.toLayoutGraph (cognitive 21) packages/mermaid/src/rendering-util/layout-algorithms/layered/layoutData.ts:166 — layoutData.toLayoutGraph has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, ternaries 2 (3 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mermaid-graphlib.extractor (cognitive 21) · ×1
  • mermaid-graphlib.extractor (cognitive 21) packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:311 — mermaid-graphlib.extractor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 3, ternaries 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.resolveRenderedOrthogonalCrossings · ×1
  • materializedGeometry.resolveRenderedOrthogonalCrossings::bestPairedReplacement (cognitive 21) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:2792 — materializedGeometry.resolveRenderedOrthogonalCrossings::bestPairedReplacement has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (10 pts), loops 5 (9 pts), boolean chains 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (materializedGeometry.resolveRenderedOrthogonalCrossings) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · phase2.longestPath.assignLayers_LongestPath (cognitive 21) · ×1
  • phase2.longestPath.assignLayers_LongestPath (cognitive 21) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.longestPath.ts:12 — phase2.longestPath.assignLayers_LongestPath has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (4 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 8). Of this number, 17 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · placement.readGridConfig (cognitive 21) · ×1
  • placement.readGridConfig (cognitive 21) packages/mermaid/src/rendering-util/layout-algorithms/grid/placement.ts:84 — placement.readGridConfig has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 12 (13 pts), boolean chains 7, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · routerConstraint.validateSameContainerRoute (cognitive 21) · ×1
  • routerConstraint.validateSameContainerRoute (cognitive 21) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerConstraint.ts:150 — routerConstraint.validateSameContainerRoute has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ganttDb.getEndDate (cognitive 21) · ×1
  • ganttDb.getEndDate (cognitive 21) packages/mermaid/src/diagrams/gantt/ganttDb.js:409 — ganttDb.getEndDate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SequenceDB.addActor (cognitive 21) · ×1
  • SequenceDB.addActor (cognitive 21) packages/mermaid/src/diagrams/sequence/sequenceDb.ts:155 — SequenceDB.addActor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner.matchExpected (cognitive 21) · ×1
  • runner.matchExpected (cognitive 21) packages/mermaid/src/diagrams/agentflow/conformance/runner.ts:193 — runner.matchExpected has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runner.matchSemanticAssertions (cognitive 21) · ×1
  • runner.matchSemanticAssertions (cognitive 21) packages/mermaid/src/diagrams/agentflow/conformance/runner.ts:254 — runner.matchSemanticAssertions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · scoreLayout.hasDiagonalRenderedEndpoint (cognitive 21) · ×1
  • scoreLayout.hasDiagonalRenderedEndpoint (cognitive 21) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts:180 — scoreLayout.hasDiagonalRenderedEndpoint has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 7, if/else 5 (6 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · regexes.matchFrontMatter (cognitive 20) · ×1
  • regexes.matchFrontMatter (cognitive 20) packages/mermaid/src/diagram-api/regexes.ts:135 — regexes.matchFrontMatter has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 5, boolean chains 3, ternaries 1 (nesting depth added 4). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shapeUtil.addText (cognitive 20) · ×1
  • shapeUtil.addText (cognitive 20) packages/mermaid/src/diagrams/class/shapeUtil.ts:99 — shapeUtil.addText has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · index.check (cognitive 20) · ×1
  • index.check (cognitive 20) packages/mermaid/src/rendering-util/layout-algorithms/layered/index.ts:101 — index.check has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (5 pts) (nesting depth added 7). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · c4Db.addContainer (cognitive 20) · ×1
  • c4Db.addContainer (cognitive 20) packages/mermaid/src/diagrams/c4/c4Db.ts:199 — c4Db.addContainer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 2 other methods here (c4Db.addComponent, c4Db.addDeploymentNode) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · c4Db.addComponent (cognitive 20) · ×1
  • c4Db.addComponent (cognitive 20) packages/mermaid/src/diagrams/c4/c4Db.ts:259 — c4Db.addComponent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 2 other methods here (c4Db.addContainer, c4Db.addDeploymentNode) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · c4Db.addDeploymentNode (cognitive 20) · ×1
  • c4Db.addDeploymentNode (cognitive 20) packages/mermaid/src/diagrams/c4/c4Db.ts:421 — c4Db.addDeploymentNode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level. This shape REPEATS in the file: 2 other methods here (c4Db.addContainer, c4Db.addComponent) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · orthogonalEdgeClipping.outlineEndpoint (cognitive 20) · ×1
  • orthogonalEdgeClipping.outlineEndpoint (cognitive 20) packages/mermaid/src/rendering-util/rendering-elements/orthogonalEdgeClipping.js:19 — orthogonalEdgeClipping.outlineEndpoint has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, ternaries 7, if/else 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · edgeLabels.rerouteLineCandidates (cognitive 20) · ×1
  • edgeLabels.rerouteLineCandidates (cognitive 20) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1303 — edgeLabels.rerouteLineCandidates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 4 (8 pts), loops 2 (nesting depth added 8). Of this number, 13 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerSparse.sparseSameContainerRoute (cognitive 20) · ×1
  • routerSparse.sparseSameContainerRoute (cognitive 20) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:153 — routerSparse.sparseSameContainerRoute has cognitive complexity 20 (threshold 15). Drivers by points: if/else 24 (41 pts), boolean chains 24, ternaries 6 (11 pts), error handling 1 (2 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (routerSparse.sparseSameContainerRoute::searchPairs) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · gitGraphRenderer.drawCommitLabel (cognitive 20) · ×1
  • gitGraphRenderer.drawCommitLabel (cognitive 20) packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:331 — gitGraphRenderer.drawCommitLabel has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5 (nesting depth added 8). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · styles.getStyles (cognitive 20) · ×1
  • styles.getStyles (cognitive 20) packages/mermaid/src/diagrams/state/styles.js:101 — styles.getStyles has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 16, ternaries 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · architectureRenderer.getRelativeConstraints (cognitive 20) · ×1
  • architectureRenderer.getRelativeConstraints (cognitive 20) packages/mermaid/src/diagrams/architecture/architectureRenderer.ts:291 — architectureRenderer.getRelativeConstraints has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2, boolean chains 1 (nesting depth added 11). None of this is in the body itself: all 20 points belong to 3 function literals inside it that branch (lines 324, 308, 345). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · vennRenderer.ensurePairwiseSubsets (cognitive 20) · ×1
  • vennRenderer.ensurePairwiseSubsets (cognitive 20) packages/mermaid/src/diagrams/venn/vennRenderer.ts:393 — vennRenderer.ensurePairwiseSubsets has cognitive complexity 20 (threshold 15). Drivers by points: if/else 2 (6 pts), loops 3 (6 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 11). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsecaseModelBuilder.collectElement (cognitive 20) · ×1
  • UsecaseModelBuilder.collectElement (cognitive 20) packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:358 — UsecaseModelBuilder.collectElement has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 3 (6 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · measureDagreGraph (cognitive 20) · ×1
  • measureDagreGraph (cognitive 20) packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:259 — measureDagreGraph has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), other 4, boolean chains 2 (nesting depth added 3). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 294, a function literal at line 377, processEdges). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · createText.createText (cognitive 19) · ×1
  • createText.createText (cognitive 19) packages/mermaid/src/rendering-util/createText.ts:306 — createText.createText has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 4 (8 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · util.labelHelper (cognitive 19) · ×1
  • util.labelHelper (cognitive 19) packages/mermaid/src/rendering-util/rendering-elements/shapes/util.ts:50 — util.labelHelper has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 7, ternaries 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · edgeMarker.addEdgeMarker (cognitive 19) · ×1
  • edgeMarker.addEdgeMarker (cognitive 19) packages/mermaid/src/rendering-util/rendering-elements/edgeMarker.ts:73 — edgeMarker.addEdgeMarker has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, ternaries 2 (nesting depth added 6). Of this number, 15 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · render.sanitizeElkEdgePoints (cognitive 19) · ×1
  • render.sanitizeElkEdgePoints (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:2504 — render.sanitizeElkEdgePoints has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), ternaries 1 (nesting depth added 2). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · geometry.orthogonalSegmentsCross (cognitive 19) · ×1
  • geometry.orthogonalSegmentsCross (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:515 — geometry.orthogonalSegmentsCross has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 14, if/else 3, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · materializedGeometry.collapseRedundantRectangularDoglegs (cognitive 19) · ×1
  • materializedGeometry.collapseRedundantRectangularDoglegs (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:433 — materializedGeometry.collapseRedundantRectangularDoglegs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (33 pts), loops 7 (13 pts), boolean chains 9 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (materializedGeometry.collapseRedundantRectangularDoglegs::candidateIsSafe) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · materializedGeometry.shortcutRedundantOrthogonalJogs · ×1
  • materializedGeometry.shortcutRedundantOrthogonalJogs::candidateIsSafe (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1827 — materializedGeometry.shortcutRedundantOrthogonalJogs::candidateIsSafe has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (materializedGeometry.shortcutRedundantOrthogonalJogs) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · geometry.mergeCollinear (cognitive 19) · ×1
  • geometry.mergeCollinear (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/geometry.ts:61 — geometry.mergeCollinear has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · labelSpacing.buildGridLabelRequirements (cognitive 19) · ×1
  • labelSpacing.buildGridLabelRequirements (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/grid/labelSpacing.ts:28 — labelSpacing.buildGridLabelRequirements has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · edgeLabels.placementOnExistingSegmentWithReroutes (cognitive 19) · ×1
  • edgeLabels.placementOnExistingSegmentWithReroutes (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1137 — edgeLabels.placementOnExistingSegmentWithReroutes has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 pts), ternaries 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerCompatibility.routeWithinContainer (cognitive 19) · ×1
  • routerCompatibility.routeWithinContainer (cognitive 19) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:182 — routerCompatibility.routeWithinContainer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ganttRenderer.draw (cognitive 19) · ×1
  • ganttRenderer.draw (cognitive 19) packages/mermaid/src/diagrams/gantt/ganttRenderer.js:85 — ganttRenderer.draw has cognitive complexity 19 (threshold 15). Drivers by points: if/else 85 (117 pts), loops 13 (17 pts), boolean chains 14, match/switch 2 (9 pts), ternaries 4 (5 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (ganttRenderer.draw::drawExcludeDays) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · quadrantDb.parseStyles (cognitive 19) · ×1
  • quadrantDb.parseStyles (cognitive 19) packages/mermaid/src/diagrams/quadrant-chart/quadrantDb.ts:64 — quadrantDb.parseStyles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sequenceRenderer.adjustCreatedDestroyedData (cognitive 19) · ×1
  • sequenceRenderer.adjustCreatedDestroyedData (cognitive 19) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:946 — sequenceRenderer.adjustCreatedDestroyedData has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 3 (8 pts) (nesting depth added 7). Of this number, 15 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · timelineRenderer.draw (cognitive 19) · ×1
  • timelineRenderer.draw (cognitive 19) packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:29 — timelineRenderer.draw has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 5). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · architectureRenderer.layoutArchitecture (cognitive 19) · ×1
  • architectureRenderer.layoutArchitecture (cognitive 19) packages/mermaid/src/diagrams/architecture/architectureRenderer.ts:375 — architectureRenderer.layoutArchitecture has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (7 pts), ternaries 3 (6 pts), boolean chains 2, match/switch 2, error handling 1, loops 1 (nesting depth added 7). None of this is in the body itself: all 19 points belong to 3 function literals inside it that branch (lines 513, 383, 514). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · UsecaseVisitor.entityName (cognitive 19) · ×1
  • UsecaseVisitor.entityName (cognitive 19) packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts:288 — UsecaseVisitor.entityName has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (16 pts), boolean chains 2, if/else 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layout.calculateEdgePositions (cognitive 18) · ×1
  • layout.calculateEdgePositions (cognitive 18) packages/mermaid-layout-tidy-tree/src/layout.ts:455 — layout.calculateEdgePositions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 4, boolean chains 1 (nesting depth added 2). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 465). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · tiltedCylinder.tiltedCylinder (cognitive 18) · ×1
  • tiltedCylinder.tiltedCylinder (cognitive 18) packages/mermaid/src/rendering-util/rendering-elements/shapes/tiltedCylinder.ts:57 — tiltedCylinder.tiltedCylinder has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layered.spread (cognitive 18) · ×1
  • layered.spread (cognitive 18) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1095 — layered.spread has cognitive complexity 18 (threshold 15). Drivers by points: loops 3 (6 pts), ternaries 2 (6 pts), if/else 2 (5 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · materializedGeometry.liftObstacleHuggingSameSideRails · ×1
  • materializedGeometry.liftObstacleHuggingSameSideRails::candidateIsSafe (cognitive 18) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:709 — materializedGeometry.liftObstacleHuggingSameSideRails::candidateIsSafe has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 4 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (materializedGeometry.liftObstacleHuggingSameSideRails) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · labelAnchoring.anchorLabelsToPolyline · ×1
  • labelAnchoring.anchorLabelsToPolyline::tryPool (cognitive 18) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/labelAnchoring.ts:387 — labelAnchoring.anchorLabelsToPolyline::tryPool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (labelAnchoring.anchorLabelsToPolyline) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · phase2.crossOptimization.optimizeRanksByCrossings (cognitive 18) · ×1
  • phase2.crossOptimization.optimizeRanksByCrossings (cognitive 18) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.crossOptimization.ts:62 — phase2.crossOptimization.optimizeRanksByCrossings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (6 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · edgeLabels.prepareGridLayout (cognitive 18) · ×1
  • edgeLabels.prepareGridLayout (cognitive 18) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:2150 — edgeLabels.prepareGridLayout has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 3 (7 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerTopology.buildPairedPortal (cognitive 18) · ×1
  • routerTopology.buildPairedPortal (cognitive 18) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:941 — routerTopology.buildPairedPortal has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 6, if/else 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerConstraint.validateContainerSegment (cognitive 18) · ×1
  • routerConstraint.validateContainerSegment (cognitive 18) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerConstraint.ts:207 — routerConstraint.validateContainerSegment has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shapes.normaliseNodeShapes (cognitive 18) · ×1
  • shapes.normaliseNodeShapes (cognitive 18) packages/mermaid/src/diagrams/agentflow/shapes.ts:114 — shapes.normaliseNodeShapes has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gitGraphAst.merge (cognitive 18) · ×1
  • gitGraphAst.merge (cognitive 18) packages/mermaid/src/diagrams/git/gitGraphAst.ts:152 — gitGraphAst.merge has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 5, ternaries 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · QuadrantBuilder.getDefaultConfig (cognitive 18) · ×1
  • QuadrantBuilder.getDefaultConfig (cognitive 18) packages/mermaid/src/diagrams/quadrant-chart/quadrantBuilder.ts:153 — QuadrantBuilder.getDefaultConfig has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 18. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ishikawaRenderer.draw (cognitive 18) · ×1
  • ishikawaRenderer.draw (cognitive 18) packages/mermaid/src/diagrams/ishikawa/ishikawaRenderer.ts:36 — ishikawaRenderer.draw has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), ternaries 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · scoreLayout.evaluateThresholds (cognitive 18) · ×1
  • scoreLayout.evaluateThresholds (cognitive 18) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/scoreLayout.ts:461 — scoreLayout.evaluateThresholds has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · getStyles (cognitive 18) · ×1
  • getStyles (cognitive 18) packages/mermaid/src/diagrams/git/styles.js:118 — getStyles has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 17, other 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · drawActorTypeEntity (cognitive 18) · ×1
  • drawActorTypeEntity (cognitive 18) packages/mermaid/src/diagrams/sequence/svgDraw.js:891 — drawActorTypeEntity has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, ternaries 7 (8 pts), other 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · clipOrthogonalEndpointsToNodeOutlines (cognitive 18) · ×1
  • clipOrthogonalEndpointsToNodeOutlines (cognitive 18) packages/mermaid/src/rendering-util/rendering-elements/orthogonalEdgeClipping.js:81 — clipOrthogonalEndpointsToNodeOutlines has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, other 2, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · docs.processDocs (cognitive 17) · ×1
  • docs.processDocs (cognitive 17) packages/mermaid/scripts/docs.mts:643 — docs.processDocs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 1, ternaries 1 (nesting depth added 4). Of this number, 11 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · c4Db.addRel (cognitive 17) · ×1
  • c4Db.addRel (cognitive 17) packages/mermaid/src/diagrams/c4/c4Db.ts:86 — c4Db.addRel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4 (nesting depth added 2). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FlowDB.addSubGraph (cognitive 17) · ×1
  • FlowDB.addSubGraph (cognitive 17) packages/mermaid/src/diagrams/flowchart/flowDb.ts:749 — FlowDB.addSubGraph has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, ternaries 2 (4 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 3). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 766). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · mermaid.runThrowsErrors (cognitive 17) · ×1
  • mermaid.runThrowsErrors (cognitive 17) packages/mermaid/src/mermaid.ts:130 — mermaid.runThrowsErrors has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createGraph.createGraphWithElements (cognitive 17) · ×1
  • createGraph.createGraphWithElements (cognitive 17) packages/mermaid/src/rendering-util/createGraph.ts:123 — createGraph.createGraphWithElements has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 6). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 161). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · anchoredNodes.squareAnchoredEdges (cognitive 17) · ×1
  • anchoredNodes.squareAnchoredEdges (cognitive 17) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts:453 — anchoredNodes.squareAnchoredEdges has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · geometry.segmentConflictsWithAnyEdge (cognitive 17) · ×1
  • geometry.segmentConflictsWithAnyEdge (cognitive 17) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:576 — geometry.segmentConflictsWithAnyEdge has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · geometry.orthogonalizePolyline (cognitive 17) · ×1
  • geometry.orthogonalizePolyline (cognitive 17) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:684 — geometry.orthogonalizePolyline has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 2 (4 pts), boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · edgeLabels.queryForeignSegments (cognitive 17) · ×1
  • edgeLabels.queryForeignSegments (cognitive 17) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:781 — edgeLabels.queryForeignSegments has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 8). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · placement.resolveGridPlacements (cognitive 17) · ×1
  • placement.resolveGridPlacements (cognitive 17) packages/mermaid/src/rendering-util/layout-algorithms/grid/placement.ts:281 — placement.resolveGridPlacements has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerTopology.unionObstacles (cognitive 17) · ×1
  • routerTopology.unionObstacles (cognitive 17) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:462 — routerTopology.unionObstacles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 5 (8 pts), boolean chains 1 (nesting depth added 8). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClassDB.setClickFunc (cognitive 17) · ×1
  • ClassDB.setClickFunc (cognitive 17) packages/mermaid/src/diagrams/class/classDb.ts:446 — ClassDB.setClickFunc has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 8). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · parser.populate (cognitive 17) · ×1
  • parser.populate (cognitive 17) packages/mermaid/src/diagrams/packet/parser.ts:11 — parser.populate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsecaseModelBuilder.applyActorProperty (cognitive 17) · ×1
  • UsecaseModelBuilder.applyActorProperty (cognitive 17) packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:721 — UsecaseModelBuilder.applyActorProperty has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · usecaseRenderer.prepareUsecaseLayoutData (cognitive 17) · ×1
  • usecaseRenderer.prepareUsecaseLayoutData (cognitive 17) packages/mermaid/src/diagrams/usecase/usecaseRenderer.ts:100 — usecaseRenderer.prepareUsecaseLayoutData has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · drawLoop (cognitive 17) · ×1
  • drawLoop (cognitive 17) packages/mermaid/src/diagrams/sequence/svgDraw.js:1519 — drawLoop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 2, loops 1 (2 pts), ternaries 2, other 1 (nesting depth added 6). Of this number, 16 points are the body's own statements and 1 belongs to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · stateEnd.stateEnd (cognitive 16) · ×1
  • stateEnd.stateEnd (cognitive 16) packages/mermaid/src/rendering-util/rendering-elements/shapes/stateEnd.ts:8 — stateEnd.stateEnd has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · compound.inheritCrossedDirections (cognitive 16) · ×1
  • compound.inheritCrossedDirections (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:398 — compound.inheritCrossedDirections has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 7). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · c4Renderer.drawRels (cognitive 16) · ×1
  • c4Renderer.drawRels (cognitive 16) packages/mermaid/src/diagrams/c4/c4Renderer.ts:387 — c4Renderer.drawRels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lanes.buildLaneModel (cognitive 16) · ×1
  • lanes.buildLaneModel (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/lanes.ts:27 — lanes.buildLaneModel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · endpointClip.snapAndCollapseEndpoints (cognitive 16) · ×1
  • endpointClip.snapAndCollapseEndpoints (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/endpointClip.ts:406 — endpointClip.snapAndCollapseEndpoints has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · terminalStub.collapseShortTerminalStub · ×1
  • terminalStub.collapseShortTerminalStub::segmentCrossesOtherEdge (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/terminalStub.ts:159 — terminalStub.collapseShortTerminalStub::segmentCrossesOtherEdge has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (terminalStub.collapseShortTerminalStub) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · phase2.crossCounts.computeSubtreeCrossCounts · ×1
  • phase2.crossCounts.computeSubtreeCrossCounts::lcaIndex (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.crossCounts.ts:95 — phase2.crossCounts.computeSubtreeCrossCounts::lcaIndex has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (phase2.crossCounts.computeSubtreeCrossCounts) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · geometry.segmentsCross (cognitive 16) · ×1
  • geometry.segmentsCross (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/geometry.ts:158 — geometry.segmentsCross has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (5 pts), ternaries 2 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · edgeLabels.createEdgeLabelContext (cognitive 16) · ×1
  • edgeLabels.createEdgeLabelContext (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:668 — edgeLabels.createEdgeLabelContext has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerTopology.createIntervalIndex (cognitive 16) · ×1
  • routerTopology.createIntervalIndex (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:636 — routerTopology.createIntervalIndex has cognitive complexity 16 (threshold 15). Drivers by points: loops 4 (6 pts), ternaries 4 (6 pts), if/else 2 (4 pts) (nesting depth added 6). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · routerPlanning.allocateEndpointSlots (cognitive 16) · ×1
  • routerPlanning.allocateEndpointSlots (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:844 — routerPlanning.allocateEndpointSlots has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 5 (6 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 3). Of this number, 10 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RouteOccupancyIndex.conflicts (cognitive 16) · ×1
  • RouteOccupancyIndex.conflicts (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerOccupancy.ts:91 — RouteOccupancyIndex.conflicts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · layoutCore.materializeAbsoluteGeometry (cognitive 16) · ×1
  • layoutCore.materializeAbsoluteGeometry (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts:324 — layoutCore.materializeAbsoluteGeometry has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentFlowDB.addSingleLink (cognitive 16) · ×1
  • AgentFlowDB.addSingleLink (cognitive 16) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:703 — AgentFlowDB.addSingleLink has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3 (nesting depth added 3). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ErDB.addCssStyles (cognitive 16) · ×1
  • ErDB.addCssStyles (cognitive 16) packages/mermaid/src/diagrams/er/erDb.ts:184 — ErDB.addCssStyles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LinePlot.getDrawableElement (cognitive 16) · ×1
  • LinePlot.getDrawableElement (cognitive 16) packages/mermaid/src/diagrams/xychart/chartBuilder/components/plot/linePlot.ts:14 — LinePlot.getDrawableElement has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sequenceRenderer.drawCentralConnection (cognitive 16) · ×1
  • sequenceRenderer.drawCentralConnection (cognitive 16) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:288 — sequenceRenderer.drawCentralConnection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (3 pts), ternaries 2 (nesting depth added 7). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sequenceRenderer.calculateActorMargins (cognitive 16) · ×1
  • sequenceRenderer.calculateActorMargins (cognitive 16) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1614 — sequenceRenderer.calculateActorMargins has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 5). Of this number, 13 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ishikawaRenderer.drawBranch (cognitive 16) · ×1
  • ishikawaRenderer.drawBranch (cognitive 16) packages/mermaid/src/diagrams/ishikawa/ishikawaRenderer.ts:345 — ishikawaRenderer.drawBranch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · parser.populate (cognitive 16) · ×1
  • parser.populate (cognitive 16) packages/mermaid/src/diagrams/treemap/parser.ts:13 — parser.populate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (6 pts), ternaries 3 (6 pts), loops 3, boolean chains 1 (nesting depth added 6). Of this number, 12 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsecaseModelBuilder.validateAndRefreshElements (cognitive 16) · ×1
  • UsecaseModelBuilder.validateAndRefreshElements (cognitive 16) packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:760 — UsecaseModelBuilder.validateAndRefreshElements has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsecaseModelBuilder.getStylable (cognitive 16) · ×1
  • UsecaseModelBuilder.getStylable (cognitive 16) packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:871 — UsecaseModelBuilder.getStylable has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · wardleyParser.populateDb (cognitive 16) · ×1
  • wardleyParser.populateDb (cognitive 16) packages/mermaid/src/diagrams/wardley/wardleyParser.ts:68 — wardleyParser.populateDb has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 4, ternaries 4 (nesting depth added 1). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 174, 99, 138, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · validateLayout.nearEndpointBandDistance (cognitive 16) · ×1
  • validateLayout.nearEndpointBandDistance (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:512 — validateLayout.nearEndpointBandDistance has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 4 (6 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · usecaseSystemBoundary (cognitive 16) · ×1
  • usecaseSystemBoundary (cognitive 16) packages/mermaid/src/rendering-util/rendering-elements/clusters.js:688 — usecaseSystemBoundary has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · getSelfLoopSide (cognitive 16) · ×1
  • getSelfLoopSide (cognitive 16) packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:61 — getSelfLoopSide has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (4 pts), boolean chains 2, other 1 (nesting depth added 3). Of this number, 8 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D35 · Change Coupling · Change-coupling hub · ×1
  • Change-coupling hub: textDimensionCalculator.ts → index.ts, orchestrator.ts, xychartDb.ts packages/mermaid/src/diagrams/xychart/chartBuilder/textDimensionCalculator.ts — `packages/mermaid/src/diagrams/xychart/chartBuilder/textDimensionCalculator.ts` changes together with 3 other files — `packages/mermaid/src/diagrams/xychart/chartBuilder/index.ts`, `packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts`, `packages/mermaid/src/diagrams/xychart/xychartDb.ts` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: @mermaid-js/parser — @mermaid-js/parser: abstractness 0.04, instability 0.00, distance 0.96 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
IC1 · Incompleteness & stubs · Hollow method · ×1
  • Hollow method — returns a constant without doing the work packages/mermaid/src/diagrams/eventmodeling/styles.js:1 — `getStyles` looks like it should compute a result but its body just returns a constant — a placeholder return that was never filled in.
P12 · CI test-gate honesty · Coverage collected but not gated · ×1
  • Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
P5 · DR & Backup · No DR/backup evidence · ×1
  • No DR/backup evidence — A persistence guard (data volume / purge-protection) was found, but no backup, geo-recovery or RTO/RPO controls were evidenced — a volume that survives a container recreate is not a tested restore from catastrophic loss.
R10 · Code Duplication · Duplication concentrated across 34 sibling directories (94 clone groups) · ×1
  • Duplication concentrated across 34 sibling directories (94 clone groups) packages/mermaid/src/diagrams/timeline/svgDraw.js:19 — 94 duplicated blocks under packages/mermaid/src/diagrams/ have copies in at least two of the sibling directories agentflow, architecture, block, c4, class, common (+28 more sibling(s) not listed) — 78 of them are reported below, and 16 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 94 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 94 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 94 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 2 sibling directories (17 clone groups) · ×1
  • Duplication concentrated across 2 sibling directories (17 clone groups) packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:1022 — 17 duplicated blocks under packages/mermaid/src/ have copies in at least two of the sibling directories diagrams, rendering-util — 11 of them are reported below, and 6 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 17 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 17 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 17 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 5 sibling directories (17 clone groups) · ×1
  • Duplication concentrated across 5 sibling directories (17 clone groups) packages/mermaid/src/rendering-util/layout-algorithms/elk/lineHops.ts:26 — 17 duplicated blocks under packages/mermaid/src/rendering-util/layout-algorithms/ have copies in at least two of the sibling directories ddlt, elk, grid, layout-utils, swimlanes — 9 of them are reported below, and 8 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 17 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 17 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 17 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 14 sibling directories (12 clone groups) · ×1
  • Duplication concentrated across 14 sibling directories (12 clone groups) packages/parser/src/language/railroad-peg/valueConverter.ts:5 — 12 duplicated blocks under packages/parser/src/language/ have copies in at least two of the sibling directories architecture, cynefin, eventmodeling, gitGraph, info, packet (+8 more sibling(s) not listed) — 8 of them are reported below, and 4 are counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 12 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 12 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 12 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Duplication concentrated across 4 sibling directories (10 clone groups) · ×1
  • Duplication concentrated across 4 sibling directories (10 clone groups) packages/mermaid-layout-tidy-tree/src/render.ts:11 — 10 duplicated blocks under packages/ have copies in at least two of the sibling directories mermaid, mermaid-example-diagram, mermaid-layout-tidy-tree, mermaid-zenuml — 9 of them are reported below, and 1 is counted here but not reported individually: those copies match on shape but no longer clear R10's bar for an individually reported row — either they kept neither their own names nor their values, or what was copied is too small to stand on its own (it reports near-exact duplication only, and only of substantial extent). What this row states is the concentration, which the detector measured over all 10 and which does not depend on how exactly each block's copies still match. That concentration is one structural fact, not 10 local ones: the siblings replicate behaviour none of them owns, which is the shape of a missing shared module — a common library every sibling imports — rather than 10 separate extractions. Check first whether the siblings are deliberately standalone deliverables (scaffold templates, demo apps that must stay copy-pasteable); where they are, the duplication is the design and the per-block rows are the ones to act on.
R10 · Code Duplication · Wholesale file copy (291 identical lines × 2 files) · ×1
  • Wholesale file copy (291 identical lines × 2 files) packages/mermaid/src/themes/theme-neo-dark.js:1 — packages/mermaid/src/themes/theme-neo-dark.js:1 · packages/mermaid/src/themes/theme-redux-dark.js:1 — these 2 files are line-for-line copies of one another — 291 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Wholesale file copy (279 identical lines × 2 files) · ×1
  • Wholesale file copy (279 identical lines × 2 files) packages/mermaid/src/themes/theme-redux-dark-color.js:1 — packages/mermaid/src/themes/theme-redux-dark-color.js:1 · packages/mermaid/src/themes/theme-redux-dark.js:1 — these 2 files are line-for-line copies of one another — 279 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (278 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (278 matched lines × 2 locations) packages/mermaid/src/diagrams/timeline/svgDraw.js:19 — packages/mermaid/src/diagrams/timeline/svgDraw.js:19 · packages/mermaid/src/diagrams/user-journey/svgDraw.js:5 — the two spans are one implementation copied and then locally edited — 1894 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (247 identical lines × 3 files) · ×1
  • Wholesale file copy (247 identical lines × 3 files) packages/mermaid/src/themes/theme-neo.js:1 — packages/mermaid/src/themes/theme-neo.js:1 · packages/mermaid/src/themes/theme-redux-color.js:1 · packages/mermaid/src/themes/theme-redux.js:1 — these 3 files are line-for-line copies of one another — 247 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (147 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (147 matched lines × 2 locations) packages/mermaid/src/themes/theme-default.js:164 — packages/mermaid/src/themes/theme-default.js:164 · packages/mermaid/src/themes/theme-forest.js:140 — the two spans are one implementation copied and then locally edited — 1875 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (141 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (141 matched lines × 2 locations) packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:11 — packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:11 · packages/mermaid/src/diagrams/timeline/timelineRendererVertical.ts:11 — the two spans are one implementation copied and then locally edited — 857 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (115 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (115 matched lines × 2 locations) packages/mermaid/src/diagrams/c4/svgDraw.ts:215 — packages/mermaid/src/diagrams/c4/svgDraw.ts:215 · packages/mermaid/src/diagrams/sequence/svgDraw.js:1633 — the two spans are one implementation copied and then locally edited — 645 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (112 lines × 2 locations) · ×1
  • Duplicated block (112 lines × 2 locations) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:816 — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:816 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:458 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Wholesale file copy (91 identical lines × 3 files) · ×1
  • Wholesale file copy (91 identical lines × 3 files) packages/mermaid/src/rendering-util/rendering-elements/shapes/icon.ts:1 — packages/mermaid/src/rendering-util/rendering-elements/shapes/icon.ts:1 · packages/mermaid/src/rendering-util/rendering-elements/shapes/iconRounded.ts:1 · packages/mermaid/src/rendering-util/rendering-elements/shapes/iconSquare.ts:1 — these 3 files are line-for-line copies of one another — 91 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (76 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (76 matched lines × 2 locations) packages/mermaid/src/diagrams/er/erDb.ts:39 — packages/mermaid/src/diagrams/er/erDb.ts:39 · packages/mermaid/src/diagrams/requirement/requirementDb.ts:64 — the two spans are one implementation copied and then locally edited — 497 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (71 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (71 matched lines × 2 locations) packages/mermaid/src/rendering-util/rendering-elements/clusters.js:56 — packages/mermaid/src/rendering-util/rendering-elements/clusters.js:56 · packages/mermaid/src/rendering-util/rendering-elements/clusters.js:339 — the two spans are one implementation copied and then locally edited — 592 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (70 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (70 matched lines × 2 locations) packages/mermaid-layout-tidy-tree/src/render.ts:11 — packages/mermaid-layout-tidy-tree/src/render.ts:11 · packages/mermaid/src/rendering-util/layout-algorithms/cose-bilkent/render.ts:13 — the two spans are one implementation copied and then locally edited — 549 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (68 lines × 2 locations) · ×1
  • Duplicated block (68 lines × 2 locations) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:789 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:789 · packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:919 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (65 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (65 matched lines × 2 locations) packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts:63 — packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts:63 · packages/mermaid/src/diagrams/xychart/chartBuilder/orchestrator.ts:133 — the two spans are one implementation copied and then locally edited — 478 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (58 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (58 matched lines × 2 locations) packages/mermaid/src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts:25 — packages/mermaid/src/rendering-util/rendering-elements/shapes/linedWaveEdgedRect.ts:25 · packages/mermaid/src/rendering-util/rendering-elements/shapes/waveEdgedRectangle.ts:28 — the two spans are one implementation copied and then locally edited — 487 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (57 lines × 2 locations) · ×1
  • Duplicated block (57 lines × 2 locations) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1560 — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1560 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:1120 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (57 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (57 matched lines × 2 locations) packages/mermaid/src/diagrams/git/gitGraphAst.ts:112 — packages/mermaid/src/diagrams/git/gitGraphAst.ts:112 · packages/mermaid/src/diagrams/git/gitGraphAst.ts:266 — the two spans are one implementation copied and then locally edited — 377 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (55 lines × 2 locations) · ×1
  • Duplicated block (55 lines × 2 locations) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:266 — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:266 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:134 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block with local edits (53 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (53 matched lines × 2 locations) packages/mermaid/src/rendering-util/rendering-elements/shapes/browser.ts:10 — packages/mermaid/src/rendering-util/rendering-elements/shapes/browser.ts:10 · packages/mermaid/src/rendering-util/rendering-elements/shapes/console.ts:10 — the two spans are one implementation copied and then locally edited — 449 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (53 lines × 3 locations) · ×1
  • Duplicated block (53 lines × 3 locations) packages/parser/src/language/railroad-ebnf/valueConverter.ts:5 — packages/parser/src/language/railroad-ebnf/valueConverter.ts:5 · packages/parser/src/language/railroad-peg/valueConverter.ts:5 · packages/parser/src/language/railroad/valueConverter.ts:5 — the 3 copies are spread across 3 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
R10 · Code Duplication · Duplicated block with local edits (52 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (52 matched lines × 2 locations) packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts:10 — packages/mermaid/src/rendering-util/rendering-elements/shapes/flippedTriangle.ts:10 · packages/mermaid/src/rendering-util/rendering-elements/shapes/triangle.ts:12 — the two spans are one implementation copied and then locally edited — 447 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (51 lines × 2 locations) · ×1
  • Duplicated block (51 lines × 2 locations) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:737 — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:737 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:388 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (48 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (48 matched lines × 2 locations) packages/mermaid/src/themes/theme-dark.js:166 — packages/mermaid/src/themes/theme-dark.js:166 · packages/mermaid/src/themes/theme-neutral.js:233 — the two spans are one implementation copied and then locally edited — 547 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (47 lines × 2 locations) · ×1
  • Duplicated block (47 lines × 2 locations) packages/mermaid-example-diagram/src/mermaidUtils.ts:2 — packages/mermaid-example-diagram/src/mermaidUtils.ts:2 · packages/mermaid-zenuml/src/mermaidUtils.ts:3 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication · Duplicated block (45 lines × 2 locations) · ×1
  • Duplicated block (45 lines × 2 locations) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:446 — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:446 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:260 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block with local edits (45 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (45 matched lines × 2 locations) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1579 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1579 · packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1835 — the two spans are one implementation copied and then locally edited — 247 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (44 lines × 2 locations) · ×1
  • Duplicated block (44 lines × 2 locations) packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts:9 — packages/mermaid/src/rendering-util/rendering-elements/shapes/cylinder.ts:9 · packages/mermaid/src/rendering-util/rendering-elements/shapes/document.ts:9 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R10 · Code Duplication · Duplicated block (43 lines × 2 locations) · ×1
  • Duplicated block (43 lines × 2 locations) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1158 — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1158 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:756 — the 2 copies are spread across 2 directories, so the shared home is a decision rather than an obvious spot: check first whether one of them already owns this behaviour, and otherwise put the extracted module somewhere all of the sites already reach rather than making one of them depend on another.
R10 · Code Duplication · Duplicated block (42 lines × 2 locations) · ×1
  • Duplicated block (42 lines × 2 locations) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1295 — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1295 · packages/mermaid/src/diagrams/flowchart/flowDb.ts:878 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 289, cognitive 295) · ×1
  • Complex function updateColors (cyclomatic 289, cognitive 295) packages/mermaid/src/themes/theme-base.js:32 — updateColors has cyclomatic complexity 289 and cognitive complexity 295; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function routeEdgesOrthogonal (cyclomatic 287, cognitive 562) · ×1
  • Complex function routeEdgesOrthogonal (cyclomatic 287, cognitive 562) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:141 — routeEdgesOrthogonal has cyclomatic complexity 287 and cognitive complexity 562; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 216, cognitive 221) · ×1
  • Complex function updateColors (cyclomatic 216, cognitive 221) packages/mermaid/src/themes/theme-redux-dark.js:76 — updateColors has cyclomatic complexity 216 and cognitive complexity 221; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 205, cognitive 210) · ×1
  • Complex function updateColors (cyclomatic 205, cognitive 210) packages/mermaid/src/themes/theme-redux.js:58 — updateColors has cyclomatic complexity 205 and cognitive complexity 210; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 203, cognitive 204) · ×1
  • Complex function updateColors (cyclomatic 203, cognitive 204) packages/mermaid/src/themes/theme-default.js:146 — updateColors has cyclomatic complexity 203 and cognitive complexity 204; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 200, cognitive 200) · ×1
  • Complex function updateColors (cyclomatic 200, cognitive 200) packages/mermaid/src/themes/theme-forest.js:113 — updateColors has cyclomatic complexity 200 and cognitive complexity 200; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 199, cognitive 201) · ×1
  • Complex function updateColors (cyclomatic 199, cognitive 201) packages/mermaid/src/themes/theme-redux-color.js:106 — updateColors has cyclomatic complexity 199 and cognitive complexity 201; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 195, cognitive 197) · ×1
  • Complex function updateColors (cyclomatic 195, cognitive 197) packages/mermaid/src/themes/theme-redux-dark-color.js:108 — updateColors has cyclomatic complexity 195 and cognitive complexity 197; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function layered (cyclomatic 190, cognitive 350) · ×1
  • Complex function layered (cyclomatic 190, cognitive 350) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:297 — layered has cyclomatic complexity 190 and cognitive complexity 350; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 189, cognitive 188) · ×1
  • Complex function updateColors (cyclomatic 189, cognitive 188) packages/mermaid/src/themes/theme-dark.js:115 — updateColors has cyclomatic complexity 189 and cognitive complexity 188; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function validateLayout (cyclomatic 180, cognitive 406) · ×1
  • Complex function validateLayout (cyclomatic 180, cognitive 406) packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:553 — validateLayout has cyclomatic complexity 180 and cognitive complexity 406; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function updateColors (cyclomatic 173, cognitive 174) · ×1
  • Complex function updateColors (cyclomatic 173, cognitive 174) packages/mermaid/src/themes/theme-neutral.js:128 — updateColors has cyclomatic complexity 173 and cognitive complexity 174; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function compoundLayout (cyclomatic 89, cognitive 196) · ×1
  • Complex function compoundLayout (cyclomatic 89, cognitive 196) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:467 — compoundLayout has cyclomatic complexity 89 and cognitive complexity 196; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function assignCoordinates (cyclomatic 89, cognitive 133) · ×1
  • Complex function assignCoordinates (cyclomatic 89, cognitive 133) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase4.coordinates.ts:42 — assignCoordinates has cyclomatic complexity 89 and cognitive complexity 133; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function position (cyclomatic 83, cognitive 203) · ×1
  • Complex function position (cyclomatic 83, cognitive 203) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:2340 — position has cyclomatic complexity 83 and cognitive complexity 203; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function insertEdge (cyclomatic 83, cognitive 85) · ×1
  • Complex function insertEdge (cyclomatic 83, cognitive 85) packages/mermaid/src/rendering-util/rendering-elements/edges.js:706 — insertEdge has cyclomatic complexity 83 and cognitive complexity 85; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function drawMessage (cyclomatic 74, cognitive 90) · ×1
  • Complex function drawMessage (cyclomatic 74, cognitive 90) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:461 — drawMessage has cyclomatic complexity 74 and cognitive complexity 90; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function positionGridEdgeLabels (cyclomatic 64, cognitive 162) · ×1
  • Complex function positionGridEdgeLabels (cyclomatic 64, cognitive 162) packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:2207 — positionGridEdgeLabels has cyclomatic complexity 64 and cognitive complexity 162; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function routeCrossings (cyclomatic 63, cognitive 153) · ×1
  • Complex function routeCrossings (cyclomatic 63, cognitive 153) packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:155 — routeCrossings has cyclomatic complexity 63 and cognitive complexity 153; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function layoutContainer (cyclomatic 62, cognitive 88) · ×1
  • Complex function layoutContainer (cyclomatic 62, cognitive 88) packages/mermaid/src/rendering-util/layout-algorithms/grid/layoutCore.ts:65 — layoutContainer has cyclomatic complexity 62 and cognitive complexity 88; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function classBox (cyclomatic 55, cognitive 57) · ×1
  • Complex function classBox (cyclomatic 55, cognitive 57) packages/mermaid/src/rendering-util/rendering-elements/shapes/classBox.ts:14 — classBox has cyclomatic complexity 55 and cognitive complexity 57; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function draw (cyclomatic 54, cognitive 38) · ×1
  • Complex function draw (cyclomatic 54, cognitive 38) packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1043 — draw has cyclomatic complexity 54 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function writeBackToLayoutData (cyclomatic 53, cognitive 125) · ×1
  • Complex function writeBackToLayoutData (cyclomatic 53, cognitive 125) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/helpers.ts:275 — writeBackToLayoutData has cyclomatic complexity 53 and cognitive complexity 125; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function reduceCrossings (cyclomatic 49, cognitive 77) · ×1
  • Complex function reduceCrossings (cyclomatic 49, cognitive 77) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1965 — reduceCrossings has cyclomatic complexity 49 and cognitive complexity 77; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function sparseContainerSegment (cyclomatic 48, cognitive 90) · ×1
  • Complex function sparseContainerSegment (cyclomatic 48, cognitive 90) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:651 — sparseContainerSegment has cyclomatic complexity 48 and cognitive complexity 90; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function addVertex (cyclomatic 48, cognitive 74) · ×1
  • Complex function addVertex (cyclomatic 48, cognitive 74) packages/mermaid/src/diagrams/flowchart/flowDb.ts:188 — addVertex has cyclomatic complexity 48 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function collapseShortTerminalStub (cyclomatic 47, cognitive 101) · ×1
  • Complex function collapseShortTerminalStub (cyclomatic 47, cognitive 101) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/terminalStub.ts:44 — collapseShortTerminalStub has cyclomatic complexity 47 and cognitive complexity 101; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function addVertex (cyclomatic 46, cognitive 70) · ×1
  • Complex function addVertex (cyclomatic 46, cognitive 70) packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:322 — addVertex has cyclomatic complexity 46 and cognitive complexity 70; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function buildOrthogonalPortPath (cyclomatic 45, cognitive 56) · ×1
  • Complex function buildOrthogonalPortPath (cyclomatic 45, cognitive 56) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:329 — buildOrthogonalPortPath has cyclomatic complexity 45 and cognitive complexity 56; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function search (cyclomatic 43, cognitive 60) · ×1
  • Complex function search (cyclomatic 43, cognitive 60) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts:309 — search has cyclomatic complexity 43 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function erBox (cyclomatic 43, cognitive 51) · ×1
  • Complex function erBox (cyclomatic 43, cognitive 51) packages/mermaid/src/rendering-util/rendering-elements/shapes/erBox.ts:19 — erBox has cyclomatic complexity 43 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 43, cognitive 44) · ×1
  • Complex function (anonymous) (cyclomatic 43, cognitive 44) packages/mermaid-layout-tidy-tree/src/layout.ts:465 — (anonymous) has cyclomatic complexity 43 and cognitive complexity 44; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function apply (cyclomatic 42, cognitive 22) · ×1
  • Complex function apply (cyclomatic 42, cognitive 22) packages/mermaid/src/diagrams/sequence/sequenceDb.ts:557 — apply has cyclomatic complexity 42 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function routePath (cyclomatic 41, cognitive 63) · ×1
  • Complex function routePath (cyclomatic 41, cognitive 63) packages/mermaid/src/rendering-util/rendering-elements/routePath.ts:130 — routePath has cyclomatic complexity 41 and cognitive complexity 63; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function anchorLabelsToPolyline (cyclomatic 39, cognitive 68) · ×1
  • Complex function anchorLabelsToPolyline (cyclomatic 39, cognitive 68) packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/labelAnchoring.ts:84 — anchorLabelsToPolyline has cyclomatic complexity 39 and cognitive complexity 68; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function rank (cyclomatic 39, cognitive 64) · ×1
  • Complex function rank (cyclomatic 39, cognitive 64) packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:948 — rank has cyclomatic complexity 39 and cognitive complexity 64; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function assignDemandCoordinates (cyclomatic 39, cognitive 60) · ×1
  • Complex function assignDemandCoordinates (cyclomatic 39, cognitive 60) packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:424 — assignDemandCoordinates has cyclomatic complexity 39 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function drawArrow (cyclomatic 38, cognitive 95) · ×1
  • Complex function drawArrow (cyclomatic 38, cognitive 95) packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:653 — drawArrow has cyclomatic complexity 38 and cognitive complexity 95; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts: 2818 lines of code packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts has 2818 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts: 2651 lines of code packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/materializedGeometry.ts has 2651 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts: 2490 lines of code packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts has 2490 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts: 2404 lines of code packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts has 2404 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/agentflow/agentflowDb.ts · ×1
  • packages/mermaid/src/diagrams/agentflow/agentflowDb.ts: 2312 lines of code packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1 — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts has 2312 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts: 2165 lines of code packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/router.ts has 2165 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts · ×1
  • packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts: 1982 lines of code packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1 — packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts has 1982 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/sequence/svgDraw.js · ×1
  • packages/mermaid/src/diagrams/sequence/svgDraw.js: 1954 lines of code packages/mermaid/src/diagrams/sequence/svgDraw.js:1 — packages/mermaid/src/diagrams/sequence/svgDraw.js has 1954 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts: 1381 lines of code packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts has 1381 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/flowchart/flowDb.ts · ×1
  • packages/mermaid/src/diagrams/flowchart/flowDb.ts: 1375 lines of code packages/mermaid/src/diagrams/flowchart/flowDb.ts:1 — packages/mermaid/src/diagrams/flowchart/flowDb.ts has 1375 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/git/gitGraphRenderer.ts · ×1
  • packages/mermaid/src/diagrams/git/gitGraphRenderer.ts: 1369 lines of code packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:1 — packages/mermaid/src/diagrams/git/gitGraphRenderer.ts has 1369 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts: 1212 lines of code packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts has 1212 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts: 1199 lines of code packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts has 1199 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts: 1131 lines of code packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts has 1131 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/rendering-elements/edges.js · ×1
  • packages/mermaid/src/rendering-util/rendering-elements/edges.js: 1093 lines of code packages/mermaid/src/rendering-util/rendering-elements/edges.js:1 — packages/mermaid/src/rendering-util/rendering-elements/edges.js has 1093 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/rendering-elements/markers.js · ×1
  • packages/mermaid/src/rendering-util/rendering-elements/markers.js: 1055 lines of code packages/mermaid/src/rendering-util/rendering-elements/markers.js:1 — packages/mermaid/src/rendering-util/rendering-elements/markers.js has 1055 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts · ×1
  • packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts: 1040 lines of code packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts:1 — packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts has 1040 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts: 1018 lines of code packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts has 1018 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts · ×1
  • packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts: 971 lines of code packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts:1 — packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts has 971 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts · ×1
  • packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts: 965 lines of code packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts:1 — packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts has 965 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/utils.ts · ×1
  • packages/mermaid/src/utils.ts: 896 lines of code packages/mermaid/src/utils.ts:1 — packages/mermaid/src/utils.ts has 896 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts: 886 lines of code packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts has 886 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/gantt/ganttRenderer.js · ×1
  • packages/mermaid/src/diagrams/gantt/ganttRenderer.js: 817 lines of code packages/mermaid/src/diagrams/gantt/ganttRenderer.js:1 — packages/mermaid/src/diagrams/gantt/ganttRenderer.js has 817 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/gantt/ganttDb.js · ×1
  • packages/mermaid/src/diagrams/gantt/ganttDb.js: 805 lines of code packages/mermaid/src/diagrams/gantt/ganttDb.js:1 — packages/mermaid/src/diagrams/gantt/ganttDb.js has 805 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/class/classDb.ts · ×1
  • packages/mermaid/src/diagrams/class/classDb.ts: 796 lines of code packages/mermaid/src/diagrams/class/classDb.ts:1 — packages/mermaid/src/diagrams/class/classDb.ts has 796 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/rendering-elements/clusters.js · ×1
  • packages/mermaid/src/rendering-util/rendering-elements/clusters.js: 769 lines of code packages/mermaid/src/rendering-util/rendering-elements/clusters.js:1 — packages/mermaid/src/rendering-util/rendering-elements/clusters.js has 769 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/c4/c4Db.ts · ×1
  • packages/mermaid/src/diagrams/c4/c4Db.ts: 755 lines of code packages/mermaid/src/diagrams/c4/c4Db.ts:1 — packages/mermaid/src/diagrams/c4/c4Db.ts has 755 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js: 752 lines of code packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js:1 — packages/mermaid/src/rendering-util/layout-algorithms/dagre/index.js has 752 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/mermaidAPI.ts · ×1
  • packages/mermaid/src/mermaidAPI.ts: 729 lines of code packages/mermaid/src/mermaidAPI.ts:1 — packages/mermaid/src/mermaidAPI.ts has 729 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/state/stateDb.ts · ×1
  • packages/mermaid/src/diagrams/state/stateDb.ts: 713 lines of code packages/mermaid/src/diagrams/state/stateDb.ts:1 — packages/mermaid/src/diagrams/state/stateDb.ts has 713 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts: 713 lines of code packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts has 713 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts: 712 lines of code packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts has 712 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts · ×1
  • packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts: 697 lines of code packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts:1 — packages/mermaid/src/rendering-util/rendering-elements/lineJump.ts has 697 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · scripts/screenshot-sheets.ts · ×1
  • scripts/screenshot-sheets.ts: 690 lines of code scripts/screenshot-sheets.ts:1 — scripts/screenshot-sheets.ts has 690 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/sequence/sequenceDb.ts · ×1
  • packages/mermaid/src/diagrams/sequence/sequenceDb.ts: 674 lines of code packages/mermaid/src/diagrams/sequence/sequenceDb.ts:1 — packages/mermaid/src/diagrams/sequence/sequenceDb.ts has 674 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts · ×1
  • packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts: 654 lines of code packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts:1 — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts has 654 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts · ×1
  • packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts: 646 lines of code packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts:1 — packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts has 646 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/eventmodeling/db.ts · ×1
  • packages/mermaid/src/diagrams/eventmodeling/db.ts: 616 lines of code packages/mermaid/src/diagrams/eventmodeling/db.ts:1 — packages/mermaid/src/diagrams/eventmodeling/db.ts has 616 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/rendering-util/rendering-elements/shapes.ts · ×1
  • packages/mermaid/src/rendering-util/rendering-elements/shapes.ts: 611 lines of code packages/mermaid/src/rendering-util/rendering-elements/shapes.ts:1 — packages/mermaid/src/rendering-util/rendering-elements/shapes.ts has 611 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · packages/mermaid/src/diagrams/architecture/architectureRenderer.ts · ×1
  • packages/mermaid/src/diagrams/architecture/architectureRenderer.ts: 598 lines of code packages/mermaid/src/diagrams/architecture/architectureRenderer.ts:1 — packages/mermaid/src/diagrams/architecture/architectureRenderer.ts has 598 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling · The declared test suite includes a file that cannot be loaded · ×1
  • The declared test suite includes a file that cannot be loaded e2e/platform/bundle-test.js:2 — This repository declares test tooling, and the ✓ above records that declaration — but e2e/platform/bundle-test.js and 1 other test file(s) in this workspace cannot be loaded at all: it imports a module that names no file in this repository, so the runner throws while collecting it and none of its cases execute. The wiring is present and the suite it points at does not run as written, which is why the tooling tick must not be read as a statement that the tests pass. Fix the unloadable file(s) — each one is reported with its failing import under Test Coverage — then the declared script exercises what it claims to.
R7 · Dead Code · Dead file (~3 LoC) · ×1
  • Dead file (~3 LoC) vitest.workspace.js — no import path from any entry point (1004 application, 19 tooling, 455 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
R8 · Dependency Hygiene · Unused dependency '@fontsource/noto-sans-sc' · ×1
  • Unused dependency '@fontsource/noto-sans-sc' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'path-browserify' · ×1
  • Unused dependency 'path-browserify' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'start-server-and-test' · ×1
  • Unused dependency 'start-server-and-test' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'wait-on' · ×1
  • Unused dependency 'wait-on' — Declared in the root package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'd3' · ×1
  • Unused dependency 'd3' — Declared in packages/mermaid-layout-elk/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
R8 · Dependency Hygiene · Unused dependency 'katex' · ×1
  • Unused dependency 'katex' — Declared in packages/mermaid-layout-elk/package.json but never imported anywhere in that package or its workspace members — no static import reaches it. Usually that is dead weight and attack surface, but two shapes are indistinguishable from source and are NOT dead: an optional or native peer that another dependency loads dynamically at runtime, and a package a build, docs or test step installs and invokes separately. Confirm which of the three this is before removing it.
X29 · Per-element action decided by a fixed element · Per-element action decided by a fixed element · ×1
  • Per-element action decided by a fixed element packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts:97 — This loop runs once per element of `points`, and the statement it guards acts on the element it is on — `point`. The test deciding whether that statement runs does not: `vertical` reads `points[index]`, a subscript that does not move, so whatever it answers for that one element it answers for ALL of them. One `if` names the same collection at two different subscripts — the fixed one at line 94, which is the contradiction: either the test was meant to be per-element, in which case every element that differs from the fixed one is handled wrongly and all in the same direction, or it really is one answer for the whole collection, in which case it is being re-asked on every pass and belongs above the loop. The `if` is in the wrong place under both readings. Give the test the loop variable, or hoist it out.
Minor — 251 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×55
  • Orphaned file scripts/swimlanes-size.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/cynefin/cynefinRenderer.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/ishikawa/ishikawaRenderer.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/railroad/styles.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/class/svgDraw.js:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/xychart/xychartRenderer.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/sankey/sankeyRenderer.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/flowchart/flowChartShapes.js:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/wardley/wardleyParser.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/git/gitGraphParser.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/class/shapeUtil.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/quadrant-chart/quadrantRenderer.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/laneOrdering.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/rendering-util/rendering-elements/shapes/curlyBraces.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/cynefin/cynefinBoundaries.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/eventmodeling/renderer.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/rendering-util/rendering-elements/shapes/bowTieRect.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/quadrant-chart/quadrantDb.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/rendering-util/rendering-elements/shapes/iconRounded.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/rendering-util/rendering-elements/shapes/imageSquare.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/rendering-util/rendering-elements/shapes/iconSquare.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/rendering-util/rendering-elements/shapes/linedCylinder.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/rendering-util/rendering-elements/shapes/icon.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/rendering-util/rendering-elements/shapes/curlyBraceRight.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file packages/mermaid/src/diagrams/common/svgDrawCommon.ts:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 30 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×40
  • Duplicated predicate packages/mermaid/src/diagrams/gantt/ganttDb.js:173 — `!allItemsProcessed && iterationCount < maxDepth` appears character-identically in 3 files — packages/mermaid/src/diagrams/gantt/ganttDb.js, packages/mermaid/src/diagrams/timeline/timelineDb.js, packages/mermaid/src/diagrams/user-journey/journeyDb.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:854 — `!isFinitePositiveNumber(labelNode.width) || !isFinitePositiveNumber(labelNode.height)` appears character-identically in 2 files — packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/labelGeometry.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/parser/src/language/railroad-abnf/valueConverter.ts:16 — `(trimmedValue.startsWith('"') && trimmedValue.endsWith('"')) || (trimmedValue.startsWith("'") && trimmedValue.endsWith("'"))` appears character-identically in 4 files — packages/parser/src/language/railroad-abnf/valueConverter.ts, packages/parser/src/language/railroad-ebnf/valueConverter.ts, packages/parser/src/language/railroad-peg/valueConverter.ts, packages/parser/src/language/railroad/valueConverter.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/rendering-util/layout-algorithms/elk/lineHops.ts:55 — `Array.isArray(edge.points) && edge.points.length >= 2` appears character-identically in 3 files — packages/mermaid/src/rendering-util/layout-algorithms/elk/lineHops.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/lineHops.ts, packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/adjustLayout.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:2096 — `Number.isFinite(point.x) && Number.isFinite(point.y)` appears character-identically in 2 files — packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts, packages/mermaid/src/rendering-util/rendering-elements/edgeStepAnimation.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts:337 — `a.left < b.right && a.right > b.left && a.top < b.bottom && a.bottom > b.top` appears character-identically in 2 files — packages/mermaid/src/rendering-util/layout-algorithms/grid/edgeLabels.ts, packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/parser/src/language/railroad-ebnf/valueConverter.ts:11 — `character === '\\' && index + 1 < content.length` appears character-identically in 3 files — packages/parser/src/language/railroad-ebnf/valueConverter.ts, packages/parser/src/language/railroad-peg/valueConverter.ts, packages/parser/src/language/railroad/valueConverter.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:479 — `classes !== undefined && classes !== null` appears character-identically in 2 files — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts, packages/mermaid/src/diagrams/flowchart/flowDb.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1732 — `current !== undefined && !seen.has(current)` appears character-identically in 2 files — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts, packages/mermaid/src/diagrams/flowchart/flowDb.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts:90 — `direction === 'LR' || direction === 'RL'` appears character-identically in 2 files — packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts, packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase4.coordinates.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:742 — `e.start === edge.start && e.end === edge.end` appears character-identically in 2 files — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts, packages/mermaid/src/diagrams/flowchart/flowDb.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:724 — `edge.text.startsWith('"') && edge.text.endsWith('"')` appears character-identically in 2 files — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts, packages/mermaid/src/diagrams/flowchart/flowDb.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:334 — `isWithoutSections && !conf.timeline?.disableMulticolor` appears character-identically in 2 files — packages/mermaid/src/diagrams/timeline/timelineRenderer.ts, packages/mermaid/src/diagrams/timeline/timelineRendererVertical.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:946 — `item.startsWith('"') && item.endsWith('"')` appears character-identically in 4 files — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts, packages/mermaid/src/diagrams/class/classDb.ts, packages/mermaid/src/diagrams/flowchart/flowDb.ts, packages/mermaid/src/diagrams/gantt/ganttDb.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/geometry.ts:195 — `matchesHorizEndpoint && matchesVertEndpoint` appears character-identically in 2 files — packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/geometry.ts, packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/geometry.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/rendering-util/rendering-elements/shapes/stateEnd.ts:83 — `node.width < 25 && nodeShadow && node.look !== 'handDrawn'` appears character-identically in 2 files — packages/mermaid/src/rendering-util/rendering-elements/shapes/stateEnd.ts, packages/mermaid/src/rendering-util/rendering-elements/shapes/stateStart.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/kanban/styles.ts:10 — `options['lineColor' + i] || options['cScaleInv' + i]` appears character-identically in 2 files — packages/mermaid/src/diagrams/kanban/styles.ts, packages/mermaid/src/diagrams/mindmap/styles.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1869 — `rawEdge.interpolate || this.edges.defaultInterpolate || config.flowchart?.curve` appears character-identically in 2 files — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts, packages/mermaid/src/diagrams/flowchart/flowDb.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/agentflow/agentflowDb.ts:1854 — `rawEdge?.stroke === 'invisible' || rawEdge?.type === 'arrow_open'` appears character-identically in 2 files — packages/mermaid/src/diagrams/agentflow/agentflowDb.ts, packages/mermaid/src/diagrams/flowchart/flowDb.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/diagrams/railroad/parser/abnfParser.ts:136 — `result.lexerErrors.length > 0 || result.parserErrors.length > 0` appears character-identically in 5 files — packages/mermaid/src/diagrams/railroad/parser/abnfParser.ts, packages/mermaid/src/diagrams/railroad/parser/ebnfParser.ts, packages/mermaid/src/diagrams/railroad/parser/pegParser.ts, packages/mermaid/src/diagrams/railroad/parser/railroadParser.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/parser/src/language/railroad-abnf/valueConverter.ts:13 — `rule.name === 'TITLE' && typeof value === 'string'` appears character-identically in 4 files — packages/parser/src/language/railroad-abnf/valueConverter.ts, packages/parser/src/language/railroad-ebnf/valueConverter.ts, packages/parser/src/language/railroad-peg/valueConverter.ts, packages/parser/src/language/railroad/valueConverter.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.testUtils.ts:128 — `sourceId === undefined || targetId === undefined` appears character-identically in 2 files — packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.testUtils.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/rendering-util/rendering-elements/clusters.js:648 — `themeVariables.flowContainerStroke || themeVariables.secondaryBorderColor` appears character-identically in 2 files — packages/mermaid/src/rendering-util/rendering-elements/clusters.js, packages/mermaid/src/rendering-util/rendering-elements/shapes/collapsedGroup.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/themes/theme-base.js:76 — `this. actorBorder || this.primaryBorderColor` appears character-identically in 5 files — packages/mermaid/src/themes/theme-base.js, packages/mermaid/src/themes/theme-neo-dark.js, packages/mermaid/src/themes/theme-neo.js, packages/mermaid/src/themes/theme-redux-color.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate packages/mermaid/src/themes/theme-base.js:87 — `this.activationBkgColor || this.secondaryColor` appears character-identically in 7 files — packages/mermaid/src/themes/theme-base.js, packages/mermaid/src/themes/theme-neo-dark.js, packages/mermaid/src/themes/theme-neo.js, packages/mermaid/src/themes/theme-redux-color.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • + 15 more in this group — see findings.md.
D24 · Comment Value · redundant comment · ×39
  • redundant comment packages/mermaid/scripts/create-types-from-json-schema.mts:199 — "Generate types from JSON Schema" repeats the code it sits on: 4 of its 4 words (generate, types, json, schema) are already in `await generateTypeScript(configJsonSchema);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/config.spec.ts:376 — "Add a directive that sets flowchart.htmlLabels to false" repeats the code it sits on: 6 of its 7 words (add, directive, flowchart, html, labels, false) are already in `configApi.addDirective({ flowchart: { htmlLabels: false } });`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/c4/c4Db.ts:640 — "?c4ShapeInRow, ?c4BoundaryInRow" repeats the code it sits on: 3 of its 3 words (shape, row, boundary) are already in `export const updateLayoutConfig = function (`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/c4/c4Renderer.ts:536 — "draw boundary inside currentBoundary" repeats the code it sits on: 4 of its 4 words (draw, boundary, inside, current) are already in `await drawInsideBoundary(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/gantt/ganttRenderer.js:154 — "Set viewBox" repeats the code it sits on: 3 of its 3 words (set, view, box) are already in `elem.setAttribute('viewBox', '0 0 ' + w + ' ' + h);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/mindmap/mindmapDb.getData.test.ts:66 — 6 comments in this file only repeat the code they sit on (lines 66, 74, 247, 336, 355, 357), for example "Check root node". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/mindmap/mindmapRenderer.ts:17 — "Find the corresponding node in the layout data" repeats the code it sits on: 4 of its 5 words (find, node, layout, data) are already in `const layoutNode = data4Layout.nodes.find((n) => n.id === node.id.toString());`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/pie/pieRenderer.ts:101 — "Set the color scale" repeats the code it sits on: 3 of its 3 words (set, color, scale) are already in `const color: d3.ScaleOrdinal<string, 12, never> = scaleOrdinal(myGeneratedColors).domain([`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js:203 — "Find the actual message (type: 'addMessage')" repeats the code it sits on: 4 of its 5 words (find, actual, message, type) are already in `const actualMessage = messages.find((msg) => msg.type !== undefined && msg.from && msg.to);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/state/dataFetcher.ts:421 — 5 comments in this file only repeat the code they sit on (lines 421, 423, 427, 429, 431), for example "add parent id to groupData". Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/state/stateCommon.ts:5 — "default diagram direction" repeats the code it sits on: 3 of its 3 words (default, diagram, direction) are already in `export const DEFAULT_DIAGRAM_DIRECTION = 'TB';`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:118 — "calculate maxEventLineLength" repeats the code it sits on: 4 of its 5 words (max, event, line, length) are already in `let maxEventLineLengthTemp = 0;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:143 — "filter task where tasks.section == section" repeats the code it sits on: 4 of its 4 words (filter, task, tasks, section) are already in `const tasksForSection = tasks.filter((task) => task.section === section);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:302 — "log task height" repeats the code it sits on: 3 of its 3 words (log, task, height) are already in `log.debug('taskHeight after draw', taskHeight);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:377 — "set masterY back to eventBeginY" repeats the code it sits on: 4 of its 5 words (set, master, event, begin) are already in `masterY = eventBeginY;`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/timeline/timelineRendererVertical.ts:141 — "filter task where tasks.section == section" repeats the code it sits on: 4 of its 4 words (filter, task, tasks, section) are already in `const tasksForSection = tasks.filter((task) => task.section === section);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/timeline/timelineRendererVertical.ts:276 — "log task height" repeats the code it sits on: 3 of its 3 words (log, task, height) are already in `log.debug('taskHeight after draw', taskHeight);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/treeView/boxDrawingPreprocessor.ts:105 — "Infer segment width" repeats the code it sits on: 3 of its 3 words (infer, segment, width) are already in `const segmentWidth = inferSegmentWidth(contentLineTexts);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/treemap/types.ts:69 — "Define the TreemapDiagramConfig interface" repeats the code it sits on: 4 of its 5 words (treemap, diagram, config, interface) are already in `export interface TreemapDiagramConfig extends BaseDiagramConfig`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts:731 — "Render squares for pipeline parent nodes" repeats the code it sits on: 4 of its 5 words (squares, pipeline, parent, nodes) are already in `nodeEnter`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts:891 — "Sort annotations by number" repeats the code it sits on: 3 of its 3 words (sort, annotations, number) are already in `const sortedAnnotations = [...data.annotations]`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/docs/.vitepress/theme/redirect.ts:18 — "Find id in params" repeats the code it sits on: 3 of its 3 words (find, id, params) are already in `const id = params`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/rendering-util/handle-markdown-text.ts:15 — "Replace multiple newlines with a single newline" repeats the code it sits on: 4 of its 5 words (replace, multiple, newlines, newline) are already in `const withoutMultipleNewlines = withoutBR.replace(/\n{2,}/g, '\n');`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/rendering-util/layout-algorithms/cose-bilkent/render.ts:158 — "Insert the edge path" repeats the code it sits on: 3 of its 3 words (insert, edge, path) are already in `const paths = insertEdge(`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • redundant comment packages/mermaid/src/rendering-util/layout-algorithms/cose-bilkent/render.ts:169 — "Position the edge label" repeats the code it sits on: 3 of its 3 words (position, edge, label) are already in `positionEdgeLabel(edgeWithPath, paths);`. Delete it, or replace it with what the code cannot say (why it is done here, a constraint, or a consequence).
  • + 14 more in this group — see findings.md.
X23 · Unguarded diagnostic materialisation · Diagnostic log message is built whether or not it is wanted · ×23
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/rendering-elements/clusters.js:74 — `trace` at line 74 is called with an argument built by `JSON.stringify(node)` (line 74), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because trace is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/rendering-elements/clusters.js:357 — `trace` at line 357 is called with an argument built by `JSON.stringify(node)` (line 357), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because trace is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/rendering-elements/edges.js:496 — `debug` at line 496 is called with an argument built by `JSON.stringify(outsidePoint)` (line 497), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/rendering-elements/edges.js:812 — `debug` at line 812 is called with an argument built by `JSON.stringify(points, null, 2)` (line 815), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/rendering-elements/clusters/swimlane.js:231 — `trace` at line 231 is called with an argument built by `JSON.stringify(node)` (line 231), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because trace is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:1471 — `debug` at line 1471 is called with an argument built by `JSON.stringify(issues.slice(0, 50))` (line 1477), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:2512 — `debug` at line 2512 is called with an argument built by `JSON.stringify(points)` (line 2514), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/layout-algorithms/elk/render.ts:2577 — `debug` at line 2577 is called with an argument built by `JSON.stringify(clippedPoints)` (line 2577), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:269 — `debug` at line 269 is called with an argument built by `JSON.stringify(e)` (line 269), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/rendering-util/layout-algorithms/dagre/mermaid-graphlib.js:270 — `debug` at line 270 is called with an argument built by `JSON.stringify(graph.edge(e))` (line 270), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/state/stateRenderer.js:265 — `debug` at line 265 is called with an argument built by `JSON.stringify(graph.node(v))` (line 265), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/state/stateRenderer.js:273 — `debug` at line 273 is called with an argument built by `JSON.stringify(graph.edge(e))` (line 273), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/sequence/sequenceDb.ts:387 — `debug` at line 387 is called with an argument built by `JSON.stringify(message)` (line 387), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/git/gitGraphAst.ts:427 — `debug` at line 427 is called with an argument built by `label.join(' ')` (line 427), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/class/classDb.ts:210 — `debug` at line 210 is called with an argument built by `JSON.stringify(classRelation)` (line 210), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/class/classRenderer.js:211 — `debug` at line 211 is called with an argument built by `JSON.stringify(note)` (line 211), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/class/classRenderer.js:242 — `debug` at line 242 is called with an argument built by `JSON.stringify(g.node(v))` (line 242), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/class/classRenderer.js:258 — `debug` at line 258 is called with an argument built by `JSON.stringify(g.edge(e))` (line 258), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/class/svgDraw.js:89 — `debug` at line 89 is called with an argument built by `JSON.stringify(cardinality_1_point)` (line 89), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/class/svgDraw.js:90 — `debug` at line 90 is called with an argument built by `JSON.stringify(cardinality_2_point)` (line 90), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/c4/c4Renderer.ts:578 — `debug` at line 578 is called with an argument built by `JSON.stringify(conf, null, 2)` (line 578), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/block/layout.ts:112 — `debug` at line 112 is called with an argument built by `JSON.stringify(child.size)` (line 113), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
  • Diagnostic log message is built whether or not it is wanted packages/mermaid/src/diagrams/block/layout.ts:362 — `debug` at line 362 is called with an argument built by `JSON.stringify(root, null, 2)` (line 362), whose cost grows with the collection it walks. JavaScript evaluates a call's arguments BEFORE entering the method, so that join/projection runs in full every time this line is reached — and then the level check inside the logger discards the string it produced, because debug is a level a shipped configuration normally leaves off. Nothing here decides beforehand whether the message is wanted: no `isLevelEnabled`/`isDebugEnabled` test, no debug flag, no `NODE_ENV` build switch.
P2 · Observability · Console output used as the logging channel · ×18
  • Console output used as the logging channel packages/mermaid/src/assignWithDepth.ts:17 — `packages/mermaid/src/assignWithDepth.ts` reports through `console.*` at line 17 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/profiler.ts:304 — `packages/mermaid/src/profiler.ts` reports through `console.*` at line 304 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/utils/imperativeState.ts:12 — `packages/mermaid/src/utils/imperativeState.ts` reports through `console.*` at line 12 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/utils/imperativeState.ts:14 — `packages/mermaid/src/utils/imperativeState.ts` reports through `console.*` at line 14 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/rendering-util/render.ts:10 — `packages/mermaid/src/rendering-util/render.ts` reports through `console.*` at line 10 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/rendering-util/rendering-elements/shapes/drawRect.ts:18 — `packages/mermaid/src/rendering-util/rendering-elements/shapes/drawRect.ts` reports through `console.*` at line 18 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/rendering-util/layout-algorithms/ddlt/discoverFixtures.ts:110 — `packages/mermaid/src/rendering-util/layout-algorithms/ddlt/discoverFixtures.ts` reports through `console.*` at line 110 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts:75 — `packages/mermaid/src/diagrams/state/stateRenderer-v3-unified.ts` reports through `console.*` at line 75 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/diagrams/state/shapes.js:180 — `packages/mermaid/src/diagrams/state/shapes.js` reports through `console.*` at line 180 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/diagrams/kanban/kanbanDb.ts:27 — `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 27 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/diagrams/kanban/kanbanDb.ts:35 — `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 35 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/diagrams/kanban/kanbanDb.ts:37 — `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 37 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/diagrams/kanban/kanbanDb.ts:121 — `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 121 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/diagrams/kanban/kanbanDb.ts:123 — `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 123 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/diagrams/kanban/kanbanDb.ts:126 — `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 126 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid/src/diagrams/kanban/kanbanDb.ts:130 — `packages/mermaid/src/diagrams/kanban/kanbanDb.ts` reports through `console.*` at line 130 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid-example-diagram/src/mermaidUtils.ts:5 — `packages/mermaid-example-diagram/src/mermaidUtils.ts` reports through `console.*` at line 5 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel packages/mermaid-zenuml/src/mermaidUtils.ts:6 — `packages/mermaid-zenuml/src/mermaidUtils.ts` reports through `console.*` at line 6 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
IC1 · Incompleteness & stubs · Disabled test · ×16
  • Disabled test e2e/other/pr-check/configuration.spec.js:55 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test e2e/other/pr-check/dev-explorer-compare.spec.ts:11 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/scripts/docs.spec.ts:192 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/class/classDiagram.spec.ts:293 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/er/parser/erDiagram.spec.js:124 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/flowchart/parser/flow-huge.spec.js:17 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/flowchart/parser/flow-node-data.spec.js:556 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/flowchart/parser/subgraph.spec.js:64 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/git/gitGraph.spec.ts:92 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/git/gitGraph.spec.ts:111 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/git/gitGraph.spec.ts:131 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/git/gitGraph.spec.ts:191 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/diagrams/state/stateDiagram.spec.js:384 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/rendering-util/handle-markdown-text.spec.ts:207 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/__tests__/postProcessing.spec.ts:83 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
  • Disabled test packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/orthogonalRouter/__tests__/raykov.router.spec.ts:434 — A test is skipped/ignored — coverage that looks present but never runs. Re-enable it or delete it so the green run means something.
D12 · Dependency Hygiene · Deprecated · ×14
  • Deprecated: @types/flexsearch REDACTED:4048 — @types/flexsearch 0.7.42 is resolved in REDACTED and is marked deprecated by its publisher: "This is a stub types definition. flexsearch provides its own type definitions, so you do not need this installed.". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: @ungap/structured-clone REDACTED:4275 — @ungap/structured-clone 1.3.0 is resolved in REDACTED and is marked deprecated by its publisher: "Potential CWE-502 - Update to 1.3.1 or higher". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: @xmldom/xmldom REDACTED:4741 — @xmldom/xmldom 0.8.13 is resolved in REDACTED and is marked deprecated by its publisher: "this version has critical issues, please update to the latest version". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: glob REDACTED:6816 — glob 10.4.5 is resolved in REDACTED and is marked deprecated by its publisher: "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: glob REDACTED:6821 — glob 11.0.3 is resolved in REDACTED and is marked deprecated by its publisher: "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: glob REDACTED:6827 — glob 7.2.3 is resolved in REDACTED and is marked deprecated by its publisher: "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: glob REDACTED:6831 — glob 8.1.0 is resolved in REDACTED and is marked deprecated by its publisher: "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: inflight REDACTED:7081 — inflight 1.0.6 is resolved in REDACTED and is marked deprecated by its publisher: "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: nomnom REDACTED:8350 — nomnom 1.5.2 is resolved in REDACTED and is marked deprecated by its publisher: "Package no longer supported. Contact support@npmjs.com for more info.". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: prebuild-install REDACTED:8805 — prebuild-install 7.1.3 is resolved in REDACTED and is marked deprecated by its publisher: "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: rimraf REDACTED:9136 — rimraf 3.0.2 is resolved in REDACTED and is marked deprecated by its publisher: "Rimraf versions prior to v4 are no longer supported". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: sourcemap-codec REDACTED:9475 — sourcemap-codec 1.4.8 is resolved in REDACTED and is marked deprecated by its publisher: "Please use @jridgewell/sourcemap-codec instead". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: uuid REDACTED:10188 — uuid 8.3.2 is resolved in REDACTED and is marked deprecated by its publisher: "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
  • Deprecated: whatwg-encoding REDACTED:10515 — whatwg-encoding 3.1.1 is resolved in REDACTED and is marked deprecated by its publisher: "Use @exodus/bytes instead for a more spec-conformant and faster implementation". This repository does not declare it — a direct dependency pulls it in, so the move is to upgrade or replace that dependency.
D16 · Bus Factor · Off-boarding risk · ×6
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 24 significant file(s) lose their only recent owner: packages/mermaid/src/diagrams/usecase/parser/usecaseModelBuilder.ts, packages/mermaid/src/diagrams/usecase/parser/usecase.visitor.ts, packages/mermaid/src/diagrams/usecase/parser/usecase.parser.ts, packages/mermaid/src/rendering-util/layout-algorithms/elk/elkOptionCatalogue.ts, packages/mermaid/src/diagrams/usecase/styles.ts, packages/mermaid/src/diagrams/agentflow/conformance/runner.ts, packages/mermaid/src/diagrams/usecase/parser/usecase.tokens.ts, packages/mermaid/src/profiler.ts (+16 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 15 significant file(s) lose their only recent owner: packages/mermaid/src/rendering-util/layout-algorithms/grid/routerPlanning.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/routerCompatibility.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/routerTopology.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSparse.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSession.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/routerSearch.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/placement.ts, packages/mermaid/src/rendering-util/layout-algorithms/grid/routerConstraint.ts (+7 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 11 significant file(s) lose their only recent owner: packages/mermaid/src/diagrams/c4/c4Db.ts, packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/anchoredNodes.ts, packages/mermaid/src/diagrams/c4/c4ShapeAdapter.ts, packages/mermaid/src/rendering-util/rendering-elements/shapes/bpmnShapeCore.ts, packages/mermaid/src/rendering-util/rendering-elements/shapes/person.ts, packages/mermaid/src/diagrams/c4/c4Types.ts, packages/mermaid/src/rendering-util/rendering-elements/shapes/bucket.ts, packages/mermaid/src/rendering-util/rendering-elements/shapes/browser.ts (+3 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #4 — If anonymized user #4 becomes unavailable, 5 significant file(s) lose their only recent owner: packages/mermaid/src/diagrams/railroad/railroadRenderer.ts, packages/mermaid/src/diagrams/railroad/styles.ts, packages/mermaid/src/diagrams/railroad/railroadTypes.ts, packages/mermaid/src/diagrams/railroad/railroadDb.ts, packages/mermaid/src/diagrams/railroad/parser/railroadParser.ts. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #5 — If anonymized user #5 becomes unavailable, 3 significant file(s) lose their only recent owner: packages/mermaid/src/diagrams/ishikawa/ishikawaRenderer.ts, packages/mermaid/src/diagrams/timeline/timelineRendererVertical.ts, packages/mermaid/src/diagrams/venn/vennDB.ts. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #6 — If anonymized user #6 becomes unavailable, 3 significant file(s) lose their only recent owner: packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/direction/sharedTrackNudging.ts, packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/edgeLabelNodes.ts, packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/phase2.gravity.ts. Pair on, review, or document these before any departure.
IC1 · Incompleteness & stubs · Blanket warning suppression · ×4
  • Blanket warning suppression packages/mermaid/src/diagrams/quadrant-chart/quadrantRenderer.ts:1 — A bare `eslint-disable` or `@ts-nocheck` with no rule list switches every lint rule or the whole type checker off for the rest of the file — hidden debt. Disable the specific rule on the specific line, with a justification, instead.
  • Blanket warning suppression packages/mermaid/src/diagrams/sequence/sequenceRenderer.ts:1 — A bare `eslint-disable` or `@ts-nocheck` with no rule list switches every lint rule or the whole type checker off for the rest of the file — hidden debt. Disable the specific rule on the specific line, with a justification, instead.
  • Blanket warning suppression packages/mermaid/src/diagrams/timeline/timelineRenderer.ts:1 — A bare `eslint-disable` or `@ts-nocheck` with no rule list switches every lint rule or the whole type checker off for the rest of the file — hidden debt. Disable the specific rule on the specific line, with a justification, instead.
  • Blanket warning suppression packages/mermaid/src/diagrams/user-journey/journeyRenderer.ts:1 — A bare `eslint-disable` or `@ts-nocheck` with no rule list switches every lint rule or the whole type checker off for the rest of the file — hidden debt. Disable the specific rule on the specific line, with a justification, instead.
AX6 · Interface segregation · Fat interface · ×3
  • Fat interface: GitGraphDB (17 required operations) packages/mermaid/src/diagrams/git/gitGraphTypes.ts:90 — `GitGraphDB` declares 17 required operations: `setDirection`, `setOptions`, `getOptions`, `commit`, `branch`, `merge`, `cherryPick`, `checkout`, `prettyPrint`, `clear`, `getBranchesAsObjArray`, `getBranches`, `getCommits`, `getCommitsArray`, `getCurrentBranch`, `getDirection`, `getHead`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: ArchitectureDB (16 required operations) packages/mermaid/src/diagrams/architecture/architectureTypes.ts:252 — `ArchitectureDB` declares 16 required operations: `clear`, `addService`, `getServices`, `addJunction`, `getJunctions`, `getNodes`, `getNode`, `addGroup`, `getGroups`, `addEdge`, `getEdges`, `addLayoutHint`, `getLayoutHints`, `setElementForId`, `getElementById`, `getDataStructures`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
  • Fat interface: UsecaseDB (20 required operations) packages/mermaid/src/diagrams/usecase/usecaseTypes.ts:304 — `UsecaseDB` declares 20 required operations: `getConfig`, `createModel`, `commit`, `getAST`, `getActors`, `getActor`, `getUseCases`, `getUseCase`, `getSystemBoundaries`, `getSystemBoundary`, `getRelationships`, `getNotes`, `getNote`, `getJsonNodes`, `getJsonNode`, `getClassDefs`, `getClassDef`, `getDirection`, `getData`, `clear`. Counted over its REQUIRED operations — a method signature or a function-typed property with no `?`, once per signature; optional members and data properties are not counted, because no implementer is forced to write them. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
D30 · Dependency Vulnerabilities · Low CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D10 · Test Quality · Mock-dominated test · ×2
  • Mock-dominated test: calls setDiagramId with the svg element id packages/mermaid/src/diagrams/flowchart/flowRenderer-v3-unified.spec.ts:27 — This test sets up 4 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
  • Mock-dominated test: calls setDiagramId with the svg element id packages/mermaid/src/diagrams/agentflow/renderer.spec.ts:27 — This test sets up 5 test doubles (for example `vi.fn`) against 0 real object(s) of its own, and its only verification is 1 check(s) that the doubles were called. It pins how the code is wired, not what it does: it passes with a wrong result and fails when a call is harmlessly reordered or merged. Assert the outcome instead (the value returned, the state left behind), build collaborators and value objects for real or with a small hand-written fake, and keep doubles for the boundaries the test cannot own — the network, the clock, the file system.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 10 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (75 single-owned of 344 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 344 of the 679 production source files in this repository met that bar). They are anonymized user #7 (2 file(s)), anonymized user #8 (2 file(s)), anonymized user #9 (2 file(s)), anonymized user #10 (1 file(s)), anonymized user #11 (1 file(s)), anonymized user #12 (1 file(s)) (+4 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: packages/mermaid/src/diagrams/wardley/wardleyParser.ts, packages/mermaid/src/diagrams/wardley/wardleyBuilder.ts, packages/mermaid/src/diagrams/eventmodeling/renderer.ts, packages/mermaid/src/diagrams/eventmodeling/types.ts, packages/mermaid-local-editor/static/js/renderer.js, packages/mermaid-local-editor/static/js/ui.js, packages/mermaid/src/diagrams/xychart/chartBuilder/components/axis/baseAxis.ts, packages/mermaid/src/diagrams/xychart/chartBuilder/components/legend.ts (+5 more).
D21 · Naming Consistency · `deterministicIDSeed` spells `ID` where 321 names in the project spell it `Id` · ×1
  • `deterministicIDSeed` spells `ID` where 321 names in the project spell it `Id` packages/mermaid/src/config.type.ts:363 — 321 of 324 names in project mermaid-monorepo spell the token `Id` (321 of 324; unit: names in project mermaid-monorepo containing `Id`). Peers: applitools.applitoolsBatch(runId) (e2e/helpers/applitools.ts:7); E2EConfig.listId (e2e/helpers/util.ts:14); NodeWithPosition.domId (packages/mermaid-layout-tidy-tree/src/render.ts:10); accessibility.addSVGa11yTitleDescription(baseId) (packages/mermaid/src/accessibility.ts:45); DiagramDB.setDiagramId (packages/mermaid/src/diagram-api/types.ts:59). Rename to `deterministicIdSeed`. [rule N6]
D21 · Naming Consistency · `getID` spells `ID` where 321 names in the project spell it `Id` · ×1
  • `getID` spells `ID` where 321 names in the project spell it `Id` packages/mermaid/src/diagrams/git/gitGraphAst.ts:66 — 321 of 324 names in project mermaid-monorepo spell the token `Id` (321 of 324; unit: names in project mermaid-monorepo containing `Id`). Peers: applitools.applitoolsBatch(runId) (e2e/helpers/applitools.ts:7); E2EConfig.listId (e2e/helpers/util.ts:14); NodeWithPosition.domId (packages/mermaid-layout-tidy-tree/src/render.ts:10); accessibility.addSVGa11yTitleDescription(baseId) (packages/mermaid/src/accessibility.ts:45); DiagramDB.setDiagramId (packages/mermaid/src/diagram-api/types.ts:59). Rename to `getId`. [rule N6]
D21 · Naming Consistency · `InitIDGenerator` spells `ID` where 321 names in the project spell it `Id` · ×1
  • `InitIDGenerator` spells `ID` where 321 names in the project spell it `Id` packages/mermaid/src/utils.ts:754 — 321 of 324 names in project mermaid-monorepo spell the token `Id` (321 of 324; unit: names in project mermaid-monorepo containing `Id`). Peers: applitools.applitoolsBatch(runId) (e2e/helpers/applitools.ts:7); E2EConfig.listId (e2e/helpers/util.ts:14); NodeWithPosition.domId (packages/mermaid-layout-tidy-tree/src/render.ts:10); accessibility.addSVGa11yTitleDescription(baseId) (packages/mermaid/src/accessibility.ts:45); DiagramDB.setDiagramId (packages/mermaid/src/diagram-api/types.ts:59). Rename to `InitIdGenerator`. [rule N6]
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 7 project(s) overshoot their size bounds, lowering Project Cohesion to 7.1/10. The most over is `packages/mermaid` (113500 LoC, 1068 module-visible types across 68 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D31 · IaC & Container Security · Low IaC · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 55 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: scripts/swimlanes-size.ts, packages/mermaid/src/diagrams/cynefin/cynefinRenderer.ts, packages/mermaid/src/diagrams/ishikawa/ishikawaRenderer.ts, packages/mermaid/src/diagrams/railroad/styles.ts, packages/mermaid/src/diagrams/class/svgDraw.js, packages/mermaid/src/diagrams/xychart/xychartRenderer.ts, packages/mermaid/src/diagrams/sankey/sankeyRenderer.ts, packages/mermaid/src/diagrams/flowchart/flowChartShapes.js (and 47 more) (58 orphaned of 344 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 344 of the 679 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
R7 · Dead Code · Unused export 'default' · ×1
  • Unused export 'default' packages/mermaid-layout-tidy-tree/src/layouts.ts:13 — Nothing ultimately consumes this binding: its only referrer is the re-export in packages/mermaid-layout-tidy-tree/src/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in packages/mermaid-layout-tidy-tree/src/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'TidyTreeLayoutConfig' · ×1
  • Unused export 'TidyTreeLayoutConfig' packages/mermaid-layout-tidy-tree/src/types.ts:67 — Nothing ultimately consumes this binding: its only referrer is the re-export in packages/mermaid-layout-tidy-tree/src/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in packages/mermaid-layout-tidy-tree/src/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused export 'CommonTokenBuilder' · ×1
  • Unused export 'CommonTokenBuilder' packages/parser/src/language/common/tokenBuilder.ts:31 — Nothing ultimately consumes this binding: its only referrer is the re-export in packages/parser/src/language/common/index.ts, whose re-exported name has no consumer either. Removing it is therefore not a one-file change — drop the re-export line in packages/parser/src/language/common/index.ts in the same commit, or the barrel will import a name that no longer exists.
R7 · Dead Code · Unused module-local declaration 'code2' · ×1
  • Unused module-local declaration 'code2' e2e/platform/bundle-test.js:10 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused private method 'escapeHtml' · ×1
  • Unused private method 'escapeHtml' packages/mermaid/src/diagrams/class/classDb.ts:514 — Nothing in its class calls or references this private method — no member access, no string key, no decorator, and no test reaches it by name. A private member cannot be called from outside its class, so this is the whole search: remove it, or call it where it was meant to be used.
R7 · Dead Code · Unused module-local declaration '_updateNodeDimensions' · ×1
  • Unused module-local declaration '_updateNodeDimensions' packages/mermaid/src/diagrams/mindmap/mindmapRenderer.ts:15 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'addConf' · ×1
  • Unused module-local declaration 'addConf' packages/mermaid/src/diagrams/sequence/sequenceDiagram.spec.js:88 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused private field 'chartThemeConfig' · ×1
  • Unused private field 'chartThemeConfig' packages/mermaid/src/diagrams/xychart/chartBuilder/components/plot/index.ts:27 — Nothing in its class reads or assigns this private field (for a constructor parameter property: it is stored and never read), and no string key or test reaches it by name. Remove it, or use it where it was meant to take effect.
R7 · Dead Code · Unused module-local declaration '_segmentLength' · ×1
  • Unused module-local declaration '_segmentLength' packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:329 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration '_polylineIsOrthogonal' · ×1
  • Unused module-local declaration '_polylineIsOrthogonal' packages/mermaid/src/rendering-util/layout-algorithms/layout-utils/validateLayout.ts:464 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'TestEdge' · ×1
  • Unused module-local declaration 'TestEdge' packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/__tests__/phase0.helpers.spec.ts:15 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'hasEarlyReturnToStartRow' · ×1
  • Unused module-local declaration 'hasEarlyReturnToStartRow' packages/mermaid/src/rendering-util/layout-algorithms/swimlanes/__tests__/pipeline.hoe.lr.spec.ts:187 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
S1 · Web-Security Posture · No security response headers detected · ×1
  • No security response headers detected netlify.toml:1 — None of the 11 security response headers the OWASP Secure Headers Project recommends (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options, …) is configured — defense in depth, even when a reverse proxy could set them. This is reported because `netlify.toml` configures this repository's static hosting, including its response headers, so the configuration that would carry these headers is in this repository and was read in full. (−2.0 on this card.)
X2 · Cancellation propagation · Not all async functions that make a request accept an AbortSignal · ×1
  • Not all async functions that make a request accept an AbortSignal — Only 0/2 async functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http) accept an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, an unmounted component, a timed-out job. Take a `signal` (or an options object that carries one) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
X5 · Nullable reference types · Strict null checking is not enabled everywhere the repository type-checks · ×1
  • Strict null checking is not enabled everywhere the repository type-checks — 9/13 of this repository's type-checking configuration(s) turn on strict null checking (`"strict": true`, or `"strictNullChecks": true`). A configuration that states neither is counted as OFF, because off is tsc's own default; a solution-style one whose `"files"` is empty and whose `"references"` point at other projects is in neither number, because it checks no source itself. Where it is off, `string` admits `null` and `undefined`: passing a value that is null compiles silently and throws on the first property access.
X5 · Nullable reference types · Null assertions (`!`) override strict null checking · ×1
  • Null assertions (`!`) override strict null checking — ~17.2 `!` null assertions per 1k TypeScript source lines — 1889 assertion(s) across the 109611 source line(s) of the 611 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: packages/mermaid/src/rendering-util/layout-algorithms/layered/layered.ts (1075), packages/mermaid/src/rendering-util/layout-algorithms/layered/compound.ts (313), packages/mermaid/src/diagrams/wardley/wardleyRenderer.ts (66). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
X7 · Silent fallback defaults · Silent fallback default in catch · ×1
  • Silent fallback default in catch packages/mermaid/src/rendering-util/rendering-elements/edgeStepAnimation.ts:273 — `readPoints` swallows every exception into `return []` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Minor — 21 finding(s)
D12 · Dependency Hygiene · Outdated (npm) · ×15
  • Outdated (npm): @iconify/utils — @iconify/utils is pinned at 3.0.2; registry.npmjs.org publishes 3.1.7 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): @plausible-analytics/tracker — @plausible-analytics/tracker is pinned at 0.4.5; registry.npmjs.org publishes 0.4.7 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): @vueuse/core — @vueuse/core is pinned at 13.9.0; registry.npmjs.org publishes 15.0.0 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): @zenuml/core — @zenuml/core is pinned at 3.49.2; registry.npmjs.org publishes 4.13.2 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): cytoscape — cytoscape is pinned at 3.34.0; registry.npmjs.org publishes 3.35.0 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): d3 — d3 is pinned at 7.9.0; registry.npmjs.org publishes 7.9.2 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): dayjs — dayjs is pinned at 1.11.21; registry.npmjs.org publishes 1.11.23 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): elkjs — elkjs is pinned at 0.12.0; registry.npmjs.org publishes 0.12.1 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): es-toolkit — es-toolkit is pinned at 1.45.1; registry.npmjs.org publishes 1.53.2 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): jiti — jiti is pinned at 2.5.1; registry.npmjs.org publishes 2.7.0 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): katex — katex is pinned at 0.18.11; registry.npmjs.org publishes 0.19.1 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): marked — marked is pinned at 16.3.0; registry.npmjs.org publishes 18.2.0 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): stylis — stylis is pinned at 4.3.6; registry.npmjs.org publishes 4.4.0 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): ts-dedent — ts-dedent is pinned at 2.2.0; registry.npmjs.org publishes 2.3.0 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
  • Outdated (npm): vue — vue is pinned at 3.5.40; registry.npmjs.org publishes 3.5.45 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.
D10 · Test Quality · Skipped (documented) · ×3
  • Skipped (documented): (unnamed test) packages/mermaid/src/rendering-util/layout-algorithms/grid/performance.spec.ts:321 — Skipped with a documented reason — a deferral, not lazy debt: switched off by it.skipIf
  • Skipped (documented): setConfig packages/mermaid/src/diagrams/pie/pie.spec.ts:180 — Skipped with a documented reason — a deferral, not lazy debt: declared with it.todo — a placeholder that registers a name and runs nothing
  • Skipped (documented): resetConfig packages/mermaid/src/diagrams/pie/pie.spec.ts:192 — Skipped with a documented reason — a deferral, not lazy debt: declared with it.todo — a placeholder that registers a name and runs nothing
D24 · Comment Value · doc comments repeat the names · ×3
  • doc comments repeat the names packages/mermaid/src/docs/.vitepress/headerDomainRules.ts:9 — 0 of 3 documented parameters and 2 of 34 summaries in `@mermaid-js/docs` only repeat the member or parameter name (e.g. "Default logo for mermaid.js.org" for `MERMAID_JS_ORG_LOGO`). Delete the restating tags, or add what the name does not say.
  • doc comments repeat the names packages/mermaid/scripts/docs.mts:305 — 14 of 594 documented parameters and 14 of 1236 summaries in `mermaid` only repeat the member or parameter name (e.g. "Options for" for `TransformMarkdownAstOptions`). 100 documentation tag(s) are empty. Delete the restating tags, or add what the name does not say.
  • doc comments repeat the names scripts/tsc-check.ts:186 — 0 of 4 documented parameters and 1 of 80 summaries in `mermaid-monorepo` only repeat the member or parameter name (e.g. "Build all the tarballs." for `buildTarballs`). 2 documentation tag(s) are empty. Delete the restating tags, or add what the name does not say.

Appendix B — Reproduction & audit trail

Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-845bc7cb539d463dad540d202641f27d/history.json --exit-code 0 --source .8artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-845bc7cb539d463dad540d202641f27d/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude demos/dev --exclude docs/config/setup/config/functions --exclude docs/config/setup/mermaid/interfaces --exclude docs/config/setup/mermaid/type-aliases .22artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .75artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .2artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 14 file(s) — `.build/common.ts`, `packages/mermaid/src/diagrams/flowchart/flowDb.ts`, `packages/mermaid/src/diagrams/git/gitGraphAst.ts`, `packages/mermaid/src/diagrams/kanban/kanbanDb.ts`, `packages/mermaid/src/diagrams/state/stateDb.ts`, … (+9 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1d967-ad2e-783b-b8d1-71b86a21f954 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.

⬇ Findings, MITRE CWE-tagged .sarif⬇ Health changelog .md