Public report of migueldeicaza/SwiftTerm, published 29 October 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.10.5). 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, 29 October 2026, 11:06 UTC · Survey ID cd_bbd7c2770644492f923306a3e7ae9aed

migueldeicaza/SwiftTerm

Measured 29 October 2026, 11:02 UTC, at code version 9eccf35

No regression since the last survey

A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.

CAI score 55out of 100 Adequate
CriticalWeakAdequateStrongExemplary
Down 3 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 medium codebase: 73,463 lines of product code in 12 projects, tests not counted · Estimated rebuild effort: about 0.8 person-years · Weakest lens: Production Readiness, 42

Findings by how serious they are

22 critical 837 serious 80 minor

18 dimensions are left out of the score. For each one, Watchdog either couldn't measure it in this code, or found no evidence of the safeguard it looks 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

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
29 October 2026, 11:02 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 Watchdog. It is open to any tool that implements it, and today Watchdog is the only one that does.

The score is deterministic, which means the same code always gets the same score. Watchdog works 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 ▸

79of 79 dimensions measured by tools.
917of 939 findings point to an exact file and line, so you can open each one in the code. The other 22 concern the repository as a whole, such as missing documentation.
79dimensions across 8 lenses, read from 73,463 lines of product code in 12 projects.
Chapters

Executive summary

migueldeicaza/SwiftTerm falls short of our standard for a template or a sample, in part because we found no automated security scanning of the code, its secrets or its dependencies. It scores 55 out of 100 and is rated Adequate, and 19 of its 22 critical findings are security problems in the build pipeline and in the packages it uses.

Production Readiness, at 42, is the weakest lens and counts most in the score. The best first step for the work it takes is making the tests check their results, worth about 5 points. Adding automated security scanning would lift Production Readiness itself, worth about 7 points. Raising Production Readiness to 52 would lift the score to about 59.

Seventeen pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. One known security hole in a package the code depends on can be used by attackers, and one pipeline step runs a download nobody checks. Pinning each tool to an exact version, updating the vulnerable packages and checking the download against a checksum would close these risks. The two tests that check nothing need to check the result they produce.

The product code is 73,463 lines, about €110,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.
Production Readiness 42 · counts for 45%Code Health 59 · counts for 25%Accessibility 59 · counts for 14%Security and Compliance 74 · counts for 8%Performance 81 · counts for 4%Maturity 87 · counts for 2%Architecture 96 · counts for 1%Domain Modelling 100 · counts for 1%

If Production Readiness rose from 42 to 52, the lowest score rated Strong, the score would rise from 55 to about 59.

Code composition: what the lines of code are
Product code 66%Tests 34%
New since the last survey: 69 findings

These 69 critical or serious findings weren't in the previous survey, on 15 October 2026.

  • Cyclomatic Complexity · MetalTerminalRenderer.prepareRow (cyclomatic 59) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Cyclomatic Complexity · MetalTerminalRenderer.placeRow (cyclomatic 59) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Cyclomatic Complexity · SelectionService.urlRange (cyclomatic 30) Sources/SwiftTerm/SelectionService.swift
  • Cyclomatic Complexity · SelectionService.selectedColumns (cyclomatic 24) Sources/SwiftTerm/SelectionService.swift
  • Cyclomatic Complexity · SelectionService.pathRange (cyclomatic 22) Sources/SwiftTerm/SelectionService.swift
  • Cyclomatic Complexity · SnapshotTextBuilder.sameAttributes (cyclomatic 22) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift
  • Cyclomatic Complexity · SnapshotTextBuilder.plainRow (cyclomatic 21) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift
  • Cyclomatic Complexity · SearchEngine.match (cyclomatic 20) Sources/SwiftTerm/SearchEngine.swift
  • Cyclomatic Complexity · Terminal.cmdEraseInDisplay (cyclomatic 20) Sources/SwiftTerm/Terminal.swift
  • Cyclomatic Complexity · PowerlineRenderer.path (cyclomatic 18) Sources/SwiftTerm/Apple/PowerlineRenderer.swift
  • Cyclomatic Complexity · MetalTerminalRenderer.preparePlainRow (cyclomatic 18) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Cyclomatic Complexity · Table.canChange (cyclomatic 18) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift
  • Cyclomatic Complexity · SnapshotTextBuilder.plainStyle (cyclomatic 17) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift
  • Cognitive Complexity · MetalTerminalRenderer.prepareRow (cognitive 154) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Cognitive Complexity · MetalTerminalRenderer.placeRow (cognitive 102) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Cognitive Complexity · Table.canChange (cognitive 46) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift
  • Cognitive Complexity · SelectionService.urlRange (cognitive 39) Sources/SwiftTerm/SelectionService.swift
  • Cognitive Complexity · SelectionService.selectedColumns (cognitive 38) Sources/SwiftTerm/SelectionService.swift
  • Cognitive Complexity · MetalTerminalRenderer.preparePlainRow (cognitive 35) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Cognitive Complexity · SnapshotTextBuilder.plainRow (cognitive 32) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift
  • Cognitive Complexity · SearchEngine.match (cognitive 28) Sources/SwiftTerm/SearchEngine.swift
  • Cognitive Complexity · Terminal.cmdEraseInDisplay (cognitive 28) Sources/SwiftTerm/Terminal.swift
  • Cognitive Complexity · SelectionService.pathRange (cognitive 24) Sources/SwiftTerm/SelectionService.swift
  • Cognitive Complexity · SnapshotTextBuilder.plainStyle (cognitive 23) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift
  • Cognitive Complexity · SnapshotTextBuilder.sameAttributes (cognitive 22) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift
  • Cognitive Complexity · PlainTextFont.shapesOneToOne (cognitive 21) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift
  • Cognitive Complexity · Terminal.reverseWrapBackward (cognitive 20) Sources/SwiftTerm/Terminal.swift
  • Cognitive Complexity · Table.subtableCanApply (cognitive 20) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift
  • Cognitive Complexity · PlainTextFont.analyze (cognitive 19) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift
  • Cognitive Complexity · SelectionService.logicalLineCells (cognitive 17) Sources/SwiftTerm/SelectionService.swift
  • Cognitive Complexity · SelectionService.selectedContentIsUnchanged (cognitive 16) Sources/SwiftTerm/SelectionService.swift
  • Cognitive Complexity · SelectionService.shiftExtend (cognitive 16) Sources/SwiftTerm/SelectionService.swift
  • Cognitive Complexity · SelectionService.blockText (cognitive 16) Sources/SwiftTerm/SelectionService.swift
  • God Classes · MethodTooLong: MetalTerminalRenderer.placeRow Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • God Classes · MethodTooLong: MetalTerminalRenderer.prepareRow Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • God Classes · MethodTooLong: MetalTerminalRenderer.preparePlainRow Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift
  • Code Duplication · Duplicated block (19 lines × 2) Sources/SwiftTerm/Profiling.swift
  • Code Duplication · Duplicated block (14–15 lines × 2) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift
  • Code Duplication · Duplicated block (12–14 lines × 2) Sources/SwiftTerm/SearchEngine.swift
  • Code Duplication · Duplicated block (11 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (11 lines × 2) Sources/SwiftTerm/SelectionService.swift
  • Code Duplication · Duplicated block (10 lines × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (10 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift
  • Code Duplication · Duplicated block (9 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (8 lines × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (8 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift
  • Code Duplication · Duplicated block (5 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift
  • Code Duplication · Duplicated block (7 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Test Quality · No assertions: unfocusedCaretRestoresGraphicsState Tests/SwiftTermTests/CaretViewGStateTests.swift
  • Test Quality · No assertions: nonBlockCaretRestoresGraphicsState Tests/SwiftTermTests/CaretViewGStateTests.swift
  • Test Quality · No assertions: blockCaretRestoresGraphicsState Tests/SwiftTermTests/CaretViewGStateTests.swift
  • Test Quality · No assertions: powerlineBlockCaretRestoresGraphicsState Tests/SwiftTermTests/CaretViewGStateTests.swift
  • Static Analysis (SAST) · REDACTED
  • Static Analysis (SAST) · REDACTED
  • Static Analysis (SAST) · REDACTED
  • Static Analysis (SAST) · REDACTED
  • Static Analysis (SAST) · REDACTED
  • Static Analysis (SAST) · REDACTED
  • Static Analysis (SAST) · REDACTED
  • Static Analysis (SAST) · REDACTED
  • Supply-chain Provenance & Signing · REDACTED
  • Supply-chain Provenance & Signing · REDACTED
  • Test Coverage · This test file cannot be loaded Tests/WebWasmTests/browser-input.mjs
  • Test Coverage · This test file cannot be loaded Tests/WebWasmTests/canvas-grid.mjs
  • Test Coverage · This test file cannot be loaded Tests/WebWasmTests/corpus.test.mjs
  • Exception handling · Swallowed exception (caught, then discarded) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift
  • Outbound HTTP resilience · Outbound HTTP without resilience scripts/regen_unicode_width_data.py
  • Visual & motion safety · Focus outline removed in CSS without a :focus replacement TerminalApp/WebTerminal/Public/styles.css

Watchdog compares 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: 34 findings

These 34 critical or serious findings were in the previous survey, on 15 October 2026, and are gone from this one.

  • Cyclomatic Complexity · MetalTerminalRenderer.buildRowDrawData (cyclomatic 96) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Cyclomatic Complexity · SearchEngine.findInLine (cyclomatic 29) Sources/SwiftTerm/SearchEngine.swift
  • Cyclomatic Complexity · SelectionService.selectedColumnsRange (cyclomatic 20) Sources/SwiftTerm/SelectionService.swift
  • Cyclomatic Complexity · SnapshotSelectionResolver.columns (cyclomatic 20) Sources/SwiftTerm/Apple/AppleTerminalView.swift
  • Cyclomatic Complexity · Terminal.cmdBackspace (cyclomatic 16) Sources/SwiftTerm/Terminal.swift
  • Cognitive Complexity · MetalTerminalRenderer.buildRowDrawData (cognitive 224) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Cognitive Complexity · SearchEngine.findInLine (cognitive 48) Sources/SwiftTerm/SearchEngine.swift
  • Cognitive Complexity · SelectionService.selectedColumnsRange (cognitive 32) Sources/SwiftTerm/SelectionService.swift
  • Cognitive Complexity · SnapshotSelectionResolver.columns (cognitive 28) Sources/SwiftTerm/Apple/AppleTerminalView.swift
  • Cognitive Complexity · Terminal.cmdBackspace (cognitive 23) Sources/SwiftTerm/Terminal.swift
  • Cognitive Complexity · Terminal.resetMode (cognitive 17) Sources/SwiftTerm/Terminal.swift
  • Cognitive Complexity · Terminal.setMode (cognitive 17) Sources/SwiftTerm/Terminal.swift
  • God Classes · MethodTooLong: MetalTerminalRenderer.buildRowDrawData Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • God Classes · ClassTooLong: SelectionService Sources/SwiftTerm/SelectionService.swift
  • Code Duplication · Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift
  • Code Duplication · Duplicated block (17 lines × 2) Sources/SwiftTerm/Profiling.swift
  • Code Duplication · Duplicated block (16 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (16 lines × 2) Sources/SwiftTerm/SearchEngine.swift
  • Code Duplication · Duplicated block (15 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (12 lines × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (9–10 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift
  • Code Duplication · Duplicated block (4–6 lines × 4) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (6 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (9 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift
  • Code Duplication · Duplicated block (6 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift
  • Code Duplication · Duplicated block (7 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Code Duplication · Duplicated block (9 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
  • Explicit Debt · TodoComment Sources/SwiftTerm/Terminal.swift
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Static Analysis (SAST) · High: REDACTED REDACTED
  • Supply-chain Provenance & Signing REDACTED
Rebuild cost: about €110,000 · Estimate
Cost to rebuild€37,000 to €180,000, for 613 to 1,945 hours of work, about 0.8 person-years for 1 to 2 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.8 at a score of 55. 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.
SizeMedium: 73,463 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: Watchdog prices 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
Resolve the 1 Assertions commented out finding(s) in Test Quality — start with MeanTests.swift.
Raises the score by about 5 points · Low effort · Test Quality
2
Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with FuzzerTests.swift.
Raises the score by about 5 points · Low effort · Test Quality
3
Add a SAST step to CI running what this repository's stack ships: CodeQL's Swift pack (Swift/Xcode) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
Raises the score by about 7 points · Medium effort · Security & performance tooling

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.

Where the investment is most exposed · Value at risk
This code would cost about €110,000 to build again, about 0.8 person-years of work. Its weakest lens is Production Readiness, at 42 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Resolve the 1 Assertions commented out finding(s) in Test Quality. Of all the actions in this report, it raises the score most for the work it takes: about 5 points for low effort, because it clears the 1 Test Quality findings. 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 6.2 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 4% to 10% on every change. The history of the code shows how much it changes: about 124,154 lines over the last 90 days, which is about 503,513 lines a year. At that pace, the extra work comes to an estimated 56.5 to 338.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 Watchdog's 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 · Code Duplication · 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 @swiftterm/wasm wasm BidiHarness BidiHarness SwiftTerm SwiftTerm BidiHarness->SwiftTerm MacTerminal MacTerminal MacTerminal->SwiftTerm VTEBenchWorkloads VTEBenchWorkloads MacTerminal->VTEBenchWorkloads SwiftTermBuildInfoGenerator SwiftTermBuildInfoGenerator SwiftTermFuzz SwiftTermFuzz SwiftTermFuzz->SwiftTerm SwiftTermProfile SwiftTermProfile SwiftTermProfile->SwiftTerm SwiftTermProfile->VTEBenchWorkloads SwiftTermWasmSmoke SwiftTermWasmSmoke SwiftTermWasmSmoke->SwiftTerm SwiftTermWebWasm SwiftTermWebWasm SwiftTermWebWasm->SwiftTerm Termcast Termcast Termcast->SwiftTerm iOSTerminal iOSTerminal iOSTerminal->SwiftTerm

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.

27 modules, with 26 dependencies between them. 2 loops run through 5 of the modules, marked above the diagonal.

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 TerminalApp.WebTerminal.Public2 TerminalApp.WebTerminal.Public.app3 TerminalApp.WebTerminal.Public.clipboard4 Tools5 Tools.BidiHarness.Scripts6 Tools.SwiftTermBenchmarks7 Web.src.errors8 Web.src.graphics9 Web.src.types10 scripts11 SwiftTermBuildInfoGenerator12 SwiftTermWebWasm13 Web.src.terminal14 SwiftTerm15 Web.src.keyboard16 Web.src.loader17 CaptureOutput18 SwiftTermFuzz19 SwiftTermWasmSmoke20 Termcast21 TerminalApp~WebTerminal~WebTerminalServer22 Tools~RenderBench~RenderBench23 Tools~SwiftTermBenchmarks~SwiftTermProfile24 Tools~SwiftTermBenchmarks~VTEBenchWorkloads25 Web.src26 Web.src.input27 repository
1 TerminalApp.WebTerminal.Public
2 TerminalApp.WebTerminal.Public.app
3 TerminalApp.WebTerminal.Public.clipboard
4 Tools
5 Tools.BidiHarness.Scripts
6 Tools.SwiftTermBenchmarks
7 Web.src.errors
8 Web.src.graphics
9 Web.src.types
10 scripts
11 SwiftTermBuildInfoGenerator8
12 SwiftTermWebWasm31
13 Web.src.terminal101
14 SwiftTerm31
15 Web.src.keyboard11
16 Web.src.loader21
17 CaptureOutput8
18 SwiftTermFuzz3
19 SwiftTermWasmSmoke3
20 Termcast13
21 TerminalApp~WebTerminal~WebTerminalServer11
22 Tools~RenderBench~RenderBench7
23 Tools~SwiftTermBenchmarks~SwiftTermProfile1
24 Tools~SwiftTermBenchmarks~VTEBenchWorkloads3
25 Web.src1121
26 Web.src.input111
27 repository68
Uses a module listed above itPart of a loopThe module itself
1 TerminalApp.WebTerminal.Public2 TerminalApp.WebTerminal.Public.app3 TerminalApp.WebTerminal.Public.clipboard4 Tools5 Tools.BidiHarness.Scripts6 Tools.SwiftTermBenchmarks7 Web.src.errors8 Web.src.graphics9 Web.src.types10 scripts11 SwiftTermBuildInfoGenerator12 SwiftTermWebWasm13 Web.src.terminal14 SwiftTerm15 Web.src.keyboard16 Web.src.loader17 CaptureOutput18 SwiftTermFuzz19 SwiftTermWasmSmoke20 Termcast21 TerminalApp~WebTerminal~WebTerminalServer22 Tools~RenderBench~RenderBench23 Tools~SwiftTermBenchmarks~SwiftTermProfile24 Tools~SwiftTermBenchmarks~VTEBenchWorkloads25 Web.src26 Web.src.input27 repositoryTerminalApp.WebTerminal.Public1TerminalApp.WebTerminal.Public.app2TerminalApp.WebTerminal.Public.clipboard3Tools4Tools.BidiHarness.Scripts5Tools.SwiftTermBenchmarks6Web.src.errors7Web.src.graphics8Web.src.types9scripts10SwiftTermBuildInfoGenerator11SwiftTermWebWasm12Web.src.terminal13SwiftTerm14Web.src.keyboard15Web.src.loader16CaptureOutput17SwiftTermFuzz18SwiftTermWasmSmoke19Termcast20TerminalApp~WebTerminal~WebTerminalServer21Tools~RenderBench~RenderBench22Tools~SwiftTermBenchmarks~SwiftTermProfile23Tools~SwiftTermBenchmarks~VTEBenchWorkloads24Web.src25Web.src.input26repository278311013111218331311713112111168

At a glance — Code Health · 59% · Adequate · gated by D2, R1 ·

At a glance — Architecture · 96% · Exemplary ·

At a glance — Maturity · 87% · Exemplary ·

At a glance — Readiness · 42% · Adequate · gated by P3, P7 ·

At a glance — Security · 74% · Adequate · gated by D36 ·

At a glance — Domain Modelling · 100% · Exemplary ·

At a glance — Accessibility · 59% · Adequate · gated by AC6 ·

At a glance — Performance · 81% · Exemplary ·

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
A05:2025 — Injection22High / Critical
A03:2025 — Software Supply Chain Failures9High / Critical

Roadmap

First, integrate a SAST step into the CI pipeline to ensure security regressions fail the build immediately. Next, improve test quality by resolving commented-out assertions, empty tests, and the significant volume of tests lacking assertions, prioritizing the specified files. Finally, harden outbound HTTP resilience by adding timeouts, retry logic, and circuit breakers to all external calls to prevent indefinite waits.

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

Do thisHelpsEffortDimension
Resolve the 1 Assertions commented out finding(s) in Test Quality — start with MeanTests.swift.+4.5 ptsLowTest Quality
Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with FuzzerTests.swift.+4.5 ptsLowTest Quality
Add a SAST step to CI running what this repository's stack ships: CodeQL's Swift pack (Swift/Xcode) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.+6.9 ptsMediumSecurity & performance tooling
Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.+3.3 ptsMediumOutbound HTTP resilience
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.+2.6 ptsMediumType Safety
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.+2.6 ptsMediumVisual & motion safety
Enforce accessibility in the toolchain your project already uses: assert accessibility in your UI test suite with your toolkit's own matcher (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in CI so a regression blocks the merge.+1.9 ptsMediumA11y enforcement
Resolve the 209 No assertions finding(s) in Test Quality — start with KittyKeyboardEncoderTests.swift (51), CsiParameterParsingTests.swift (32), ProfileSupportTests.swift (22).+3.4 ptsHighTest Quality

File quality

Per-file score 0–10 — a quality signature. Of 127 files carrying findings, judged against the Template bar: 1% slop · 4% mixed · 95% near-clean.

FileScoreBandWorst signal
REDACTED1.3SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.3MixedStatic Analysis (SAST): High: REDACTED
Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift4.8MixedCyclomatic Complexity: MetalTerminalRenderer.prepareRow (cyclomatic 59)
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
TerminalApp/MacTerminal/ViewController.swift5.5MixedCyclomatic Complexity: ViewController.validateUserInterfaceItem (cyclomatic 31)
Sources/SwiftTerm/CircularList.swift5.7MixedCognitive Complexity: CircularBufferLineList.shiftElements (cognitive 19)
Sources/SwiftTerm/iOS/iOSTerminalView.swift6.0Near-cleanExplicit Debt: TodoComment
Sources/SwiftTerm/Mac/MacTerminalView.swift6.0Near-cleanExplicit Debt: TodoComment
Sources/SwiftTerm/Apple/AppleTerminalView.swift6.0Near-cleanExplicit Debt: TodoComment
Sources/SwiftTerm/Terminal.swift6.0Near-cleanExplicit Debt: TodoComment
Sources/SwiftTerm/Buffer.swift6.0Near-cleanExplicit Debt: TodoComment
Sources/SwiftTerm/Mac/MacCaretView.swift6.0Near-cleanExplicit Debt: TodoComment
Tests/SwiftTermTests/FuzzerTests.swift6.5Near-cleanTest Quality: No assertions (empty test): testCrashes
Sources/SwiftTerm/EscapeSequenceParser.swift7.0Near-cleanCyclomatic Complexity: EscapeSequenceParser.parseBorrowed (cyclomatic 104)
Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift7.0Near-cleanCyclomatic Complexity: SnapshotTextBuilder.buildAttributedString (cyclomatic 70)
Sources/SwiftTerm/KittyKeyboardEncoder.swift7.0Near-cleanCyclomatic Complexity: KittyKeyboardEncoder.encode (cyclomatic 54)
Sources/SwiftTerm/KittyGraphics.swift7.0Near-cleanCyclomatic Complexity: Terminal.parseKittyGraphicsControl (cyclomatic 42)
Sources/SwiftTerm/Apple/TerminalBidi.swift7.0Near-cleanCyclomatic Complexity: TerminalBidi.shapeArabic (cyclomatic 35)
Sources/SwiftTerm/SelectionService.swift7.0Near-cleanCyclomatic Complexity: SelectionService.urlRange (cyclomatic 30)
Sources/SwiftTerm/KittyClipboardProtocol.swift7.0Near-cleanCyclomatic Complexity: KittyClipboardMetadata.parse (cyclomatic 20)

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 — 22

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 — 837

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 — 80

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

Could not be resolved — 18

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

Watchdog 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. 79 of 79 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.8 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

Every figure here is one of three 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; ◐ Advisory — an LLM prose judgement. 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; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.

What we checked — 79 dimensions across the health lenses
D1D2D3D4D5D6D9D10D12D13D14D15D16D17D26D28D29D30D34D35D36D37D43AC1AC2AC3AC5AC6AC7AX10AX2AX3AX4AX6AX8AX9DM4DM5M1M3M4P1P10P2P3P4P6P7PF1PF2PF3R1R10R2R3R5R7R8R9X1X12X13X14X15X16X17X18X19X21X22X23X24X25X26X27X28X29X3X30

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, 917 of 939 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, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — 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
Watchdog 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 · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurement—◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a18753-b5f6-7fb2-82d1-b6d73b436c6e.

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 — not measured this run — Watchdog 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. Coverage NOT MEASURED: the JavaScript/TypeScript half measured 51.0% (node:test via `npm ci --ignore-scripts` in Web/); the Swift half could not be measured — the Swift suite in . produced no coverage export. This repository's production source spans both ecosystems, and no partial figure is published as if it were the whole: coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo — a coverage step in CI (`swift test --no-parallel --enable-code-coverage`) shows coverage is measured in your own CI. Commit the lcov/Cobertura report it produces and the real number is read on the next scan. You can widen what we reach: optional: commit the lcov/Cobertura report your CI produces, and the real number is read on the next scan.
  • D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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. The 2,088 test(s) behind this row are the ones the code-model census could read, and this repository also carries at least 17 test source file(s) (.mjs) that it cannot: it reads the test types the .swift frontend declared, so a suite in any other language is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — Watchdog 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. Test reliability NOT SCORED: this repository's production source includes .swift, and the swift executor ran against the .swift half and could not be re-run to completion inside our analyzer environment — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (node:test via `npm ci --ignore-scripts` in Web/ (58 tests)): measured (0 flaky) suite(s) did re-run, and came back with 0 flaky across 1 measured tier(s) — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — test reliability is excluded from the score rather than counted. The remedy is our analyzer environment, not a runner nobody has built.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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 repository declares package.json, but the licence verdict published here was taken over its SwiftPM package dependencies. Nothing was read about its npm dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D21 Naming Consistency — not measured this run — Watchdog 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. D21's deterministic naming 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. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog 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.
  • D24 Comment Value — not measured this run — Watchdog 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's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D27 Navigability — not measured this run — Watchdog 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. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog 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. `Sources/SwiftTerm/Apple/AppleTerminalView.swift`, `Sources/SwiftTerm/CharData.swift`, `Sources/SwiftTerm/CsiParameters.swift`, `Sources/SwiftTerm/KittyGraphics.swift`, `Sources/SwiftTerm/Mac/MacTerminalView.swift`, … (+5 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 — Watchdog 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 Dockerfile) is simply not read here yet.
  • AXB1 Runtime evidence locked — no reproducible boot — not measured this run — Watchdog 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. Subject: 1 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. Watchdog then boots it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
  • C1 Data Protection — not measured this run — Watchdog 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. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — Watchdog 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. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — Watchdog 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. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog 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, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python, Swift, c is most of its product and is not read yet, 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.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog 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, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Swift, c is most of its product and is not read yet, 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.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it 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.
  • P5 DR & Backup — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • S1 Web-Security Posture — not measured this run — Watchdog 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. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X2 Cancellation propagation — not measured this run — Watchdog 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, Go, PHP, Dart, Kotlin, Ruby, Scala, Java, Python and Rust source only, and no C# was loaded, and no named async function in this repository's JavaScript/TypeScript, nor any Go, PHP or Dart function or Kotlin suspend function, makes a request that can be cancelled (fetch, axios, ky, ofetch; net/http, net.Dial; amphp; Dio; Ktor, OkHttp), so there is nothing to judge, 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.
  • X4 Structured logging — not measured this run — Watchdog 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 make no call through a named logger, 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.
  • X5 Nullable reference types — not measured this run — Watchdog 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 MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's C, Python, Swift is not read yet, 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 (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

Watchdog assesses the repository exactly as committed, and only the repository. By design it does 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.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • 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.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • 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 Secret Scanning: Secret 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.
  • 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.
  • 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.
  • 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.
  • AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
  • 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.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • 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.
  • AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
  • 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.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • 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".
  • 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 Complexity4.7 / 10Weak✓ 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 4.7 / 10 · rule-coverage 100% · ceiling Prevented

150 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was TerminalView.pressesBegan at 116. A further 11 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 BoxDrawingRenderer.draw at 129 — they are counted neither in the figure above nor in this dimension's score. 2 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: Sources/SwiftTerm/HangulInput.swift (HangulInput.splitFinalForFollowingVowel at 28), Sources/SwiftTerm/Profiling.swift (ProfilingEvent.name at 17). 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.

Terminal.handlePrintSlow::insertScalarBatch (cyclomatic 21) · ×2Sources/SwiftTerm/Terminal.swift:2165
TerminalView.pressesBegan (cyclomatic 116)Sources/SwiftTerm/iOS/iOSTerminalView.swift:3234
EscapeSequenceParser.parseBorrowed (cyclomatic 104)Sources/SwiftTerm/EscapeSequenceParser.swift:1090
TerminalView.keyDown (cyclomatic 103)Sources/SwiftTerm/Mac/MacTerminalView.swift:2318
TerminalView.drawTerminalContents (cyclomatic 102)Sources/SwiftTerm/Apple/AppleTerminalView.swift:3297

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

What to do

  1. Bring the 9 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with TerminalView.pressesBegan (cyclomatic 116), EscapeSequenceParser.parseBorrowed (cyclomatic 104), TerminalView.keyDown (cyclomatic 103). — 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 9 together lifts Cyclomatic Complexity from 4.7 to about 5.8/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

202 method(s) exceeded the cognitive complexity threshold of 15; the worst was TerminalView.drawTerminalContents at 242.

Terminal.handlePrintSlow::batchableScalar (cognitive 27) · ×2Sources/SwiftTerm/Terminal.swift:2080
TerminalView.drawTerminalContents (cognitive 242)Sources/SwiftTerm/Apple/AppleTerminalView.swift:3297
EscapeSequenceParser.parseBorrowed (cognitive 210)Sources/SwiftTerm/EscapeSequenceParser.swift:1090
TerminalView.pressesBegan (cognitive 183)Sources/SwiftTerm/iOS/iOSTerminalView.swift:3234
MetalTerminalRenderer.prepareRow (cognitive 154)Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1920

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

What to do

  1. Bring the 8 bodies over 120 down to 120 or less in Cognitive Complexity — start with TerminalView.drawTerminalContents (cognitive 242), EscapeSequenceParser.parseBorrowed (cognitive 210), TerminalView.pressesBegan (cognitive 183). — 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 8 together lifts Cognitive Complexity from 2.1 to about 3.6/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes8.1 / 10Strong✓ 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 8.1 / 10 · rule-coverage 100% · ceiling Prevented

77 god class(es) detected.

MethodTooLong: TerminalView.drawTerminalContents · ×23Sources/SwiftTerm/Apple/AppleTerminalView.swift:3297
FileTooLong: SwiftTerm/Terminal.swift · ×22Sources/SwiftTerm/Terminal.swift
TooManyMethods: Terminal · ×16Sources/SwiftTerm/Terminal.swift:391
ClassTooLong: TerminalView · ×14Sources/SwiftTerm/Mac/MacTerminalView.swift:105
FunctionTooLong: AppleTerminalView.swift.top-level code · ×2Sources/SwiftTerm/Apple/AppleTerminalView.swift:21

What to do

  1. Resolve the 23 MethodTooLong finding(s) in God Classes — start with MetalTerminalRenderer.swift (6), MacTerminalView.swift (3), iOSTerminalView.swift (2). — One of this dimension's main actionable groups (23 warning-level).
  2. Resolve the 22 FileTooLong finding(s) in God Classes — start with Terminal.swift, MetalTerminalRenderer.swift, AppleTerminalView.swift. — One of this dimension's main actionable groups (22 warning-level).
  3. Resolve the 16 TooManyMethods finding(s) in God Classes — start with Terminal.swift, MacTerminalView.swift, iOSTerminalView.swift. — One of this dimension's main actionable groups (16 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.3 / 10Stronggated by 104 serious findings✓ Tool-verified

What it measures: Copy-pasted code that should be shared instead.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.

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

102 duplicated block group(s) detected. A further 2 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted.

Duplicated block (7 lines × 2) · ×10Sources/SwiftTerm/Apple/AppleTerminalView.swift:3181
Duplicated block (6 lines × 2) · ×10Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3666
Duplicated block (5 lines × 2) · ×10Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:476
Duplicated block (11 lines × 2) · ×9Sources/SwiftTerm/Apple/AppleTerminalView.swift:2782
Duplicated block (10 lines × 2) · ×8Docs/prototypes/futex-ticket-lock/main.swift:110

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

What to do

  1. Resolve the 10 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with MacTerminalView.swift (3), AppleTerminalView.swift, CellStorage.swift. — One of this dimension's main actionable groups (10 warning-level).
  2. Resolve the 10 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with Terminal.swift (2), MetalTerminalRenderer.swift, ByteRunScanner.swift. — One of this dimension's main actionable groups (10 warning-level).
  3. Resolve the 10 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with MacTerminalView.swift (2), BoxDrawingRenderer.swift, KittyGraphics.swift. — One of this dimension's main actionable groups (10 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

Detailed fixes: d4_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

12 production modules (npm+SwiftPM+Xcode), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; a workspace's implicit (product-name) dependency is not visible there; 2 module(s) off the main sequence.

Off the main sequence: VTEBenchWorkloads · ×2

What to do

  1. Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 warning-level).
  2. Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D6 · Cohesion (LCOM4)8.7 / 10Strong✓ 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 8.7 / 10 · rule-coverage 100% · ceiling Verified

14 of 130 classes have LCOM4 above 3.

Low cohesion: TerminalView (LCOM4 28) · ×14Sources/SwiftTerm/Mac/MacTerminalView.swift:105

What to do

  1. Resolve the 14 Low cohesion finding(s) in Cohesion (LCOM4) — start with MacLocalTerminalView.swift (2), MetalTerminalRenderer.swift (2), MacTerminalView.swift. — One of this dimension's main actionable groups (14 warning-level).
  2. Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

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

2168 test methods: 2168 unit, 0 integration, 0 BDD, 0 e2e. The JavaScript/TypeScript suite contributes 80 `it`/`test` case(s) across 12 test file(s) declaring at least one beside 2088 .NET test method(s); its tier split is read from package names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality8.5 / 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 8.5 / 10 · rule-coverage 100% · ceiling Prevented

45 skipped (43 with a documented reason), 211 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 2088 tests. Measured on the .swift suite only — at least 17 test source file(s) (.mjs) went unread, so its test quality is unmeasured and is not in these counts.

No assertions (empty test): testCrashesTests/SwiftTermTests/FuzzerTests.swift:60
Assertions commented out: testInvalidMarginsTests/SwiftTermTests/MeanTests.swift:40
No assertions: testScrollWithCorruptedYBase · ×209Tests/SwiftTermTests/BufferTests.swift:459
Skipped test: testCheckedLaunchWriteAndResize · ×2Tests/SwiftTermTests/LocalProcessLifecycleTests.swift:590
Skipped (documented): rowAndCursorGlyphOriginsUseDevicePixels · ×43Tests/SwiftTermTests/GlyphPixelAlignmentTests.swift:69

What to do

  1. Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with FuzzerTests.swift. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 1 Assertions commented out finding(s) in Test Quality — start with MeanTests.swift. — One of this dimension's main actionable groups (1 issue-level).
  3. Resolve the 209 No assertions finding(s) in Test Quality — start with KittyKeyboardEncoderTests.swift (51), CsiParameterParsingTests.swift (32), ProfileSupportTests.swift (22). — One of this dimension's main actionable groups (209 warning-level).
  4. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D12 · Dependency Hygiene9.6 / 10Exemplary✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

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

8 outdated direct SwiftPM dependencies, 0 pinning defect(s). SwiftPM has no package registry: a dependency is a repository URL and its releases are that repository's semver tags, so currency is answered by listing tags rather than by querying an index. Only a newer tag on the SAME MAJOR is reported — a `from:` requirement admits everything below the next major and nothing above it, so a major crossing needs a Package.swift edit rather than an update, and naming the update as its remedy would be wrong. Whether any dependency is DEPRECATED or ABANDONED is not graded and cannot be: a repository publishes no such marker, and there is no registry that could carry one. Known CVEs in this dependency graph are D30's question.

Outdated: benchmark · ×8

✓ On the Gold path — maintain.

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

D13 · Secret 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

Secret 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 36 SwiftPM package(s) use a banned license. SwiftPM has no package registry, so each package's licence is the one its repository declares: 36 of them read from the licence file the repository carries at the revision REDACTED pins, and 0 — unpinned, or whose licence file could not be read or named — from api.deps.dev, which reports the licence the repository declares today. Graded: every package a committed REDACTED pins, direct and transitive, and every declared dependency none pins. ★ COVERAGE OF THIS VERDICT: it grades this repository's SwiftPM package dependencies and nothing else. The repository also declares package.json, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots5.8 / 10Adequate✓ 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 5.8 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: Sources/SwiftTerm/Terminal.swift (93×109=10137); Sources/SwiftTerm/Mac/MacTerminalView.swift (91×103=9373); Sources/SwiftTerm/Apple/AppleTerminalView.swift (88×102=8976)

Hotspot: Sources/SwiftTerm/Terminal.swift · ×24Sources/SwiftTerm/Terminal.swift:1991

What to do

  1. Resolve the 24 Hotspot finding(s) in Churn × Complexity Hotspots — start with Terminal.swift, MacTerminalView.swift, AppleTerminalView.swift. — One of this dimension's main actionable groups (24 warning-level).

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

D16 · Bus Factor6.3 / 10Adequate✓ 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 6.3 / 10 · rule-coverage 100% · ceiling Documented

49 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is Sources/SwiftTerm/KittyClipboardProtocol.swift. Counted over 131 of the 175 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

What to do

  1. Resolve the 1 Off-boarding risk 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.9 / 10Stronggated by 28 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.9 / 10 · rule-coverage 100% · ceiling Prevented

28 deducted task-comment markers across 73463 LoC (0.0/KLoC) → score 9.9. 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 · ×22Tests/SwiftTermTests/SgrTests.swift:185
FixmeComment · ×6Sources/SwiftTerm/Buffer.swift:1902

What to do

  1. Resolve the 22 TodoComment finding(s) in Explicit Debt — start with Terminal.swift (14), Buffer.swift (2), MacTerminalView.swift (2). — One of this dimension's main actionable groups (22 warning-level).
  2. Resolve the 6 FixmeComment finding(s) in Explicit Debt — start with Buffer.swift (3), Terminal.swift (3). — One of this dimension's main actionable groups (6 warning-level).
  3. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D26 · Project Cohesion6.7 / 10Adequate✓ 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, LLM-independent.

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

1 of 6 build units (SwiftPM, Xcode) 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.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

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

Method: Secret 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 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)4.8 / 10Weak✓ 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 4.8 / 10 · rule-coverage 100% · ceiling Documented

22 finding(s): 0 critical, 18 high, 4 medium, 0 low. 15 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 3 file(s) — `Sources/SwiftTerm/Mac/MacTerminalView.swift` (line 5199), `Tools/BidiHarness/BidiHarness/Resources/Scenarios/issue-597-cjk-scroll.json`, `scripts/build-wasm.sh` (line 8) — 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. Separately, one or more rules could not re-parse an embedded snippet in 1 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED, REDACTED. — One of this dimension's main actionable groups (2 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 15 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 (15 issue-level, 0 of them charged here).

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

D30 · Dependency Vulnerabilities9.4 / 10Adequategated by 1 critical finding✓ 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.

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

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

REDACTED

What to do

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

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

D34 · Knowledge Freshness10.0 / 10Exemplary✓ 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 10.0 / 10 · rule-coverage 100% · ceiling Documented

Every significant source file has living knowledge — recently and meaningfully worked. Counted over 131 of the 175 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

D35 · Change Coupling9.8 / 10Stronggated by 2 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: MacTerminalView.swift↔Profiling.swift 50%; CircularList.swift↔MacDebugView.swift 50%

Change coupling: MacTerminalView.swift ↔ Profiling.swift · ×2Sources/SwiftTerm/Mac/MacTerminalView.swift:1

What to do

  1. Resolve the 2 Change coupling finding(s) in Change Coupling — start with MacTerminalView.swift, CircularList.swift. — One of this dimension's main actionable groups (2 warning-level).

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

D36 · Supply-chain Provenance & Signing0.0 / 10Critical✓ 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 0.0 / 10 · rule-coverage 100% · ceiling Documented

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

+ 2 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.

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.

Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.

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

A vulnerability-disclosure policy (SECURITY.md) is published with a reporting contact.

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.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. Scored 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. SCORED, not informational.

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.

AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.

AC2 · Forms & labels10.0 / 10Exemplary○ Nothing flagged

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.

AC3 · Page structure10.0 / 10Exemplary○ Nothing flagged

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.

AC5 · ARIA correctness10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

AC6 · Visual & motion safety1.0 / 10Critical✓ 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.

  • `#terminal-input` 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. — TerminalApp/WebTerminal/Public/styles.css:20

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.
AC7 · A11y enforcement4.0 / 10Adequate✓ Tool-verified

Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.

Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.

Coverage: Population: the repository's own tooling configuration — lint config, test and CI files — NOT the markup. It is read for a configured accessibility checker and an automated accessibility assertion (axe/pa11y/Lighthouse, or a native-toolkit equivalent), and it credits an INVOCATION, never a mention: a licence filename, an import comment or a doc reference earns no rung. Enforcement configured entirely outside the repository leaves no evidence here and cannot be credited.

  • No accessibility enforcement found — no accessibility linting at author time and no automated accessibility check in tests or CI. Add your UI toolkit's own accessibility assertion to the test suite (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in the pipeline. What was searched, so you can tell an absence from a miss: the 1 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.

What to do

  • Enforce accessibility in the toolchain your project already uses: assert accessibility in your UI test suite with your toolkit's own matcher (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in CI so a regression blocks the merge.
AX10 · Code composition10.0 / 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.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
AX2 · Stateful singletons10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.

Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.

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 segregation10.0 / 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.

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.

AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

DM4 · Rich vs anemic domain model10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether domain entities own their behaviour — a data-only reference entity whose logic lives in a foreign service is anemic. Rich models enforce their own invariants.

Method: Roslyn (DDD-gated): entity method BODIES classified mutator-vs-query — only methods that mutate the entity's own declared state count as invariant-protecting behaviour, so a getter/passthrough doesn't rescue an anemic class. Deterministic, exhaustive over domain-layer entities.

Coverage: Population: entities by name/base convention; rich-vs-anemic judged by classifying each method body mutator-vs-query — logic-bearing domain types outside the convention are invisible.

DM5 · Encapsulated state10.0 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether a reference entity protects its own invariants — a class whose identity is a computed content hash but whose hashed fields are publicly mutable bypasses that invariant. Encapsulated state keeps identity-bearing fields immutable.

Method: Roslyn (DDD-gated): entities scanned for publicly writable state — public setters, and (C#/VB) own mutable collections handed out through an auto-property, a public field or a bare-field expression getter, where a computed/copying getter is never charged. One finding per entity; score softened when Marten/EF rehydration frameworks present. Deterministic, framework-aware.

Coverage: Population: entities by convention; encapsulation (setter shape) checked exhaustively within the set.

M1 · Documentation (README)8.7 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

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.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.

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 README actually describes the code that exists (LLM-judged, advisory).

Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.

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 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 · Observability5.0 / 10Adequate✓ 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.

  • Only 1/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `TerminalApp`, `TerminalApp/WebTerminal`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
  • Consider OpenTelemetry tracing/metrics (swift-otel with swift-distributed-tracing) and a health-check endpoint (a /health route on your Vapor/Hummingbird router) for operability.
P3 · Security & performance tooling0.0 / 10Critical✓ 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.

  • No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 10784 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:6
  • `Web/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — Web/package.json:25

What to do

  • Add a SAST step to CI running what this repository's stack ships: CodeQL's Swift pack (Swift/Xcode) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback5.0 / 10Adequate✓ 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.

What to do

  • Make sure a person approves each release. The release job names an environment, but its approval rules live in the code host's settings, where Watchdog can't see them. Check that a reviewer must approve each release, or publish releases as drafts first, so a bad build can be stopped before anyone downloads it.
P6 · Release Hygiene5.0 / 10Adequate✓ 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.

  • No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
P7 · Outbound HTTP resilience3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

  • `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×2) — scripts/regen_unicode_width_data.py:78, scripts/regen_unicode_width_data.py:86

What to do

  • Pass `timeout=` on every `requests`/`httpx` call (requests has no default and will wait forever), mount an `HTTPAdapter(max_retries=Retry(...))` on shared sessions, and wrap calls to flaky dependencies in `tenacity` retries or a `pybreaker` circuit breaker.
PF1 · Benchmark discipline8.5 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

  • A Swift package-benchmark suite exists but nothing turns on its allocation measurement — allocations (the main way hot code pressures a garbage collector or allocator) aren't being measured. — Tools/SwiftTermBenchmarks/Benchmarks/SwiftTermBenchmarks/SwiftTermBenchmarks.swift

What to do

  • Include a malloc or memory metric (e.g. .mallocCountTotal) in the benchmarks' `metrics:` so allocation regressions are visible.
PF2 · Allocation hygiene6.7 / 10Strong✓ Tool-verified

Readiness · Performance — Whether the code is written to minimise allocations so it doesn't pressure its host's memory manager — buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.

Method: Production-source scan: density (per 1k LoC) of allocation-aware APIs — in .NET Span/Memory, ArrayPool/ObjectPool, stackalloc, ValueTask, value-type structs, IBufferWriter, string.Create, SkipLocalsInit; off .NET, with comments and strings blanked, Go's sync.Pool, preallocated slices/maps, Grow, strconv.Append* and buf[:0] reuse; the JVM's NIO buffer views, MemorySegment, primitive collections, pools and literal presizes (plus Kotlin primitive arrays and value classes, Scala AnyVal and @specialized); Swift's reserveCapacity, ContiguousArray, withUnsafe* access and ~Copyable. Activated off .NET on the same floor (400 lines, and benchmarks or 8 uses); Rust and garbage-collected scripting languages are not applicable. Reward-only. Deterministic, syntax/text detection.

What to do

  • Raise allocation-aware density on the hot paths — currently 118 use(s) across 78,730 production line(s) (~1.5/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
  • Swift: on hot paths, reserveCapacity before appending, use ContiguousArray for class-element arrays, work in place with withUnsafeBufferPointer/withUnsafeTemporaryAllocation, and make large values ~Copyable with borrowing/consuming parameters.
PF3 · Async & latency hygiene10.0 / 10Exemplary✓ 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 the language 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.

R1 · Type Safety0.0 / 10Critical✓ 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.

  • 0 typed · 16 plain JS — the untyped files are TerminalApp/WebTerminal/Public/app.js, TerminalApp/WebTerminal/Public/clipboard.js, Tests/WebWasmTests/browser-input.mjs, REDACTED, Tests/WebWasmTests/canvas-grid.mjs, Tests/WebWasmTests/conformance.test.mjs (+10 more).

What to do

  • Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
R10 · Code Duplication9.1 / 10Exemplary✓ Tool-verified

React / JS · Code Health — Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm over JS/TS tokens, D-386): 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. Deterministic.

  • TerminalApp/WebTerminal/Public/app.js:206 · TerminalApp/WebTerminal/Public/app.js:237 — the two spans are one implementation copied and then locally edited — 83 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. — TerminalApp/WebTerminal/Public/app.js:206

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.
R2 · Cyclomatic Complexity9.9 / 10Exemplary✓ 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.

  • run has cyclomatic complexity 27 and cognitive complexity 46; 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. — TerminalApp/WebTerminal/Public/clipboard.js:122
  • accept has cyclomatic complexity 16 and cognitive complexity 17; 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. — TerminalApp/WebTerminal/Public/clipboard.js:75
  • show has cyclomatic complexity 16 and cognitive complexity 17; 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. — TerminalApp/WebTerminal/Public/clipboard.js:105
  • pump has cyclomatic complexity 15 and cognitive complexity 14; 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. — TerminalApp/WebTerminal/Public/app.js:174
  • paste has cyclomatic complexity 14 and cognitive complexity 15; 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. — TerminalApp/WebTerminal/Public/app.js:206
  • makeClipboardItem has cyclomatic complexity 13 and cognitive complexity 15; 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. — TerminalApp/WebTerminal/Public/clipboard.js:14
  • (anonymous) has cyclomatic complexity 12 and cognitive complexity 19; 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. — TerminalApp/WebTerminal/Public/app.js:117
  • decodeServerMessage has cyclomatic complexity 12 and cognitive complexity 11; 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. — TerminalApp/WebTerminal/Public/app.js:25
  • updateInput has cyclomatic complexity 12 and cognitive complexity 11; 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. — TerminalApp/WebTerminal/Public/app.js:224
  • (anonymous) has cyclomatic complexity 11 and cognitive complexity 32; 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. — Tests/WebWasmTests/canvas-grid.mjs:6

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files10.0 / 10Exemplary✓ 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.

R5 · Dependency Freshness9.8 / 10Exemplary✓ Tool-verified

React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).

Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.

What to do

  • Bump outdated dependencies to current versions to limit upgrade debt.
R7 · Dead Code10.0 / 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.

R8 · Dependency Hygiene8.0 / 10Exemplary✓ 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.

  • Imported but not declared in any reachable package.json — installs work only by hoisting accident. — REDACTED:9

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.

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.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. 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 `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. 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 document10.0 / 10Exemplary○ Nothing flagged

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.

X18 · Disposal-pattern correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a type's disposal matches what it OWNS — releasing what it created, leaving alone what it was handed, and not declaring a finalizer for state that has nothing unmanaged to finalize.

Method: Roslyn syntax + semantics: every assignment to a disposable field is read to decide whether the type CREATED the value or was handed it, and the type's disposal is checked against that answer — an injected interface it disposes, a value it constructed and never releases, a finalizer on a type holding nothing unmanaged, and a disposable local whose every reference is a plain member read. A value handed to a container that disposes its contents (a parent control's `Controls` collection, a component `IContainer`) is released by that container and is not reported; generated code is out of population. On a repository with no .NET source the same ownership questions are read in JavaScript/TypeScript off the engine’s own token stream (test, vendored, generated and minified paths not): a class declaring `dispose()`, `[Symbol.dispose]()` or `[Symbol.asyncDispose]()` that disposes a field it was handed through a constructor parameter typed as a repository interface or resolved by a dependency-injection container; that assigns a field only ever from `new X(…)` of a disposable class and neither releases it anywhere in the class nor names it in its disposal member or a method that member calls, nor hands it to anything else; and a `const`/`let` local built from literals only whose every reference opens a statement operating on a non-release member of it. A class is disposable when every repository declaration of its name declares or inherits a disposal member, or when it is a documented library disposable (`vscode` EventEmitter, CancellationTokenSource and Disposable; three.js geometries, materials, textures, render targets, renderers, controls and composers). The finalizer arm has no JavaScript counterpart: a class cannot declare one. Dart is read for the owned-and-never-released arm: a Flutter `State` (or a class declaring `dispose()`/`close()`) whose library-private field is written only with direct creations of a framework controller, `FocusNode`, `StreamController` or periodic `Timer` (or a `.listen(…)` into a field declared `StreamSubscription`), which nothing in the class or its library releases (`dispose`/`close`/`cancel`) and which is never handed on except as a named argument. Ruby is read for the owned-and-never-released arm and the abandoned-local arm: a class declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose instance variable is written only with a blockless core descriptor creation (`File.open`/`new`, `Tempfile`, `Dir.open`, `IO.popen`, the `socket` and `openssl` socket classes) that no method of the class closes and that is never handed on (passed, returned, stored, exposed by `attr_reader`, delegated) — a class whose superclass or mixin lies outside the repository is not judged — and a blockless creation read through and dropped (`File.open(path).read`) or held in a local that is never closed, returned, passed or stored (a `&:read` block-pass, an `autoclose: false` borrow and a `fileno` hand-over are not abandonment). PHP is read for the same two arms: a class (not a trait, and not one using a trait) declaring an instance `close`, `dispose`, `shutdown`, `stop`, `disconnect` or `terminate` whose `private` property (or a `final` class's `protected` one) is written only with a direct core `fopen`, `tmpfile`, `popen`, `proc_open`, `fsockopen`, `stream_socket_client`/`server` or `opendir` that nothing in the class closes (`fclose`, `pclose`, `closedir`, `unset`, a reset to `null`) and that is never handed on, and a handle held in a function's local, or read through as the argument of a reader, that is never closed, returned, passed, captured or stored; a `php://` stream, `curl_init`, `SplFileObject`, `PDO` and a function the repository declares under the core name are not read. Deterministic, provable per finding. Advisory.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

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.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.

Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation10.0 / 10Exemplary○ Nothing flagged

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.

X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged

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.

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.

X26 · Unsynchronised callback handoff10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. 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 element10.0 / 10Exemplary○ Nothing flagged

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.

X3 · Exception handling6.7 / 10Strong✓ 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.

  • `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×3) — Sources/SwiftTermBuildInfoGenerator/BuildInfoGenerator.swift:287, Sources/SwiftTerm/KittyGraphics.swift:2763, Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift:250

What to do

  • Swallowed exception (caught, then discarded)
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.

WCAG coverage — what static analysis assessed

Statically assessed 13 of 55 WCAG 2.2 Level A/AA success criteria (24%; ≈26% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 42 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
AC1 · Text alternatives1.1.1, 1.2.2, 1.2.5Partial signal
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
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only
AC7 · A11y enforcementenforcement — no page criterionEnforcement posture (process)

Not statically assessed — these 42 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.2.1, 1.2.3, 1.2.4, 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 Health59%Adequate — gated by D2, R1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture96%ExemplarySolid.
Maturity87%ExemplarySolid.
Readiness42%Adequate — gated by P3, P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security74%Adequate — gated by D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling100%ExemplaryStrongest area.
Accessibility59%Adequate — gated by AC6Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance81%ExemplarySolid.
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 — 16 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 2 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 54 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.

  • AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
  • AX1 Captive dependencies — Not applicable: this repository's Swift 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.
  • 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
  • AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, Firebase, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, Firebase, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D11 Test Reliability — Test reliability not scored — polyglot repository, one half's runner produced no measurement
  • 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.
  • D19 Documentation Quality — No runnable or published unit to look for an example in, and no multi-project root README to look for a map in; the other documentation kinds are withheld (see the gaps), so documentation quality is not applicable here.
  • D20 ADR Quality — N/A — this repo declares itself a template / kata / sample / demo; a formal ADR log is deferred to a real application built from it.
  • D21 Naming Consistency — Naming consistency is measured on C# only; JavaScript, Python, Swift, TypeScript not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Swift surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .py, .swift, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.swift), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 10 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • 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
  • D8 Code Coverage — Coverage not measured — Swift suite
  • DM1 Aggregate boundaries — not scored for Swift: the sidecar flattens array/collection types (a child COLLECTION = legitimate membership vs a single embedded aggregate is indistinguishable), and aggregate-vs-value-object classification cannot be told apart in source (every struct-holding-struct reads alike) — reported as guidance rather than measured
  • DM2 Strongly-typed ids — no in-repo typed-id idiom — primitive-obsession recorded as advisory DM8, DM2 not gated
  • DM3 Integration-event coupling — not scored for Swift: a cross-SwiftPM-target domain leak cannot be told apart in source from a legitimate shared-kernel/contracts module, and most repositories ship a single module — reported as guidance rather than measured
  • DM6 Domain ↔ infrastructure boundary — this Swift package maps no type to a persistence framework and declares no domain-model type carrying a method of its own, so DM6's domain↔infrastructure boundary read has no population to be taken over
  • DM7 Repository granularity — not scored for Swift: 'a repository per CHILD entity' needs the aggregate-root structure, which is not source-resolvable — reported as guidance rather than measured
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
  • 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
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — 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
  • M2 Architecture documentation — This repo declares itself a template / kata / sample / demo — formal architecture documentation (ADRs, C4 diagrams) is deferred to a real application built from it, so its absence is not a defect here.
  • 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 — no coverage report found on disk — produce a coverage report in a standard format (lcov — `swift test --enable-code-coverage` (SwiftPM) or `xcodebuild test -scheme <YourScheme> -enableCodeCoverage YES` (an .xcodeproj/.xcworkspace suite), then `xcrun llvm-cov export -format=lcov`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • R4 Test Coverage — 12 test file(s) reach none of 3 production file(s) via imports — exercised outside the JS import graph (integration/bundled), not import-reachable
  • R6 Tooling — no package.json in the repository — test/lint/typecheck wiring is read from package.json scripts (corroborated against CI), so this project's own toolchain isn't measured here
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) 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. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X2 Cancellation propagation — 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
  • 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.
  • 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
  • X5 Nullable reference types — 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 — 22 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D10 · Test Quality · No assertions (empty test) · ×1
  • No assertions (empty test): testCrashes Tests/SwiftTermTests/FuzzerTests.swift:60 — Test method has an empty body — it asserts nothing and exercises no code.
D10 · Test Quality · Assertions commented out · ×1
  • Assertions commented out: testInvalidMargins Tests/SwiftTermTests/MeanTests.swift:40 — The test body contains commented-out assertion calls and no live one — it runs, verifies nothing, and still passes. Restore the assertions or delete the test; a green test that checks nothing is worse than an absent one.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×1
  • REDACTED
R8 · Dependency Hygiene · Unlisted import 'playwright' · ×1
  • Unlisted import 'playwright' REDACTED:9 — Imported but not declared in any reachable package.json — installs work only by hoisting accident.
Serious — 837 finding(s)
D10 · Test Quality · No assertions · ×209
  • No assertions: testScrollWithCorruptedYBase Tests/SwiftTermTests/BufferTests.swift:459 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: unfocusedCaretRestoresGraphicsState Tests/SwiftTermTests/CaretViewGStateTests.swift:76 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: nonBlockCaretRestoresGraphicsState Tests/SwiftTermTests/CaretViewGStateTests.swift:83 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: blockCaretRestoresGraphicsState Tests/SwiftTermTests/CaretViewGStateTests.swift:91 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: powerlineBlockCaretRestoresGraphicsState Tests/SwiftTermTests/CaretViewGStateTests.swift:98 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorUpDefaultParam Tests/SwiftTermTests/CsiParameterParsingTests.swift:12 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorUpExplicitParam Tests/SwiftTermTests/CsiParameterParsingTests.swift:19 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorUpClampedToTop Tests/SwiftTermTests/CsiParameterParsingTests.swift:26 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorDownDefaultParam Tests/SwiftTermTests/CsiParameterParsingTests.swift:35 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorDownExplicitParam Tests/SwiftTermTests/CsiParameterParsingTests.swift:42 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorDownClampedToBottom Tests/SwiftTermTests/CsiParameterParsingTests.swift:49 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorForwardDefaultParam Tests/SwiftTermTests/CsiParameterParsingTests.swift:58 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorForwardExplicitParam Tests/SwiftTermTests/CsiParameterParsingTests.swift:65 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorForwardClampedToRight Tests/SwiftTermTests/CsiParameterParsingTests.swift: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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorBackwardDefaultParam Tests/SwiftTermTests/CsiParameterParsingTests.swift:81 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorBackwardExplicitParam Tests/SwiftTermTests/CsiParameterParsingTests.swift:88 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorBackwardClampedToLeft Tests/SwiftTermTests/CsiParameterParsingTests.swift:95 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorPositionBothParams Tests/SwiftTermTests/CsiParameterParsingTests.swift:104 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorPositionRowOnly Tests/SwiftTermTests/CsiParameterParsingTests.swift:110 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorPositionNoParams Tests/SwiftTermTests/CsiParameterParsingTests.swift:116 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testCursorPositionZeroParamsTreatedAsOne Tests/SwiftTermTests/CsiParameterParsingTests.swift:123 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testEraseInLineFromCursorToEnd Tests/SwiftTermTests/CsiParameterParsingTests.swift:131 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testEraseInLineFromStartToCursor Tests/SwiftTermTests/CsiParameterParsingTests.swift:139 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testEraseInLineEntire Tests/SwiftTermTests/CsiParameterParsingTests.swift:147 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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: testEraseInLineDefaultParam Tests/SwiftTermTests/CsiParameterParsingTests.swift:154 — 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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, 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.
  • + 184 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×24
  • Hotspot: Sources/SwiftTerm/Terminal.swift Sources/SwiftTerm/Terminal.swift:1991 — Sources/SwiftTerm/Terminal.swift changed 93 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 109 in Terminal.handlePrintSlow at line 1991. 14 of those changes were fix/bug commits, and the other 79 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Terminal.swift`: 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: Sources/SwiftTerm/Mac/MacTerminalView.swift Sources/SwiftTerm/Mac/MacTerminalView.swift:2318 — Sources/SwiftTerm/Mac/MacTerminalView.swift changed 91 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 103 in TerminalView.keyDown at line 2318. 16 of those changes were fix/bug commits, and the other 75 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Mac/MacTerminalView.swift`: 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: Sources/SwiftTerm/Apple/AppleTerminalView.swift Sources/SwiftTerm/Apple/AppleTerminalView.swift:3297 — Sources/SwiftTerm/Apple/AppleTerminalView.swift changed 88 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 102 in TerminalView.drawTerminalContents at line 3297. 14 of those changes were fix/bug commits, and the other 74 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Apple/AppleTerminalView.swift`: 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: Sources/SwiftTerm/iOS/iOSTerminalView.swift Sources/SwiftTerm/iOS/iOSTerminalView.swift:3234 — Sources/SwiftTerm/iOS/iOSTerminalView.swift changed 65 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in TerminalView.pressesBegan at line 3234. 13 of those changes were fix/bug commits, and the other 52 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/iOS/iOSTerminalView.swift`: 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: Sources/SwiftTerm/EscapeSequenceParser.swift Sources/SwiftTerm/EscapeSequenceParser.swift:1090 — Sources/SwiftTerm/EscapeSequenceParser.swift changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 104 in EscapeSequenceParser.parseBorrowed at line 1090. 1 of those changes was a fix/bug commit, and the other 28 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/EscapeSequenceParser.swift`: 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: Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1920 — Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in MetalTerminalRenderer.prepareRow at line 1920. 7 of those changes were fix/bug commits, and the other 35 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift`: 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: Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:449 — Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in SnapshotTextBuilder.buildAttributedString at line 449. 3 of those changes were fix/bug commits, and the other 15 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift`: 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: Sources/SwiftTerm/Buffer.swift Sources/SwiftTerm/Buffer.swift:1521 — Sources/SwiftTerm/Buffer.swift changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in Buffer.reflowNarrower at line 1521. 10 of those changes were fix/bug commits, and the other 20 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Buffer.swift`: 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: TerminalApp/MacTerminal/ViewController.swift TerminalApp/MacTerminal/ViewController.swift:653 — TerminalApp/MacTerminal/ViewController.swift changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in ViewController.validateUserInterfaceItem at line 653. 4 of those changes were fix/bug commits, and the other 18 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- TerminalApp/MacTerminal/ViewController.swift`: 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: Sources/SwiftTerm/BufferLine.swift Sources/SwiftTerm/BufferLine.swift:885 — Sources/SwiftTerm/BufferLine.swift changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in BufferLine.copyFrom at line 885. 2 of those changes were fix/bug commits, and the other 23 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/BufferLine.swift`: 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: Sources/SwiftTerm/Apple/TerminalSnapshot.swift Sources/SwiftTerm/Apple/TerminalSnapshot.swift:338 — Sources/SwiftTerm/Apple/TerminalSnapshot.swift changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in TerminalSnapshot.refresh at line 338. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Apple/TerminalSnapshot.swift`: 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: Sources/SwiftTerm/TerminalIOPipeline.swift Sources/SwiftTerm/TerminalIOPipeline.swift:559 — Sources/SwiftTerm/TerminalIOPipeline.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in TerminalIOPipelineWorker.gatherMain at line 559. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/TerminalIOPipeline.swift`: 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: Sources/SwiftTerm/KittyGraphics.swift Sources/SwiftTerm/KittyGraphics.swift:1567 — Sources/SwiftTerm/KittyGraphics.swift changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in Terminal.displayKittyImage at line 1567. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/KittyGraphics.swift`: 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: Sources/SwiftTerm/SelectionService.swift Sources/SwiftTerm/SelectionService.swift:1288 — Sources/SwiftTerm/SelectionService.swift changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in SelectionService.urlRange at line 1288. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/SelectionService.swift`: 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: Sources/SwiftTerm/KittyKeyboardEncoder.swift Sources/SwiftTerm/KittyKeyboardEncoder.swift:168 — Sources/SwiftTerm/KittyKeyboardEncoder.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in KittyKeyboardEncoder.encode at line 168. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/KittyKeyboardEncoder.swift`: 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: Sources/SwiftTerm/Apple/TerminalRenderOwner.swift Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:513 — Sources/SwiftTerm/Apple/TerminalRenderOwner.swift changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in TerminalRenderOwner.prepareFrame at line 513. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Apple/TerminalRenderOwner.swift`: 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: Sources/SwiftTerm/Apple/TerminalBidi.swift Sources/SwiftTerm/Apple/TerminalBidi.swift:672 — Sources/SwiftTerm/Apple/TerminalBidi.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in TerminalBidi.buildParagraph at line 672. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Apple/TerminalBidi.swift`: 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: Sources/SwiftTerm/Profiling.swift Sources/SwiftTerm/Profiling.swift:78 — Sources/SwiftTerm/Profiling.swift changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in ProfilingEvent.name at line 78. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Profiling.swift`: 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: Sources/SwiftTerm/Apple/CaretView.swift Sources/SwiftTerm/Apple/CaretView.swift:14 — Sources/SwiftTerm/Apple/CaretView.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in CaretView.drawCursor at line 14. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Apple/CaretView.swift`: 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: Sources/SwiftTerm/Utilities.swift Sources/SwiftTerm/Utilities.swift:451 — Sources/SwiftTerm/Utilities.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in UnicodeUtil.graphemeJoinNonEmojiModifier at line 451. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/Utilities.swift`: 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: Tools/BidiHarness/BidiHarness/HarnessViewController.swift Tools/BidiHarness/BidiHarness/HarnessViewController.swift:245 — Tools/BidiHarness/BidiHarness/HarnessViewController.swift changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 86 in HarnessViewController.execute at line 245. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Tools/BidiHarness/BidiHarness/HarnessViewController.swift`: 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: Tools/RenderBench/Sources/RenderBench/main.swift Tools/RenderBench/Sources/RenderBench/main.swift:36 — Tools/RenderBench/Sources/RenderBench/main.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in main.swift.top-level code at line 36. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Tools/RenderBench/Sources/RenderBench/main.swift`: 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: Sources/SwiftTerm/SixelDcsHandler.swift Sources/SwiftTerm/SixelDcsHandler.swift:128 — Sources/SwiftTerm/SixelDcsHandler.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in SixelDcsHandler.unhook at line 128. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- Sources/SwiftTerm/SixelDcsHandler.swift`: 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: scripts/regen_unicode_width_data.py scripts/regen_unicode_width_data.py:308 — scripts/regen_unicode_width_data.py changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in regen_unicode_width_data.terminal_width at line 308. 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-07-30..2026-10-28, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-30 21:44:47 -04:00' --until='2026-10-28 21:44:47 -04:00' --full-history --no-merges -- scripts/regen_unicode_width_data.py`: 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.
D3 · God Classes · MethodTooLong · ×23
  • MethodTooLong: TerminalView.drawTerminalContents Sources/SwiftTerm/Apple/AppleTerminalView.swift:3297 — MethodTooLong — drawTerminalContents runs 443 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 343 over it, 4.43× 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: MetalTerminalRenderer.placeRow Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2478 — MethodTooLong — placeRow runs 323 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 223 over it, 3.23× 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: MetalTerminalRenderer.prepareRow Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1920 — MethodTooLong — prepareRow runs 290 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 190 over it, 2.90× 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: TerminalView.pressesBegan Sources/SwiftTerm/iOS/iOSTerminalView.swift:3234 — MethodTooLong — pressesBegan 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: SnapshotTextBuilder.buildAttributedString Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:449 — MethodTooLong — buildAttributedString runs 241 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 141 over it, 2.41× 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: MetalTerminalRenderer.render Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1336 — MethodTooLong — render runs 222 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 122 over it, 2.22× 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: MetalTerminalRenderer.buildCursorDrawData Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3931 — MethodTooLong — buildCursorDrawData runs 219 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 119 over it, 2.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.
  • MethodTooLong: KittyKeyboardEncoder.functionalEncoding Sources/SwiftTerm/KittyKeyboardEncoder.swift:954 — MethodTooLong — functionalEncoding runs 218 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 118 over it, 2.18× 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: TerminalView.keyDown Sources/SwiftTerm/Mac/MacTerminalView.swift:2318 — MethodTooLong — keyDown runs 199 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 99 over it, 1.99× 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: MetalTerminalRenderer.buildDrawDataPass Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1681 — MethodTooLong — buildDrawDataPass runs 187 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 87 over it, 1.87× 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: TerminalSnapshot.refresh Sources/SwiftTerm/Apple/TerminalSnapshot.swift:338 — MethodTooLong — refresh runs 185 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 85 over it, 1.85× 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: TerminalView.kittyFunctionalKey Sources/SwiftTerm/Mac/MacTerminalView.swift:2995 — MethodTooLong — kittyFunctionalKey runs 169 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 69 over it, 1.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: TerminalIOPipelineWorker.gatherMain Sources/SwiftTerm/TerminalIOPipeline.swift:559 — MethodTooLong — gatherMain runs 158 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 58 over it, 1.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: HarnessViewController.execute Tools/BidiHarness/BidiHarness/HarnessViewController.swift:245 — MethodTooLong — execute runs 158 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 58 over it, 1.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: BoxDrawingRenderer.draw Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:81 — MethodTooLong — draw runs 152 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× 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: TerminalView.kittyFunctionalKey Sources/SwiftTerm/iOS/iOSTerminalView.swift:2570 — MethodTooLong — kittyFunctionalKey runs 152 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× 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: TerminalRenderOwner.prepareFrame Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:513 — MethodTooLong — prepareFrame 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: CharSets.initAll Sources/SwiftTerm/CharSets.swift:19 — MethodTooLong — initAll 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: MetalTerminalRenderer.preparePlainRow Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2326 — MethodTooLong — preparePlainRow runs 122 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 22 over it, 1.22× 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: Terminal.parseKittyGraphicsControl Sources/SwiftTerm/KittyGraphics.swift:331 — MethodTooLong — parseKittyGraphicsControl runs 118 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 18 over it, 1.18× 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: IOBaselineHarness.buildMeasurement TerminalApp/MacTerminal/IOBaselineHarness.swift:742 — MethodTooLong — buildMeasurement runs 118 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 18 over it, 1.18× 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: TerminalView.doCommand Sources/SwiftTerm/Mac/MacTerminalView.swift:2633 — MethodTooLong — doCommand runs 108 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 8 over it, 1.08× 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: Terminal.handleKittyAnimationFrame Sources/SwiftTerm/KittyGraphics.swift:524 — MethodTooLong — handleKittyAnimationFrame 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.
D17 · Explicit Debt · TodoComment · ×22
  • TodoComment Tests/SwiftTermTests/SgrTests.swift:185 — // TODO: When double underline is implemented, verify it's set here — 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 Sources/SwiftTerm/Buffer.swift:931 — // TODO: limitation in original, this does not cope with partial fills, it is either zero or nothing — 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 Sources/SwiftTerm/Buffer.swift:1901 — // TODO: needs a global min terminal width of 2 — 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 Sources/SwiftTerm/Terminal.swift:8 — // TODO: review every place that sets cursor to use setCursor — 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 Sources/SwiftTerm/Terminal.swift:9 — // TODO: audit every location to use restrictCursor — 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 Sources/SwiftTerm/Terminal.swift:1748 — // TODO: report real settings instead of 0m — 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 Sources/SwiftTerm/Terminal.swift:1854 — // TODO: was this unused — 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 Sources/SwiftTerm/Terminal.swift:2396 — // TODO: Retain the scalar produced by the decoder and use it for the — 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 Sources/SwiftTerm/Terminal.swift:2625 — // // TODO: needs a global min terminal width of 2 — 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 Sources/SwiftTerm/Terminal.swift:5267 — // TODO: should surface that to the UI, should not do this here — 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 Sources/SwiftTerm/Terminal.swift:6030 — // MIGUEL TODO: — 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 Sources/SwiftTerm/Terminal.swift:6031 — // TODO: audit any new variables, those in setup might be useful — 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 Sources/SwiftTerm/Terminal.swift:6105 — // We respond "American keyboard", TODO: worth plugging something else? Mac perhaps? — 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 Sources/SwiftTerm/Terminal.swift:6110 — // TODO: no dec locator/mouse — 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 Sources/SwiftTerm/Terminal.swift:6217 — // TODO: XTMODKEYS — 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 Sources/SwiftTerm/Terminal.swift:7978 — // TODO use a better system than this ugly nest — 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 Sources/SwiftTerm/Terminal.swift:9059 — // TODO — 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 Sources/SwiftTerm/iOS/iOSTerminalView.swift:1445 — // TODO: what scenario would have this? — 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 Sources/SwiftTerm/Mac/MacCaretView.swift:5 — // TODO: looks like I can kill sub now. unless it can be used to draw a border when out of focus — 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 Sources/SwiftTerm/Mac/MacTerminalView.swift:2740 — // TODO: view should scroll one page up. — 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 Sources/SwiftTerm/Mac/MacTerminalView.swift:2834 — // TODO: I do not think we actually need this needsDisplay, the data fed should bubble this up — 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 Sources/SwiftTerm/Apple/AppleTerminalView.swift:3296 — // TODO: this should not render any lines outside the dirtyRect — 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.
D3 · God Classes · FileTooLong · ×22
  • FileTooLong: SwiftTerm/Terminal.swift Sources/SwiftTerm/Terminal.swift — FileTooLong — 5580 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5080 over it, 11.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: Metal/MetalTerminalRenderer.swift Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift — FileTooLong — 3549 significant lines (blank, comment-only and punctuation-only lines excluded), about 80% of them inside a single declaration: MetalTerminalRenderer (1047-4757). The bar is 500 significant lines; this is 3049 over it, 7.10× 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: Apple/AppleTerminalView.swift Sources/SwiftTerm/Apple/AppleTerminalView.swift — FileTooLong — 3241 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2741 over it, 6.48× 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: Mac/MacTerminalView.swift Sources/SwiftTerm/Mac/MacTerminalView.swift — FileTooLong — 3218 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: TerminalView (105-5168). The bar is 500 significant lines; this is 2718 over it, 6.44× 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: iOS/iOSTerminalView.swift Sources/SwiftTerm/iOS/iOSTerminalView.swift — FileTooLong — 2745 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: TerminalView (109-3942). The bar is 500 significant lines; this is 2245 over it, 5.49× 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: SwiftTerm/KittyGraphics.swift Sources/SwiftTerm/KittyGraphics.swift — FileTooLong — 2062 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1562 over it, 4.12× 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: SwiftTerm/KittyClipboardProtocol.swift Sources/SwiftTerm/KittyClipboardProtocol.swift — FileTooLong — 1130 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 630 over it, 2.26× 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: SwiftTerm/Buffer.swift Sources/SwiftTerm/Buffer.swift — FileTooLong — 1090 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: Buffer (45-1986). The bar is 500 significant lines; this is 590 over it, 2.18× 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: SwiftTerm/EscapeSequenceParser.swift Sources/SwiftTerm/EscapeSequenceParser.swift — FileTooLong — 1047 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 547 over it, 2.09× 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: SwiftTerm/KittyKeyboardEncoder.swift Sources/SwiftTerm/KittyKeyboardEncoder.swift — FileTooLong — 981 significant lines (blank, comment-only and punctuation-only lines excluded), about 86% of them inside a single declaration: KittyKeyboardEncoder (162-1192). The bar is 500 significant lines; this is 481 over it, 1.96× 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: MacTerminal/ViewController.swift TerminalApp/MacTerminal/ViewController.swift — FileTooLong — 935 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 435 over it, 1.87× 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: SwiftTerm/SelectionService.swift Sources/SwiftTerm/SelectionService.swift — FileTooLong — 834 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 334 over it, 1.67× 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: SwiftTerm/CellStorage.swift Sources/SwiftTerm/CellStorage.swift — FileTooLong — 821 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 321 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: Apple/SnapshotTextBuilder.swift Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift — FileTooLong — 792 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: SnapshotTextBuilder (118-1074). The bar is 500 significant lines; this is 292 over it, 1.58× 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: BidiHarness/HarnessViewController.swift Tools/BidiHarness/BidiHarness/HarnessViewController.swift — FileTooLong — 772 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: HarnessViewController (7-976). The bar is 500 significant lines; this is 272 over it, 1.54× 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: Apple/TerminalBidi.swift Sources/SwiftTerm/Apple/TerminalBidi.swift — FileTooLong — 761 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: TerminalBidi (48-1155). The bar is 500 significant lines; this is 261 over it, 1.52× 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: MacTerminal/IOBaselineHarness.swift TerminalApp/MacTerminal/IOBaselineHarness.swift — FileTooLong — 690 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: IOBaselineHarness (149-952). The bar is 500 significant lines; this is 190 over it, 1.38× 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: Apple/TerminalRenderOwner.swift Sources/SwiftTerm/Apple/TerminalRenderOwner.swift — FileTooLong — 679 significant lines (blank, comment-only and punctuation-only lines excluded), about 88% of them inside a single declaration: TerminalRenderOwner (147-958). The bar is 500 significant lines; this is 179 over it, 1.36× 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: SwiftTerm/BufferLine.swift Sources/SwiftTerm/BufferLine.swift — FileTooLong — 593 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: BufferLine (15-1015). The bar is 500 significant lines; this is 93 over it, 1.19× 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: SwiftTerm/TerminalIOPipeline.swift Sources/SwiftTerm/TerminalIOPipeline.swift — FileTooLong — 590 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: TerminalIOPipelineWorker (269-953). The bar is 500 significant lines; this is 90 over it, 1.18× 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: Apple/BoxDrawingRenderer.swift Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift — FileTooLong — 527 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 27 over it, 1.05× 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: scripts/regen_unicode_width_data.py scripts/regen_unicode_width_data.py — FileTooLong — 523 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 23 over it, 1.05× 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.
D3 · God Classes · TooManyMethods · ×16
  • TooManyMethods: Terminal Sources/SwiftTerm/Terminal.swift:391 — TooManyMethods — 466 methods, declared across 10 files: SwiftTerm/Terminal.swift (349), SwiftTerm/KittyGraphics.swift (84), SwiftTerm/EmbeddedSupport.swift (8), Portable/TerminalViewport.swift (7), +6 more file(s). The bar is 30 methods; this is 436 over it, 15.53× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: TerminalView Sources/SwiftTerm/Mac/MacTerminalView.swift:105 — TooManyMethods — 434 methods, declared across 8 files: Mac/MacTerminalView.swift (217), Apple/AppleTerminalView.swift (147), iOS/iOSTextInput.swift (36), iOS/iOSTerminalView.swift (15), +4 more file(s). The bar is 30 methods; this is 404 over it, 14.47× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: TerminalView Sources/SwiftTerm/iOS/iOSTerminalView.swift:109 — TooManyMethods — 159 methods. The bar is 30 methods; this is 129 over it, 5.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.
  • TooManyMethods: MetalTerminalRenderer Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1047 — 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: Buffer Sources/SwiftTerm/Buffer.swift:45 — TooManyMethods — 75 methods. The bar is 30 methods; this is 45 over it, 2.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: HarnessViewController Tools/BidiHarness/BidiHarness/HarnessViewController.swift:7 — TooManyMethods — 60 methods. The bar is 30 methods; this is 30 over it, 2.00× 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: ViewController TerminalApp/MacTerminal/ViewController.swift:45 — TooManyMethods — 57 methods. The bar is 30 methods; this is 27 over it, 1.90× 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: BufferLine Sources/SwiftTerm/BufferLine.swift:15 — TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× 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: SelectionService Sources/SwiftTerm/SelectionService.swift:20 — 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: TerminalRenderOwner Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:147 — TooManyMethods — 50 methods. The bar is 30 methods; this is 20 over it, 1.67× 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: SwiftTermTerminal Web/src/terminal.ts:8 — TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× 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: KittyClipboardProtocol Sources/SwiftTerm/KittyClipboardProtocol.swift:832 — TooManyMethods — 41 methods. The bar is 30 methods; this is 11 over it, 1.37× 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: WasmTerminalHost Sources/SwiftTermWebWasm/WasmTerminalHost.swift:4 — TooManyMethods — 38 methods, declared across 3 files: SwiftTermWebWasm/WasmTerminalHost.swift (29), SwiftTermWebWasm/ClipboardHost.swift (7), SwiftTermWebWasm/GraphicsExports.swift (2). The bar is 30 methods; this is 8 over it, 1.27× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. Most of these members implement SwiftTerm.TerminalDelegate (35 of 38 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: TerminalAccessory Sources/SwiftTerm/iOS/iOSAccessoryView.swift:22 — 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: KeyboardView Sources/SwiftTerm/iOS/iOSKeyboardView.swift:12 — 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.
  • TooManyMethods: FrameDriver Sources/SwiftTerm/Apple/FrameDriver.swift:279 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× 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.
D3 · God Classes · ClassTooLong · ×14
  • ClassTooLong: TerminalView Sources/SwiftTerm/Mac/MacTerminalView.swift:105 — ClassTooLong — 3125 significant lines (blank, comment-only and punctuation-only lines excluded), 434 methods. The bar is 400 significant lines; this is 2725 over it, 7.81× 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: MetalTerminalRenderer Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1047 — ClassTooLong — 2849 significant lines (blank, comment-only and punctuation-only lines excluded), 77 methods. The bar is 400 significant lines; this is 2449 over it, 7.12× 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: TerminalView Sources/SwiftTerm/iOS/iOSTerminalView.swift:109 — ClassTooLong — 2494 significant lines (blank, comment-only and punctuation-only lines excluded), 159 methods. The bar is 400 significant lines; this is 2094 over it, 6.24× 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: Buffer Sources/SwiftTerm/Buffer.swift:45 — ClassTooLong — 1080 significant lines (blank, comment-only and punctuation-only lines excluded), 75 methods. The bar is 400 significant lines; this is 680 over it, 2.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.
  • ClassTooLong: KittyKeyboardEncoder Sources/SwiftTerm/KittyKeyboardEncoder.swift:162 — ClassTooLong — 840 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 440 over it, 2.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: HarnessViewController Tools/BidiHarness/BidiHarness/HarnessViewController.swift:7 — ClassTooLong — 767 significant lines (blank, comment-only and punctuation-only lines excluded), 60 methods. The bar is 400 significant lines; this is 367 over it, 1.92× 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: TerminalBidi Sources/SwiftTerm/Apple/TerminalBidi.swift:48 — ClassTooLong — 744 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods. The bar is 400 significant lines; this is 344 over it, 1.86× 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: SnapshotTextBuilder Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:118 — ClassTooLong — 655 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 255 over it, 1.64× 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: IOBaselineHarness TerminalApp/MacTerminal/IOBaselineHarness.swift:148 — ClassTooLong — 603 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 203 over it, 1.51× 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: KittyClipboardProtocol Sources/SwiftTerm/KittyClipboardProtocol.swift:832 — ClassTooLong — 602 significant lines (blank, comment-only and punctuation-only lines excluded), 41 methods. The bar is 400 significant lines; this is 202 over it, 1.51× 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: TerminalRenderOwner Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:147 — ClassTooLong — 595 significant lines (blank, comment-only and punctuation-only lines excluded), 50 methods. The bar is 400 significant lines; this is 195 over it, 1.49× 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: BufferLine Sources/SwiftTerm/BufferLine.swift:15 — ClassTooLong — 590 significant lines (blank, comment-only and punctuation-only lines excluded), 55 methods. The bar is 400 significant lines; this is 190 over it, 1.48× 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: TerminalIOPipelineWorker Sources/SwiftTerm/TerminalIOPipeline.swift:269 — ClassTooLong — 465 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods. The bar is 400 significant lines; this is 65 over it, 1.16× 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: CellArena Sources/SwiftTerm/CellStorage.swift:305 — ClassTooLong — 448 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 48 over it, 1.12× 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×14
  • Low cohesion: TerminalView (LCOM4 28) Sources/SwiftTerm/Mac/MacTerminalView.swift:105 — TerminalView's methods fall into 28 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 28 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: TerminalView (LCOM4 15) Sources/SwiftTerm/iOS/iOSTerminalView.swift:109 — TerminalView's methods fall into 15 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 15 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Terminal (LCOM4 10) Sources/SwiftTerm/Terminal.swift:391 — Terminal's methods fall into 10 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 10 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: SshTerminalView (LCOM4 9) TerminalApp/iOSTerminal/UIKitSshTerminalView.swift:337 — SshTerminalView's methods fall into 9 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 9 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ViewController (LCOM4 8) TerminalApp/MacTerminal/ViewController.swift:45 — ViewController's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: LocalProcessTerminalView (LCOM4 7) Sources/SwiftTerm/Mac/MacLocalTerminalView.swift:245 — LocalProcessTerminalView's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: HeadlessTerminal (LCOM4 6) Sources/SwiftTerm/HeadlessTerminal.swift:20 — HeadlessTerminal's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CaptureTerminal (LCOM4 5) Sources/CaptureOutput/main.swift:13 — CaptureTerminal's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Buffer (LCOM4 5) Sources/SwiftTerm/Buffer.swift:45 — Buffer's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: CaretView (LCOM4 5) Sources/SwiftTerm/Mac/MacCaretView.swift:19 — CaretView's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: LocalProcessTerminalViewProcessAdapter (LCOM4 5) Sources/SwiftTerm/Mac/MacLocalTerminalView.swift:138 — LocalProcessTerminalViewProcessAdapter's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: FrameDriverSignal (LCOM4 4) Sources/SwiftTerm/Apple/FrameDriver.swift:26 — FrameDriverSignal's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: MetalRedrawState (LCOM4 4) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:899 — MetalRedrawState's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: MetalTerminalRenderer (LCOM4 4) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1047 — MetalTerminalRenderer's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×10
  • Duplicated block (7 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3181 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:3181-3187 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3246-3252 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/AppleTerminalView.swift:3181` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) Sources/SwiftTerm/CellStorage.swift:693 — Sources/SwiftTerm/CellStorage.swift:693-699 | Sources/SwiftTerm/CellStorage.swift:751-757 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/CellStorage.swift:693` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) Sources/SwiftTerm/Terminal.swift:7276 — Sources/SwiftTerm/Terminal.swift:7276-7282 | Sources/SwiftTerm/Terminal.swift:7331-7337 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Terminal.swift:7276` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Docs/prototypes/futex-ticket-lock/main.swift:148 — Docs/prototypes/futex-ticket-lock/main.swift:148-154 | Docs/prototypes/futex-ticket-lock/noshim.swift:62-68 — before extracting anything, compare `Docs/prototypes/futex-ticket-lock/main.swift` and `Docs/prototypes/futex-ticket-lock/noshim.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:1690 — Sources/SwiftTerm/Mac/MacTerminalView.swift:1690-1696 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2017-2023 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:5073 — Sources/SwiftTerm/Mac/MacTerminalView.swift:5073-5079 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3929-3935 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:5081 — Sources/SwiftTerm/Mac/MacTerminalView.swift:5081-5087 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3865-3871 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) Sources/SwiftTerm/iOS/iOSAccessoryView.swift:60 — Sources/SwiftTerm/iOS/iOSAccessoryView.swift:60-66 | Sources/SwiftTerm/iOS/iOSKeyboardView.swift:24-30 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) Sources/SwiftTerm/iOS/SwiftUITerminalView.swift:50 — Sources/SwiftTerm/iOS/SwiftUITerminalView.swift:50-56 | TerminalApp/iOSTerminal/TerminalHostViewController.swift:81-87 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2211 — Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2211-2217 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2427-2433 — 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.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×10
  • Duplicated block (6 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3666 — Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3666-3671 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4121-4126 — 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 (6 lines × 2) Sources/SwiftTerm/ByteRunScanner.swift:197 — Sources/SwiftTerm/ByteRunScanner.swift:197-202 | Sources/SwiftTerm/ByteRunScanner.swift:216-221 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/ByteRunScanner.swift:197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/SwiftTerm/Terminal.swift:2468 — Sources/SwiftTerm/Terminal.swift:2468-2473 | Sources/SwiftTerm/Terminal.swift:2488-2495 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Terminal.swift:2468` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/SwiftTerm/Terminal.swift:7286 — Sources/SwiftTerm/Terminal.swift:7286-7291 | Sources/SwiftTerm/Terminal.swift:7341-7346 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Terminal.swift:7286` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/SwiftTerm/TerminalViewSearch.swift:23 — Sources/SwiftTerm/TerminalViewSearch.swift:23-28 | Sources/SwiftTerm/TerminalViewSearch.swift:53-58 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/TerminalViewSearch.swift:23` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4181 — Sources/SwiftTerm/iOS/iOSTerminalView.swift:4181-4186 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:4225-4230 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/iOS/iOSTerminalView.swift:4181` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) TerminalApp/MacTerminal/ViewController.swift:943 — TerminalApp/MacTerminal/ViewController.swift:943-948 | TerminalApp/MacTerminal/ViewController.swift:1007-1012 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `TerminalApp/MacTerminal/ViewController.swift:943` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Tools/BidiHarness/BidiHarness/ArtifactCapture.swift:158 — Tools/BidiHarness/BidiHarness/ArtifactCapture.swift:158-163 | Tools/BidiHarness/BidiHarness/SocketControlServer.swift:36-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3171 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:3171-3176 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3236-3241 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) Sources/SwiftTerm/Apple/BellStyle.swift:49 — Sources/SwiftTerm/Apple/BellStyle.swift:49-54 | Sources/SwiftTerm/TerminalOptions.swift:54-59 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×10
  • Duplicated block (5 lines × 2) Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:476 — Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:476-480 | Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:488-492 — 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 (5 lines × 2) Sources/SwiftTerm/KittyGraphics.swift:421 — Sources/SwiftTerm/KittyGraphics.swift:421-425 | Sources/SwiftTerm/KittyGraphics.swift:428-432 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/KittyGraphics.swift:421` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/SwiftTerm/KittyGraphics.swift:419` calls `intValue` and `Sources/SwiftTerm/KittyGraphics.swift:426` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:3172 — Sources/SwiftTerm/Mac/MacTerminalView.swift:3172-3176 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2835-2839 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacTerminalView.swift:3172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4215 — Sources/SwiftTerm/iOS/iOSTerminalView.swift:4215-4219 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:4238-4242 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/iOS/iOSTerminalView.swift:4215` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) Sources/SwiftTermWebWasm/GraphicsExports.swift:60 — Sources/SwiftTermWebWasm/GraphicsExports.swift:60-64 | Sources/SwiftTermWebWasm/GraphicsExports.swift:74-78 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTermWebWasm/GraphicsExports.swift:60` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) TerminalApp/MacTerminal/ViewController.swift:921 — TerminalApp/MacTerminal/ViewController.swift:921-925 | TerminalApp/MacTerminal/ViewController.swift:989-993 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `TerminalApp/MacTerminal/ViewController.swift:921` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `TerminalApp/MacTerminal/ViewController.swift:918` calls `requestRedraw` and `TerminalApp/MacTerminal/ViewController.swift:986` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4939 — Sources/SwiftTerm/Mac/MacTerminalView.swift:4939-4943 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3754-3758 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3426 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:3426-3430 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2705-2709 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) Sources/SwiftTerm/Mac/MacExtensions.swift:25 — Sources/SwiftTerm/Mac/MacExtensions.swift:25-29 | Sources/SwiftTerm/iOS/iOSExtensions.swift:17-21 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacExtensions.swift:25` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Tools/SwiftTermBenchmarks/analyze-time-profile.py:87 — Tools/SwiftTermBenchmarks/analyze-time-profile.py:87-91 | Tools/SwiftTermBenchmarks/analyze-time-profile.py:100-104 — 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.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×9
  • Duplicated block (11 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2782 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:2782-2792 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4496-4506 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) Sources/SwiftTerm/Apple/Metal/CoreTextGlyphRasterizer.swift:47 — Sources/SwiftTerm/Apple/Metal/CoreTextGlyphRasterizer.swift:47-57 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3303-3313 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/Metal/CoreTextGlyphRasterizer.swift:47` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2770 — Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2770-2780 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2783-2793 — 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 (11 lines × 2) Sources/SwiftTerm/CharData.swift:156 — Sources/SwiftTerm/CharData.swift:156-166 | Sources/SwiftTerm/CharData.swift:169-179 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/CharData.swift:156` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:609 — Sources/SwiftTerm/Mac/MacTerminalView.swift:609-619 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:498-508 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4472 — Sources/SwiftTerm/Mac/MacTerminalView.swift:4472-4482 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:1644-1654 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacTerminalView.swift:4472` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/SwiftTerm/iOS/iOSTerminalView.swift:1643` calls `calculateTapHit` and `Sources/SwiftTerm/Mac/MacTerminalView.swift:4471` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (11 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4836 — Sources/SwiftTerm/Mac/MacTerminalView.swift:4836-4846 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3655-3665 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) Sources/SwiftTerm/SelectionService.swift:299 — Sources/SwiftTerm/SelectionService.swift:299-309 | Sources/SwiftTerm/SelectionService.swift:310-320 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/SelectionService.swift:299` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) Sources/SwiftTerm/Terminal.swift:7258 — Sources/SwiftTerm/Terminal.swift:7258-7268 | Sources/SwiftTerm/Terminal.swift:7313-7323 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Terminal.swift:7258` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×8
  • Duplicated block (10 lines × 2) Docs/prototypes/futex-ticket-lock/main.swift:110 — Docs/prototypes/futex-ticket-lock/main.swift:110-119 | Docs/prototypes/futex-ticket-lock/main.swift:180-189 — 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 (10 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3821 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:3821-3830 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2802-2811 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/AppleTerminalView.swift:3821` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:368 — Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:368-377 | Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:1181-1190 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:368` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Sources/SwiftTerm/Apple/TerminalBidi.swift:724 — Sources/SwiftTerm/Apple/TerminalBidi.swift:724-733 | Sources/SwiftTerm/Apple/TerminalBidi.swift:1027-1036 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/TerminalBidi.swift:724` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:2974 — Sources/SwiftTerm/Mac/MacTerminalView.swift:2974-2983 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2549-2558 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:3842 — Sources/SwiftTerm/Mac/MacTerminalView.swift:3842-3851 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:919-928 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacTerminalView.swift:3842` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (10 lines × 2) Docs/prototypes/futex-ticket-lock/main.swift:22 — Docs/prototypes/futex-ticket-lock/main.swift:22-31 | Docs/prototypes/futex-ticket-lock/noshim.swift:22-31 — before extracting anything, compare `Docs/prototypes/futex-ticket-lock/main.swift` and `Docs/prototypes/futex-ticket-lock/noshim.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:1284 — Sources/SwiftTerm/Mac/MacTerminalView.swift:1284-1293 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:1731-1740 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D17 · Explicit Debt · FixmeComment · ×6
  • FixmeComment Sources/SwiftTerm/Buffer.swift:1902 — // FIXME: additionally ensure chWidth fits into a line — 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.
  • FixmeComment Sources/SwiftTerm/Buffer.swift:1924 — // FIXME: check for xterm behavior — 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.
  • FixmeComment Sources/SwiftTerm/Buffer.swift:1928 — // FIXME: Do we have to set buffer.x to cols - 1, if not wrapping? — 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.
  • FixmeComment Sources/SwiftTerm/Terminal.swift:2626 — // // FIXME: additionally ensure chWidth fits into a line — 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.
  • FixmeComment Sources/SwiftTerm/Terminal.swift:2646 — // // FIXME: check for xterm behavior — 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.
  • FixmeComment Sources/SwiftTerm/Terminal.swift:2650 — // // FIXME: Do we have to set buffer.x to cols - 1, if not wrapping? — 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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×6
  • Duplicated block (12 lines × 2) Docs/prototypes/futex-ticket-lock/main.swift:136 — Docs/prototypes/futex-ticket-lock/main.swift:136-147 | Docs/prototypes/futex-ticket-lock/noshim.swift:50-61 — before extracting anything, compare `Docs/prototypes/futex-ticket-lock/main.swift` and `Docs/prototypes/futex-ticket-lock/noshim.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:274 — Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:274-285 | Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:289-300 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) Sources/SwiftTerm/ByteRunScanner.swift:259 — Sources/SwiftTerm/ByteRunScanner.swift:259-270 | Sources/SwiftTerm/ByteRunScanner.swift:292-303 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/ByteRunScanner.swift:259` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:645 — Sources/SwiftTerm/Mac/MacTerminalView.swift:645-656 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:547-558 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (12 lines × 2) scripts/regen_unicode_width_data.py:152 — scripts/regen_unicode_width_data.py:152-163 | scripts/regen_unicode_width_data.py:184-195 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `scripts/regen_unicode_width_data.py:181` calls `split`, `strip` and `scripts/regen_unicode_width_data.py:151` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) scripts/regen_unicode_width_data.py:257 — scripts/regen_unicode_width_data.py:257-268 | scripts/regen_unicode_width_data.py:275-286 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×6
  • Duplicated block (9 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4615 — Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4615-4623 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4640-4648 — 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 (9 lines × 2) Sources/SwiftTerm/CellStorage.swift:156 — Sources/SwiftTerm/CellStorage.swift:156-164 | Sources/SwiftTerm/CellStorage.swift:176-184 — 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 (9 lines × 2) Sources/SwiftTerm/CellStorage.swift:827 — Sources/SwiftTerm/CellStorage.swift:827-835 | Sources/SwiftTerm/CellStorage.swift:843-851 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/CellStorage.swift:827` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) Sources/SwiftTerm/KittyGraphics.swift:1294 — Sources/SwiftTerm/KittyGraphics.swift:1294-1302 | Sources/SwiftTerm/KittyGraphics.swift:1336-1344 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `base64Payload` to `[UInt8]` in one and `[UInt8]) -> (payload: KittyGraphicsPayload?` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (9 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4929 — Sources/SwiftTerm/Mac/MacTerminalView.swift:4929-4937 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3744-3752 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacTerminalView.swift:4929` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Sources/SwiftTerm/Profiling.swift:423 — Sources/SwiftTerm/Profiling.swift:423-431 | Sources/SwiftTerm/Profiling.swift:456-464 — 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.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×4
  • Duplicated block (8 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:706 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:706-713 | Sources/SwiftTerm/Apple/TerminalSnapshot.swift:247-254 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4973 — Sources/SwiftTerm/Mac/MacTerminalView.swift:4973-4980 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3831-3838 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) Sources/SwiftTerm/Terminal.swift:2488 — Sources/SwiftTerm/Terminal.swift:2488-2495 | Sources/SwiftTerm/Terminal.swift:2501-2508 — 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 (8 lines × 2) Docs/prototypes/futex-ticket-lock/main.swift:34 — Docs/prototypes/futex-ticket-lock/main.swift:34-41 | Docs/prototypes/futex-ticket-lock/noshim.swift:34-41 — before extracting anything, compare `Docs/prototypes/futex-ticket-lock/main.swift` and `Docs/prototypes/futex-ticket-lock/noshim.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 37 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×3
  • Duplicated block (15 lines × 2) Docs/prototypes/futex-ticket-lock/main.swift:94 — Docs/prototypes/futex-ticket-lock/main.swift:94-108 | Docs/prototypes/futex-ticket-lock/main.swift:165-179 — 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (15 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:3814 — Sources/SwiftTerm/Mac/MacTerminalView.swift:3814-3828 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:892-906 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacTerminalView.swift:3814` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) Sources/SwiftTerm/iOS/iOSTerminalView.swift:3009 — Sources/SwiftTerm/iOS/iOSTerminalView.swift:3009-3023 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3043-3057 — 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.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×3
  • Duplicated block (13 lines × 2) Sources/SwiftTerm/Buffer.swift:1783 — Sources/SwiftTerm/Buffer.swift:1783-1795 | Sources/SwiftTerm/Buffer.swift:1820-1832 — 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 (13 lines × 2) Sources/SwiftTerm/KittyGraphics.swift:2397 — Sources/SwiftTerm/KittyGraphics.swift:2397-2409 | Sources/SwiftTerm/KittyGraphics.swift:2423-2435 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/KittyGraphics.swift:2397` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Sources/SwiftTerm/SelectionService.swift:829 — Sources/SwiftTerm/SelectionService.swift:829-841 | Sources/SwiftTerm/SelectionService.swift:867-879 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/SelectionService.swift:829` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×3
  • Duplicated block (6 lines × 3) Sources/SwiftTerm/ByteRunScanner.swift:36 — Sources/SwiftTerm/ByteRunScanner.swift:36-41 | Sources/SwiftTerm/ByteRunScanner.swift:97-102 | Sources/SwiftTerm/ByteRunScanner.swift:146-152 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/ByteRunScanner.swift:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 3) Sources/SwiftTerm/DECPrivateModes.swift:32 — Sources/SwiftTerm/DECPrivateModes.swift:32-37 | Sources/SwiftTerm/KittyGraphicsSnapshot.swift:37-42 | Sources/SwiftTerm/KittyGraphicsSnapshot.swift:52-57 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (6 lines × 3) scripts/regen_unicode_width_data.py:255 — scripts/regen_unicode_width_data.py:255-260 | scripts/regen_unicode_width_data.py:273-278 | scripts/regen_unicode_width_data.py:291-296 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×3
  • Swallowed exception (caught, then discarded) Sources/SwiftTermBuildInfoGenerator/BuildInfoGenerator.swift:287 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/SwiftTerm/KittyGraphics.swift:2763 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift:250 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
D1 · Cyclomatic Complexity · Terminal.handlePrintSlow · ×2
  • Terminal.handlePrintSlow::insertScalarBatch (cyclomatic 21) Sources/SwiftTerm/Terminal.swift:2165 — Terminal.handlePrintSlow::insertScalarBatch has cyclomatic complexity 21 (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. This shape REPEATS in the file: 2 other methods here (Terminal.handlePrintSlow, Terminal.handlePrintSlow::batchableScalar) 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.
  • Terminal.handlePrintSlow::batchableScalar (cyclomatic 19) Sources/SwiftTerm/Terminal.swift:2080 — Terminal.handlePrintSlow::batchableScalar 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: 2 other methods here (Terminal.handlePrintSlow, Terminal.handlePrintSlow::insertScalarBatch) 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.
D10 · Test Quality · Skipped test · ×2
  • Skipped test: testCheckedLaunchWriteAndResize Tests/SwiftTermTests/LocalProcessLifecycleTests.swift:590 — Skipped — throws XCTSkip
  • Skipped test: testPendingWriteCompletesWhenProcessIsReleased Tests/SwiftTermTests/LocalProcessLifecycleTests.swift:688 — Skipped — throws XCTSkip
D2 · Cognitive Complexity · Terminal.handlePrintSlow · ×2
  • Terminal.handlePrintSlow::batchableScalar (cognitive 27) Sources/SwiftTerm/Terminal.swift:2080 — Terminal.handlePrintSlow::batchableScalar has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7, ternaries 3 (5 pts), loops 1 (2 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. This shape REPEATS in the file: 2 other methods here (Terminal.handlePrintSlow, Terminal.handlePrintSlow::insertScalarBatch) 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.
  • Terminal.handlePrintSlow::insertScalarBatch (cognitive 27) Sources/SwiftTerm/Terminal.swift:2165 — Terminal.handlePrintSlow::insertScalarBatch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, loops 4 (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. This shape REPEATS in the file: 2 other methods here (Terminal.handlePrintSlow, Terminal.handlePrintSlow::batchableScalar) 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.
D3 · God Classes · FunctionTooLong · ×2
  • FunctionTooLong: AppleTerminalView.swift.top-level code Sources/SwiftTerm/Apple/AppleTerminalView.swift:21 — FunctionTooLong — top-level code runs 182 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× 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: BoxDrawingRenderer.swift.linesChar Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:248 — FunctionTooLong — linesChar 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.
D35 · Change Coupling · Change coupling · ×2
  • Change coupling: MacTerminalView.swift ↔ Profiling.swift Sources/SwiftTerm/Mac/MacTerminalView.swift:1 — `Sources/SwiftTerm/Mac/MacTerminalView.swift` and `Sources/SwiftTerm/Profiling.swift` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these 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 `d689589b` Reduce terminal frame lock time and harden PTY benchmarks; `b50e3b68` Coalesce terminal resizes during live macOS window drags; `c1e97639` Fix the attribute cache. — run `git show` on any of them.
  • Change coupling: CircularList.swift ↔ MacDebugView.swift Sources/SwiftTerm/CircularList.swift:1 — `Sources/SwiftTerm/CircularList.swift` and `Sources/SwiftTerm/Mac/MacDebugView.swift` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these 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 `690e6c62` Bring back some debugging code I removed for the sake of performance; `435a5266` Remove unsafe code, make a few other things private, not clear if it …; `ac441554` Make CircularBufferLineList.array and startIndex private, bump to 60… — run `git show` on any of them.
D36 · Supply-chain Provenance & Signing REDACTED · ×2
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×2
  • Duplicated block (10 lines × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2529 — Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2529-2538 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4437-4446 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4591-4600 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2540` calls `transformRect` and `Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4447` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2563 — Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2563-2572 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2594-2603 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2616-2625 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2563` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×2
  • Duplicated block (9–10 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2726 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:2726-2735 | Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:371-379 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/AppleTerminalView.swift:2726` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) scripts/regen_unicode_width_data.py:374 — scripts/regen_unicode_width_data.py:374-383 | scripts/regen_unicode_width_data.py:419-427 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/regen_unicode_width_data.py:374` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×2
  • Duplicated block (8 lines × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1979 — Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1979-1986 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2008-2015 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2032-2039 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) scripts/regen_unicode_width_data.py:262 — scripts/regen_unicode_width_data.py:262-269 | scripts/regen_unicode_width_data.py:280-287 | scripts/regen_unicode_width_data.py:298-305 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×2
  • Duplicated block (7–8 lines × 2) Sources/SwiftTerm/CellStorage.swift:457 — Sources/SwiftTerm/CellStorage.swift:457-464 | Sources/SwiftTerm/CellStorage.swift:624-630 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/SwiftTerm/CellStorage.swift:455` calls `preconditionFailure` and `Sources/SwiftTerm/CellStorage.swift:623` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7–8 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4774 — Sources/SwiftTerm/Mac/MacTerminalView.swift:4774-4780 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2052-2059 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacTerminalView.swift:4774` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `image` to `NSImage` in one and `UIImage` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D5 · Coupling · Off the main sequence · ×2
  • Off the main sequence: VTEBenchWorkloads — VTEBenchWorkloads: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: SwiftTerm — SwiftTerm: abstractness 0.03, instability 0.00, distance 0.97 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×2
  • Outbound HTTP without resilience scripts/regen_unicode_width_data.py:78 — `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience scripts/regen_unicode_width_data.py:86 — `urllib.request.urlopen(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
AC6 · Visual & motion safety · Focus outline removed in CSS without a · ×1
  • Focus outline removed in CSS without a :focus replacement TerminalApp/WebTerminal/Public/styles.css:20 — `#terminal-input` 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.
AC7 · A11y enforcement · Accessibility enforcement below the top rung · ×1
  • Accessibility enforcement below the top rung — No accessibility enforcement found — no accessibility linting at author time and no automated accessibility check in tests or CI. Add your UI toolkit's own accessibility assertion to the test suite (Flutter `meetsGuideline`, Espresso `AccessibilityChecks`, XCTest `performAccessibilityAudit`), then gate that test in the pipeline. What was searched, so you can tell an absence from a miss: the 1 markup file(s) this pass actually assessed, the linter configuration checked in beside them, and this repository's test and CI files — matched by name against the accessibility checkers this dimension carries. An audit run outside the repository, a hosted scanner, or a check whose name is not one of those, is not seen here.
D1 · Cyclomatic Complexity · TerminalView.pressesBegan (cyclomatic 116) · ×1
  • TerminalView.pressesBegan (cyclomatic 116) Sources/SwiftTerm/iOS/iOSTerminalView.swift:3234 — TerminalView.pressesBegan has cyclomatic complexity 116 (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 · EscapeSequenceParser.parseBorrowed (cyclomatic 104) · ×1
  • EscapeSequenceParser.parseBorrowed (cyclomatic 104) Sources/SwiftTerm/EscapeSequenceParser.swift:1090 — EscapeSequenceParser.parseBorrowed has cyclomatic complexity 104 (threshold 15). Of this number, 100 points are the body's own statements and 4 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 · TerminalView.keyDown (cyclomatic 103) · ×1
  • TerminalView.keyDown (cyclomatic 103) Sources/SwiftTerm/Mac/MacTerminalView.swift:2318 — TerminalView.keyDown has cyclomatic complexity 103 (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 · TerminalView.drawTerminalContents (cyclomatic 102) · ×1
  • TerminalView.drawTerminalContents (cyclomatic 102) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3297 — TerminalView.drawTerminalContents has cyclomatic complexity 102 (threshold 15). Of this number, 88 points are the body's own statements and 14 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 · Terminal.cmdDecRqm (cyclomatic 94) · ×1
  • Terminal.cmdDecRqm (cyclomatic 94) Sources/SwiftTerm/Terminal.swift:5769 — Terminal.cmdDecRqm has cyclomatic complexity 94 (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 · HarnessViewController.execute (cyclomatic 86) · ×1
  • HarnessViewController.execute (cyclomatic 86) Tools/BidiHarness/BidiHarness/HarnessViewController.swift:245 — HarnessViewController.execute has cyclomatic complexity 86 (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 · TerminalView.kittyFunctionalKey (cyclomatic 82) · ×1
  • TerminalView.kittyFunctionalKey (cyclomatic 82) Sources/SwiftTerm/Mac/MacTerminalView.swift:2995 — TerminalView.kittyFunctionalKey has cyclomatic complexity 82 (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 · SnapshotTextBuilder.buildAttributedString (cyclomatic 70) · ×1
  • SnapshotTextBuilder.buildAttributedString (cyclomatic 70) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:449 — SnapshotTextBuilder.buildAttributedString has cyclomatic complexity 70 (threshold 15). Of this number, 68 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 · TerminalView.doCommand (cyclomatic 67) · ×1
  • TerminalView.doCommand (cyclomatic 67) Sources/SwiftTerm/Mac/MacTerminalView.swift:2633 — TerminalView.doCommand has cyclomatic complexity 67 (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 · MetalTerminalRenderer.prepareRow (cyclomatic 59) · ×1
  • MetalTerminalRenderer.prepareRow (cyclomatic 59) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1920 — MetalTerminalRenderer.prepareRow has cyclomatic complexity 59 (threshold 15). Of this number, 58 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 · MetalTerminalRenderer.placeRow (cyclomatic 59) · ×1
  • MetalTerminalRenderer.placeRow (cyclomatic 59) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2478 — MetalTerminalRenderer.placeRow has cyclomatic complexity 59 (threshold 15). Of this number, 56 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 · snapshot.decodeSnapshot (cyclomatic 59) · ×1
  • snapshot.decodeSnapshot (cyclomatic 59) Web/src/snapshot.ts:6 — snapshot.decodeSnapshot has cyclomatic complexity 59 (threshold 15). Of this number, 49 points are the body's own statements and 10 belong to 2 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 · Terminal.cmdCharAttributes (cyclomatic 58) · ×1
  • Terminal.cmdCharAttributes (cyclomatic 58) Sources/SwiftTerm/Terminal.swift:6226 — Terminal.cmdCharAttributes has cyclomatic complexity 58 (threshold 15). Of this number, 36 points are the body's own statements and 22 belong to 4 function items inside it that branch. 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 · events.decodeEvent (cyclomatic 58) · ×1
  • events.decodeEvent (cyclomatic 58) Web/src/events.ts:4 — events.decodeEvent has cyclomatic complexity 58 (threshold 15). Of this number, 47 points are the body's own statements and 11 belong to 4 function items inside it that branch. 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 · BoxDrawingRenderer.swift.linesChar (cyclomatic 57) · ×1
  • BoxDrawingRenderer.swift.linesChar (cyclomatic 57) Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:248 — BoxDrawingRenderer.swift.linesChar has cyclomatic complexity 57 (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 is NOT this file's highest cyclomatic complexity: BoxDrawingRenderer.draw (cyclomatic 129) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · EscapeSequenceParser.dispatchCsi (cyclomatic 56) · ×1
  • EscapeSequenceParser.dispatchCsi (cyclomatic 56) Sources/SwiftTerm/EscapeSequenceParser.swift:605 — EscapeSequenceParser.dispatchCsi has cyclomatic complexity 56 (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 · Terminal.handlePrintSlow (cyclomatic 55) · ×1
  • Terminal.handlePrintSlow (cyclomatic 55) Sources/SwiftTerm/Terminal.swift:1991 — Terminal.handlePrintSlow has cyclomatic complexity 55 (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 (Terminal.handlePrintSlow::batchableScalar, Terminal.handlePrintSlow::insertScalarBatch) 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 · KittyKeyboardEncoder.encode (cyclomatic 54) · ×1
  • KittyKeyboardEncoder.encode (cyclomatic 54) Sources/SwiftTerm/KittyKeyboardEncoder.swift:168 — KittyKeyboardEncoder.encode has cyclomatic complexity 54 (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. This is NOT this file's highest cyclomatic complexity: KittyKeyboardEncoder.functionalEncoding (cyclomatic 109) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · TerminalIOPipelineWorker.gatherMain (cyclomatic 48) · ×1
  • TerminalIOPipelineWorker.gatherMain (cyclomatic 48) Sources/SwiftTerm/TerminalIOPipeline.swift:559 — TerminalIOPipelineWorker.gatherMain 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 · Terminal.makeRenderSnapshot (cyclomatic 44) · ×1
  • Terminal.makeRenderSnapshot (cyclomatic 44) Sources/SwiftTerm/Terminal.swift:7815 — Terminal.makeRenderSnapshot has cyclomatic complexity 44 (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 · KittyFileTransfer.convert (cyclomatic 43) · ×1
  • KittyFileTransfer.convert (cyclomatic 43) TerminalApp/WebTerminal/Sources/WebTerminalServer/KittyFileTransfer.swift:135 — KittyFileTransfer.convert 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 · Terminal.parseKittyGraphicsControl (cyclomatic 42) · ×1
  • Terminal.parseKittyGraphicsControl (cyclomatic 42) Sources/SwiftTerm/KittyGraphics.swift:331 — Terminal.parseKittyGraphicsControl has cyclomatic complexity 42 (threshold 15). Of this number, 30 points are the body's own statements and 12 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 · SnapshotEncoder.encode (cyclomatic 42) · ×1
  • SnapshotEncoder.encode (cyclomatic 42) Sources/SwiftTermWebWasm/SnapshotEncoder.swift:41 — SnapshotEncoder.encode has cyclomatic complexity 42 (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 · Terminal.cmdWindowOptions (cyclomatic 41) · ×1
  • Terminal.cmdWindowOptions (cyclomatic 41) Sources/SwiftTerm/Terminal.swift:5208 — Terminal.cmdWindowOptions has cyclomatic complexity 41 (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 · Terminal.resetMode (cyclomatic 40) · ×1
  • Terminal.resetMode (cyclomatic 40) Sources/SwiftTerm/Terminal.swift:6620 — Terminal.resetMode has cyclomatic complexity 40 (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 · TerminalSnapshot.refresh (cyclomatic 40) · ×1
  • TerminalSnapshot.refresh (cyclomatic 40) Sources/SwiftTerm/Apple/TerminalSnapshot.swift:338 — TerminalSnapshot.refresh has cyclomatic complexity 40 (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 · ProgramStatusReport.parse (cyclomatic 39) · ×1
  • ProgramStatusReport.parse (cyclomatic 39) Sources/SwiftTerm/ProgramStatus.swift:139 — ProgramStatusReport.parse 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 · Terminal.setMode (cyclomatic 39) · ×1
  • Terminal.setMode (cyclomatic 39) Sources/SwiftTerm/Terminal.swift:6839 — Terminal.setMode has cyclomatic complexity 39 (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 · KeyboardView.buildUI (cyclomatic 38) · ×1
  • KeyboardView.buildUI (cyclomatic 38) Sources/SwiftTerm/iOS/iOSKeyboardView.swift:65 — KeyboardView.buildUI has cyclomatic complexity 38 (threshold 15). Of this number, 35 points are the body's own statements and 3 belong to one function item inside it that branches. 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 · MetalTerminalRenderer.buildCursorDrawData (cyclomatic 38) · ×1
  • MetalTerminalRenderer.buildCursorDrawData (cyclomatic 38) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3931 — MetalTerminalRenderer.buildCursorDrawData 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 · EscapeSequenceParser.dispatchEsc (cyclomatic 36) · ×1
  • EscapeSequenceParser.dispatchEsc (cyclomatic 36) Sources/SwiftTerm/EscapeSequenceParser.swift:692 — EscapeSequenceParser.dispatchEsc has cyclomatic complexity 36 (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 · KittyKeyboardEncoder.legacyKeypadSequence (cyclomatic 36) · ×1
  • KittyKeyboardEncoder.legacyKeypadSequence (cyclomatic 36) Sources/SwiftTerm/KittyKeyboardEncoder.swift:861 — KittyKeyboardEncoder.legacyKeypadSequence has cyclomatic complexity 36 (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. This is NOT this file's highest cyclomatic complexity: KittyKeyboardEncoder.functionalEncoding (cyclomatic 109) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · TerminalBidi.shapeArabic (cyclomatic 35) · ×1
  • TerminalBidi.shapeArabic (cyclomatic 35) Sources/SwiftTerm/Apple/TerminalBidi.swift:348 — TerminalBidi.shapeArabic has cyclomatic complexity 35 (threshold 15). Of this number, 30 points are the body's own statements and 5 belong to 2 function items inside it that branch. 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 · MetalTerminalRenderer.render (cyclomatic 35) · ×1
  • MetalTerminalRenderer.render (cyclomatic 35) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1336 — MetalTerminalRenderer.render has cyclomatic complexity 35 (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 · Terminal.osciTerm2 (cyclomatic 33) · ×1
  • Terminal.osciTerm2 (cyclomatic 33) Sources/SwiftTerm/Terminal.swift:3836 — Terminal.osciTerm2 has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 15 of the 33 points are its own statements and the rest belongs to 2 function items inside it that branch (parseDimension, parseKeyValues). 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 · Terminal.displayKittyImage (cyclomatic 31) · ×1
  • Terminal.displayKittyImage (cyclomatic 31) Sources/SwiftTerm/KittyGraphics.swift:1567 — Terminal.displayKittyImage has cyclomatic complexity 31 (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 · TerminalBidi.buildParagraph (cyclomatic 31) · ×1
  • TerminalBidi.buildParagraph (cyclomatic 31) Sources/SwiftTerm/Apple/TerminalBidi.swift:672 — TerminalBidi.buildParagraph has cyclomatic complexity 31 (threshold 15). Of this number, 26 points are the body's own statements and 5 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 · ViewController.validateUserInterfaceItem (cyclomatic 31) · ×1
  • ViewController.validateUserInterfaceItem (cyclomatic 31) TerminalApp/MacTerminal/ViewController.swift:653 — ViewController.validateUserInterfaceItem 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 · connect (cyclomatic 31) · ×1
  • connect (cyclomatic 31) TerminalApp/WebTerminal/Public/app.js:66 — connect has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 8 of the 31 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 117, shortcut, canInput, …). 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 · SelectionService.urlRange (cyclomatic 30) · ×1
  • SelectionService.urlRange (cyclomatic 30) Sources/SwiftTerm/SelectionService.swift:1288 — SelectionService.urlRange has cyclomatic complexity 30 (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 · Terminal.buildGhosttyImplicitLineMap (cyclomatic 30) · ×1
  • Terminal.buildGhosttyImplicitLineMap (cyclomatic 30) Sources/SwiftTerm/Terminal.swift:9629 — Terminal.buildGhosttyImplicitLineMap 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 · KittyFileTransfer.receive (cyclomatic 30) · ×1
  • KittyFileTransfer.receive (cyclomatic 30) TerminalApp/WebTerminal/Sources/WebTerminalServer/KittyFileTransfer.swift:56 — KittyFileTransfer.receive has cyclomatic complexity 30 (threshold 15). Of this number, 29 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 · KittyPlaceholderDecoder.decode (cyclomatic 29) · ×1
  • KittyPlaceholderDecoder.decode (cyclomatic 29) Sources/SwiftTerm/KittyPlaceholder.swift:48 — KittyPlaceholderDecoder.decode has cyclomatic complexity 29 (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 · Terminal.csiCopyRectangularArea (cyclomatic 29) · ×1
  • Terminal.csiCopyRectangularArea (cyclomatic 29) Sources/SwiftTerm/Terminal.swift:4864 — Terminal.csiCopyRectangularArea has cyclomatic complexity 29 (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 · Terminal.handleKittyDelete (cyclomatic 29) · ×1
  • Terminal.handleKittyDelete (cyclomatic 29) Sources/SwiftTerm/KittyGraphics.swift:848 — Terminal.handleKittyDelete has cyclomatic complexity 29 (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 · TerminalView.scrollWheel (cyclomatic 29) · ×1
  • TerminalView.scrollWheel (cyclomatic 29) Sources/SwiftTerm/Mac/MacTerminalView.swift:4617 — TerminalView.scrollWheel has cyclomatic complexity 29 (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 is NOT this file's highest cyclomatic complexity: TerminalView.windowCommand (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Buffer.reflowNarrower (cyclomatic 28) · ×1
  • Buffer.reflowNarrower (cyclomatic 28) Sources/SwiftTerm/Buffer.swift:1521 — Buffer.reflowNarrower has cyclomatic complexity 28 (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 · Terminal.scrollGeneral (cyclomatic 28) · ×1
  • Terminal.scrollGeneral (cyclomatic 28) Sources/SwiftTerm/Terminal.swift:8238 — Terminal.scrollGeneral has cyclomatic complexity 28 (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 · Terminal.implicitLinkMatch (cyclomatic 28) · ×1
  • Terminal.implicitLinkMatch (cyclomatic 28) Sources/SwiftTerm/Terminal.swift:9390 — Terminal.implicitLinkMatch has cyclomatic complexity 28 (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 · main.swift.top-level code (cyclomatic 28) · ×1
  • main.swift.top-level code (cyclomatic 28) Tools/RenderBench/Sources/RenderBench/main.swift:36 — main.swift.top-level code has cyclomatic complexity 28 (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 · graphics.decodeGraphics (cyclomatic 28) · ×1
  • graphics.decodeGraphics (cyclomatic 28) Web/src/graphics.ts:6 — graphics.decodeGraphics has cyclomatic complexity 28 (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 · Buffer.resize (cyclomatic 27) · ×1
  • Buffer.resize (cyclomatic 27) Sources/SwiftTerm/Buffer.swift:946 — Buffer.resize 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 · Terminal.sendHostMouse (cyclomatic 27) · ×1
  • Terminal.sendHostMouse (cyclomatic 27) Sources/SwiftTerm/Terminal.swift:9023 — Terminal.sendHostMouse has cyclomatic complexity 27 (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 · ClipboardController.run (cyclomatic 27) · ×1
  • ClipboardController.run (cyclomatic 27) TerminalApp/WebTerminal/Public/clipboard.js:122 — ClipboardController.run 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 · BufferLine.copyFrom (cyclomatic 26) · ×1
  • BufferLine.copyFrom (cyclomatic 26) Sources/SwiftTerm/BufferLine.swift:885 — BufferLine.copyFrom 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 · KeyboardInputController.keydown (cyclomatic 26) · ×1
  • KeyboardInputController.keydown (cyclomatic 26) Web/src/keyboard.ts:136 — KeyboardInputController.keydown 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 · TerminalInputController.pointerDown (cyclomatic 26) · ×1
  • TerminalInputController.pointerDown (cyclomatic 26) Web/src/input.ts:149 — TerminalInputController.pointerDown has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 1 of the 26 points is its own statement and the rest belongs to one function literal inside it that branches (line 149). 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 · Terminal.oscSemanticPrompt (cyclomatic 25) · ×1
  • Terminal.oscSemanticPrompt (cyclomatic 25) Sources/SwiftTerm/Terminal.swift:3443 — Terminal.oscSemanticPrompt 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 · MetalTerminalRenderer.buildDrawDataPass (cyclomatic 25) · ×1
  • MetalTerminalRenderer.buildDrawDataPass (cyclomatic 25) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1681 — MetalTerminalRenderer.buildDrawDataPass 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 · KeyboardInputController.normalize (cyclomatic 25) · ×1
  • KeyboardInputController.normalize (cyclomatic 25) Web/src/keyboard.ts:114 — KeyboardInputController.normalize has cyclomatic complexity 25 (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 · SelectionService.adjustForInPlaceScroll (cyclomatic 24) · ×1
  • SelectionService.adjustForInPlaceScroll (cyclomatic 24) Sources/SwiftTerm/SelectionService.swift:74 — SelectionService.adjustForInPlaceScroll has cyclomatic complexity 24 (threshold 15). Of this number, 20 points are the body's own statements and 4 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 · SelectionService.selectedColumns (cyclomatic 24) · ×1
  • SelectionService.selectedColumns (cyclomatic 24) Sources/SwiftTerm/SelectionService.swift:271 — SelectionService.selectedColumns 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 · Terminal.handleKittyAnimationFrame (cyclomatic 24) · ×1
  • Terminal.handleKittyAnimationFrame (cyclomatic 24) Sources/SwiftTerm/KittyGraphics.swift:524 — Terminal.handleKittyAnimationFrame 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 · Terminal.kittyGraphicsAdvanceAnimations (cyclomatic 24) · ×1
  • Terminal.kittyGraphicsAdvanceAnimations (cyclomatic 24) Sources/SwiftTerm/KittyGraphics.swift:2485 — Terminal.kittyGraphicsAdvanceAnimations 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 · TerminalView.sendKittyTextInput (cyclomatic 24) · ×1
  • TerminalView.sendKittyTextInput (cyclomatic 24) Sources/SwiftTerm/iOS/iOSTerminalView.swift:2854 — TerminalView.sendKittyTextInput 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. This is NOT this file's highest cyclomatic complexity: TerminalView.kittyFunctionalKey (cyclomatic 75) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · analyze-time-profile.main (cyclomatic 24) · ×1
  • analyze-time-profile.main (cyclomatic 24) Tools/SwiftTermBenchmarks/analyze-time-profile.py:17 — analyze-time-profile.main 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 · KittyKeyboardEncoder.legacyFunctionalKeySequence (cyclomatic 23) · ×1
  • KittyKeyboardEncoder.legacyFunctionalKeySequence (cyclomatic 23) Sources/SwiftTerm/KittyKeyboardEncoder.swift:704 — KittyKeyboardEncoder.legacyFunctionalKeySequence has cyclomatic complexity 23 (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. This is NOT this file's highest cyclomatic complexity: KittyKeyboardEncoder.functionalEncoding (cyclomatic 109) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Terminal.cmdDeviceStatus (cyclomatic 23) · ×1
  • Terminal.cmdDeviceStatus (cyclomatic 23) Sources/SwiftTerm/Terminal.swift:6064 — Terminal.cmdDeviceStatus 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 · Terminal.handleKittyAnimationComposition (cyclomatic 23) · ×1
  • Terminal.handleKittyAnimationComposition (cyclomatic 23) Sources/SwiftTerm/KittyGraphics.swift:694 — Terminal.handleKittyAnimationComposition has cyclomatic complexity 23 (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 · Terminal.decodeKittyPayloadDetailed (cyclomatic 23) · ×1
  • Terminal.decodeKittyPayloadDetailed (cyclomatic 23) Sources/SwiftTerm/KittyGraphics.swift:982 — Terminal.decodeKittyPayloadDetailed 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 · TerminalBidi.computeVisualOrder (cyclomatic 23) · ×1
  • TerminalBidi.computeVisualOrder (cyclomatic 23) Sources/SwiftTerm/Apple/TerminalBidi.swift:251 — TerminalBidi.computeVisualOrder has cyclomatic complexity 23 (threshold 15). Of this number, 17 points are the body's own statements and 6 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 · TerminalView.mouseUp (cyclomatic 23) · ×1
  • TerminalView.mouseUp (cyclomatic 23) Sources/SwiftTerm/Mac/MacTerminalView.swift:4174 — TerminalView.mouseUp has cyclomatic complexity 23 (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. This is NOT this file's highest cyclomatic complexity: TerminalView.windowCommand (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · TerminalView.drawRunAttributes (cyclomatic 23) · ×1
  • TerminalView.drawRunAttributes (cyclomatic 23) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3038 — TerminalView.drawRunAttributes has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 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 · Color.parseColor (cyclomatic 22) · ×1
  • Color.parseColor (cyclomatic 22) Sources/SwiftTerm/Colors.swift:403 — Color.parseColor has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 7 of the 22 points are its own statements and the rest belongs to 2 function items inside it that branch (parseHex, makeColor). 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 · SelectionService.pathRange (cyclomatic 22) · ×1
  • SelectionService.pathRange (cyclomatic 22) Sources/SwiftTerm/SelectionService.swift:1377 — SelectionService.pathRange 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 · Terminal.visibleKittyPlaceholderPlacements (cyclomatic 22) · ×1
  • Terminal.visibleKittyPlaceholderPlacements (cyclomatic 22) Sources/SwiftTerm/Portable/TerminalKittyPlaceholders.swift:23 — Terminal.visibleKittyPlaceholderPlacements 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.
D1 · Cyclomatic Complexity · SnapshotTextBuilder.sameAttributes (cyclomatic 22) · ×1
  • SnapshotTextBuilder.sameAttributes (cyclomatic 22) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:988 — SnapshotTextBuilder.sameAttributes 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 · CaretView.drawCursor (cyclomatic 22) · ×1
  • CaretView.drawCursor (cyclomatic 22) Sources/SwiftTerm/Apple/CaretView.swift:14 — CaretView.drawCursor 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.
D1 · Cyclomatic Complexity · TerminalView.accessibilityAttributedDisplayTextLocked (cyclomatic 22) · ×1
  • TerminalView.accessibilityAttributedDisplayTextLocked (cyclomatic 22) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4025 — TerminalView.accessibilityAttributedDisplayTextLocked has cyclomatic complexity 22 (threshold 15). 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, 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 is NOT this file's highest cyclomatic complexity: TerminalView.kittyFunctionalKey (cyclomatic 75) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WasmGraphicsState.update (cyclomatic 22) · ×1
  • WasmGraphicsState.update (cyclomatic 22) Sources/SwiftTermWebWasm/GraphicsExports.swift:47 — WasmGraphicsState.update 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.
D1 · Cyclomatic Complexity · SnapshotTextBuilder.plainRow (cyclomatic 21) · ×1
  • SnapshotTextBuilder.plainRow (cyclomatic 21) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:770 — SnapshotTextBuilder.plainRow 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 · TerminalView.getAttributes (cyclomatic 21) · ×1
  • TerminalView.getAttributes (cyclomatic 21) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2667 — TerminalView.getAttributes 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 · ViewController.startBaselineFromLaunchArguments (cyclomatic 21) · ×1
  • ViewController.startBaselineFromLaunchArguments (cyclomatic 21) TerminalApp/MacTerminal/ViewController.swift:1418 — ViewController.startBaselineFromLaunchArguments 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 · KittyClipboardMetadata.parse (cyclomatic 20) · ×1
  • KittyClipboardMetadata.parse (cyclomatic 20) Sources/SwiftTerm/KittyClipboardProtocol.swift:561 — KittyClipboardMetadata.parse 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 · SearchEngine.match (cyclomatic 20) · ×1
  • SearchEngine.match (cyclomatic 20) Sources/SwiftTerm/SearchEngine.swift:301 — SearchEngine.match 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 · SixelDcsHandler.sizePixels (cyclomatic 20) · ×1
  • SixelDcsHandler.sizePixels (cyclomatic 20) Sources/SwiftTerm/SixelDcsHandler.swift:254 — SixelDcsHandler.sizePixels 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 · Terminal.parseSemanticPromptOptions (cyclomatic 20) · ×1
  • Terminal.parseSemanticPromptOptions (cyclomatic 20) Sources/SwiftTerm/Terminal.swift:3390 — Terminal.parseSemanticPromptOptions has cyclomatic complexity 20 (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 · Terminal.cmdEraseInDisplay (cyclomatic 20) · ×1
  • Terminal.cmdEraseInDisplay (cyclomatic 20) Sources/SwiftTerm/Terminal.swift:4464 — Terminal.cmdEraseInDisplay has cyclomatic complexity 20 (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 · Terminal.handleKittyAnimationControl (cyclomatic 20) · ×1
  • Terminal.handleKittyAnimationControl (cyclomatic 20) Sources/SwiftTerm/KittyGraphics.swift:643 — Terminal.handleKittyAnimationControl 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 · Terminal.readKittyFileData (cyclomatic 20) · ×1
  • Terminal.readKittyFileData (cyclomatic 20) Sources/SwiftTerm/KittyGraphics.swift:1429 — Terminal.readKittyFileData 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 · Terminal.insertRasterImage (cyclomatic 20) · ×1
  • Terminal.insertRasterImage (cyclomatic 20) Sources/SwiftTerm/Portable/TerminalRasterImage.swift:49 — Terminal.insertRasterImage has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to one function item inside it that branches. 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 · TerminalView.insertImage (cyclomatic 20) · ×1
  • TerminalView.insertImage (cyclomatic 20) Sources/SwiftTerm/Apple/AppleTerminalView.swift:4973 — TerminalView.insertImage has cyclomatic complexity 20 (threshold 15). Of this number, 16 points are the body's own statements and 4 belong to one function item inside it that branches. 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 · TerminalView.forwardWheel (cyclomatic 20) · ×1
  • TerminalView.forwardWheel (cyclomatic 20) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1273 — TerminalView.forwardWheel 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. This is NOT this file's highest cyclomatic complexity: TerminalView.kittyFunctionalKey (cyclomatic 75) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · HarnessViewController.runAssertions (cyclomatic 20) · ×1
  • HarnessViewController.runAssertions (cyclomatic 20) Tools/BidiHarness/BidiHarness/HarnessViewController.swift:711 — HarnessViewController.runAssertions has cyclomatic complexity 20 (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 · Buffer.semanticPromptInvariantsHold (cyclomatic 19) · ×1
  • Buffer.semanticPromptInvariantsHold (cyclomatic 19) Sources/SwiftTerm/Buffer.swift:1120 — Buffer.semanticPromptInvariantsHold 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 · KittyClipboardProtocol.handleRead (cyclomatic 19) · ×1
  • KittyClipboardProtocol.handleRead (cyclomatic 19) Sources/SwiftTerm/KittyClipboardProtocol.swift:1132 — KittyClipboardProtocol.handleRead 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 · KittyKeyboardEncoder.encodeCsiU (cyclomatic 19) · ×1
  • KittyKeyboardEncoder.encodeCsiU (cyclomatic 19) Sources/SwiftTerm/KittyKeyboardEncoder.swift:409 — KittyKeyboardEncoder.encodeCsiU 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 is NOT this file's highest cyclomatic complexity: KittyKeyboardEncoder.functionalEncoding (cyclomatic 109) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ProgramStatusReport.decodeText (cyclomatic 19) · ×1
  • ProgramStatusReport.decodeText (cyclomatic 19) Sources/SwiftTerm/ProgramStatus.swift:228 — ProgramStatusReport.decodeText has cyclomatic complexity 19 (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 · SixelDcsHandler.unhook (cyclomatic 19) · ×1
  • SixelDcsHandler.unhook (cyclomatic 19) Sources/SwiftTerm/SixelDcsHandler.swift:128 — SixelDcsHandler.unhook 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 · Terminal.scanUserInputForSubmission (cyclomatic 19) · ×1
  • Terminal.scanUserInputForSubmission (cyclomatic 19) Sources/SwiftTerm/Terminal.swift:2966 — Terminal.scanUserInputForSubmission 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 · Terminal.handleSemanticPromptClick (cyclomatic 19) · ×1
  • Terminal.handleSemanticPromptClick (cyclomatic 19) Sources/SwiftTerm/Terminal.swift:3319 — Terminal.handleSemanticPromptClick has cyclomatic complexity 19 (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 · Terminal.cmdSendDeviceAttributes (cyclomatic 19) · ×1
  • Terminal.cmdSendDeviceAttributes (cyclomatic 19) Sources/SwiftTerm/Terminal.swift:7099 — Terminal.cmdSendDeviceAttributes 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 · Terminal.scroll (cyclomatic 19) · ×1
  • Terminal.scroll (cyclomatic 19) Sources/SwiftTerm/Terminal.swift:8178 — Terminal.scroll 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 · Terminal.resolveKittyPlacementOrigin (cyclomatic 19) · ×1
  • Terminal.resolveKittyPlacementOrigin (cyclomatic 19) Sources/SwiftTerm/KittyGraphics.swift:1676 — Terminal.resolveKittyPlacementOrigin 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 · Terminal.kittyGraphicsRenderSnapshot (cyclomatic 19) · ×1
  • Terminal.kittyGraphicsRenderSnapshot (cyclomatic 19) Sources/SwiftTerm/KittyGraphics.swift:2596 — Terminal.kittyGraphicsRenderSnapshot 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 · UnicodeUtil.graphemeJoinNonEmojiModifier (cyclomatic 19) · ×1
  • UnicodeUtil.graphemeJoinNonEmojiModifier (cyclomatic 19) Sources/SwiftTerm/Utilities.swift:451 — UnicodeUtil.graphemeJoinNonEmojiModifier 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 · SnapshotTextBuilder.buildAttributes (cyclomatic 19) · ×1
  • SnapshotTextBuilder.buildAttributes (cyclomatic 19) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:302 — SnapshotTextBuilder.buildAttributes 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 · TerminalView.insertText (cyclomatic 19) · ×1
  • TerminalView.insertText (cyclomatic 19) Sources/SwiftTerm/Mac/MacTerminalView.swift:2762 — TerminalView.insertText 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 is NOT this file's highest cyclomatic complexity: TerminalView.windowCommand (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · MetalTerminalRenderer.glyphEntry (cyclomatic 19) · ×1
  • MetalTerminalRenderer.glyphEntry (cyclomatic 19) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3080 — MetalTerminalRenderer.glyphEntry 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 · InputExports.swift.terminalMouse (cyclomatic 19) · ×1
  • InputExports.swift.terminalMouse (cyclomatic 19) Sources/SwiftTermWebWasm/InputExports.swift:33 — InputExports.swift.terminalMouse 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 · InputExports.swift.terminalKey (cyclomatic 19) · ×1
  • InputExports.swift.terminalKey (cyclomatic 19) Sources/SwiftTermWebWasm/InputExports.swift:64 — InputExports.swift.terminalKey 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 · KittyFileTransfer.openFile (cyclomatic 19) · ×1
  • KittyFileTransfer.openFile (cyclomatic 19) TerminalApp/WebTerminal/Sources/WebTerminalServer/KittyFileTransfer.swift:236 — KittyFileTransfer.openFile 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 · TerminalInputController.wheel (cyclomatic 19) · ×1
  • TerminalInputController.wheel (cyclomatic 19) Web/src/input.ts:252 — TerminalInputController.wheel 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 252). 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 · Buffer.getLinesToRemove (cyclomatic 18) · ×1
  • Buffer.getLinesToRemove (cyclomatic 18) Sources/SwiftTerm/Buffer.swift:1288 — Buffer.getLinesToRemove 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 · EscapeSequenceParser.appendOscBytes (cyclomatic 18) · ×1
  • EscapeSequenceParser.appendOscBytes (cyclomatic 18) Sources/SwiftTerm/EscapeSequenceParser.swift:942 — EscapeSequenceParser.appendOscBytes has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (isProgramStatusOscAfterAppending, appendBytes, retainDroppedOscTail). 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. This is NOT this file's highest cyclomatic complexity: EscapeSequenceParser.dispatchOsc (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · KittyClipboardProtocol.selectForRead (cyclomatic 18) · ×1
  • KittyClipboardProtocol.selectForRead (cyclomatic 18) Sources/SwiftTerm/KittyClipboardProtocol.swift:1243 — KittyClipboardProtocol.selectForRead 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 · KittyKeyboardEncoder.encodeFunctionalKey (cyclomatic 18) · ×1
  • KittyKeyboardEncoder.encodeFunctionalKey (cyclomatic 18) Sources/SwiftTerm/KittyKeyboardEncoder.swift:342 — KittyKeyboardEncoder.encodeFunctionalKey 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. This is NOT this file's highest cyclomatic complexity: KittyKeyboardEncoder.functionalEncoding (cyclomatic 109) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Terminal.applyDECPrivateMode (cyclomatic 18) · ×1
  • Terminal.applyDECPrivateMode (cyclomatic 18) Sources/SwiftTerm/Terminal.swift:5689 — Terminal.applyDECPrivateMode 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 · Terminal.decodePngToRgba (cyclomatic 18) · ×1
  • Terminal.decodePngToRgba (cyclomatic 18) Sources/SwiftTerm/KittyGraphics.swift:1091 — Terminal.decodePngToRgba 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 · PowerlineRenderer.path (cyclomatic 18) · ×1
  • PowerlineRenderer.path (cyclomatic 18) Sources/SwiftTerm/Apple/PowerlineRenderer.swift:124 — PowerlineRenderer.path has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. 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. This is NOT this file's highest cyclomatic complexity: PowerlineRenderer.glyph (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · TerminalView.validateUserInterfaceItem (cyclomatic 18) · ×1
  • TerminalView.validateUserInterfaceItem (cyclomatic 18) Sources/SwiftTerm/Mac/MacTerminalView.swift:3521 — TerminalView.validateUserInterfaceItem 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. This is NOT this file's highest cyclomatic complexity: TerminalView.windowCommand (cyclomatic 30) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · MetalTerminalRenderer.preparePlainRow (cyclomatic 18) · ×1
  • MetalTerminalRenderer.preparePlainRow (cyclomatic 18) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2326 — MetalTerminalRenderer.preparePlainRow 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 · Table.canChange (cyclomatic 18) · ×1
  • Table.canChange (cyclomatic 18) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift:200 — Table.canChange 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 · regen_unicode_width_data.terminal_width (cyclomatic 18) · ×1
  • regen_unicode_width_data.terminal_width (cyclomatic 18) scripts/regen_unicode_width_data.py:308 — regen_unicode_width_data.terminal_width 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 · TerminalInputController.pointerMove (cyclomatic 18) · ×1
  • TerminalInputController.pointerMove (cyclomatic 18) Web/src/input.ts:186 — TerminalInputController.pointerMove has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 186). 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 · KittyClipboardProtocol.commitWrite (cyclomatic 17) · ×1
  • KittyClipboardProtocol.commitWrite (cyclomatic 17) Sources/SwiftTerm/KittyClipboardProtocol.swift:1467 — KittyClipboardProtocol.commitWrite 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 · Terminal.handleKittyKeyboardProtocol (cyclomatic 17) · ×1
  • Terminal.handleKittyKeyboardProtocol (cyclomatic 17) Sources/SwiftTerm/Terminal.swift:1490 — Terminal.handleKittyKeyboardProtocol has cyclomatic complexity 17 (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 · SnapshotTextBuilder.plainStyle (cyclomatic 17) · ×1
  • SnapshotTextBuilder.plainStyle (cyclomatic 17) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:840 — SnapshotTextBuilder.plainStyle 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 · TerminalBidi.explicitRightToLeftLayout (cyclomatic 17) · ×1
  • TerminalBidi.explicitRightToLeftLayout (cyclomatic 17) Sources/SwiftTerm/Apple/TerminalBidi.swift:1013 — TerminalBidi.explicitRightToLeftLayout has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 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 · TerminalAccessory.setupUI (cyclomatic 17) · ×1
  • TerminalAccessory.setupUI (cyclomatic 17) Sources/SwiftTerm/iOS/iOSAccessoryView.swift:187 — TerminalAccessory.setupUI has cyclomatic complexity 17 (threshold 15). Of this number, 13 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 · TerminalView.panSelectionHandler (cyclomatic 17) · ×1
  • TerminalView.panSelectionHandler (cyclomatic 17) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1397 — TerminalView.panSelectionHandler has cyclomatic complexity 17 (threshold 15). Of this number, 16 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. This is NOT this file's highest cyclomatic complexity: TerminalView.kittyFunctionalKey (cyclomatic 75) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ArtifactCapture.captureWindow (cyclomatic 17) · ×1
  • ArtifactCapture.captureWindow (cyclomatic 17) Tools/BidiHarness/BidiHarness/ArtifactCapture.swift:55 — ArtifactCapture.captureWindow 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 · WasmRuntime.constructor (cyclomatic 17) · ×1
  • WasmRuntime.constructor (cyclomatic 17) Web/src/loader.ts:32 — WasmRuntime.constructor 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 · Buffer.semanticRowKind (cyclomatic 16) · ×1
  • Buffer.semanticRowKind (cyclomatic 16) Sources/SwiftTerm/Buffer.swift:568 — Buffer.semanticRowKind 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 · Attribute.toSgr (cyclomatic 16) · ×1
  • Attribute.toSgr (cyclomatic 16) Sources/SwiftTerm/CharData.swift:135 — Attribute.toSgr 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 · KittyClipboardBase64Decoder.append (cyclomatic 16) · ×1
  • KittyClipboardBase64Decoder.append (cyclomatic 16) Sources/SwiftTerm/KittyClipboardProtocol.swift:460 — KittyClipboardBase64Decoder.append 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 · SixelDcsHandler.readPixels (cyclomatic 16) · ×1
  • SixelDcsHandler.readPixels (cyclomatic 16) Sources/SwiftTerm/SixelDcsHandler.swift:306 — SixelDcsHandler.readPixels 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 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 · Terminal.decompressZlib (cyclomatic 16) · ×1
  • Terminal.decompressZlib (cyclomatic 16) Sources/SwiftTerm/KittyGraphics.swift:2708 — Terminal.decompressZlib 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 · TerminalRenderOwner.prepareFrame (cyclomatic 16) · ×1
  • TerminalRenderOwner.prepareFrame (cyclomatic 16) Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:513 — TerminalRenderOwner.prepareFrame 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 · TerminalView.singleTap (cyclomatic 16) · ×1
  • TerminalView.singleTap (cyclomatic 16) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1031 — TerminalView.singleTap 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. This is NOT this file's highest cyclomatic complexity: TerminalView.kittyFunctionalKey (cyclomatic 75) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · GlyphAtlas.write (cyclomatic 16) · ×1
  • GlyphAtlas.write (cyclomatic 16) Sources/SwiftTerm/Apple/Metal/GlyphAtlas.swift:168 — GlyphAtlas.write has cyclomatic complexity 16 (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 · ServerConfiguration.init (cyclomatic 16) · ×1
  • ServerConfiguration.init (cyclomatic 16) TerminalApp/WebTerminal/Sources/WebTerminalServer/ServerConfiguration.swift:18 — ServerConfiguration.init 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 · ViewController.runMetalToggleScenario (cyclomatic 16) · ×1
  • ViewController.runMetalToggleScenario (cyclomatic 16) TerminalApp/MacTerminal/ViewController.swift:888 — ViewController.runMetalToggleScenario has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 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 · ClipboardController.accept (cyclomatic 16) · ×1
  • ClipboardController.accept (cyclomatic 16) TerminalApp/WebTerminal/Public/clipboard.js:75 — ClipboardController.accept 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 · show (cyclomatic 16) · ×1
  • show (cyclomatic 16) TerminalApp/WebTerminal/Public/clipboard.js:105 — show 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.
D2 · Cognitive Complexity · TerminalView.drawTerminalContents (cognitive 242) · ×1
  • TerminalView.drawTerminalContents (cognitive 242) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3297 — TerminalView.drawTerminalContents has cognitive complexity 242 (threshold 15). Drivers by points: if/else 57 (148 pts), loops 15 (42 pts), ternaries 6 (27 pts), boolean chains 21, match/switch 2 (4 pts) (nesting depth added 141). Of this number, 222 points are the body's own statements and 20 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 · EscapeSequenceParser.parseBorrowed (cognitive 210) · ×1
  • EscapeSequenceParser.parseBorrowed (cognitive 210) Sources/SwiftTerm/EscapeSequenceParser.swift:1090 — EscapeSequenceParser.parseBorrowed has cognitive complexity 210 (threshold 15). Drivers by points: if/else 56 (142 pts), ternaries 10 (37 pts), boolean chains 21, match/switch 2 (6 pts), loops 3 (4 pts) (nesting depth added 118). Of this number, 205 points are the body's own statements and 5 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 · TerminalView.pressesBegan (cognitive 183) · ×1
  • TerminalView.pressesBegan (cognitive 183) Sources/SwiftTerm/iOS/iOSTerminalView.swift:3234 — TerminalView.pressesBegan has cognitive complexity 183 (threshold 15). Drivers by points: if/else 53 (130 pts), boolean chains 25, ternaries 7 (23 pts), loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 95). 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 · MetalTerminalRenderer.prepareRow (cognitive 154) · ×1
  • MetalTerminalRenderer.prepareRow (cognitive 154) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1920 — MetalTerminalRenderer.prepareRow has cognitive complexity 154 (threshold 15). Drivers by points: if/else 27 (74 pts), ternaries 8 (41 pts), loops 11 (24 pts), boolean chains 15 (nesting depth added 93). Of this number, 151 points are the body's own statements and 3 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 · Terminal.handlePrintSlow (cognitive 142) · ×1
  • Terminal.handlePrintSlow (cognitive 142) Sources/SwiftTerm/Terminal.swift:1991 — Terminal.handlePrintSlow has cognitive complexity 142 (threshold 15). Drivers by points: if/else 64 (143 pts), boolean chains 35, ternaries 8 (19 pts), loops 9 (18 pts) (nesting depth added 99). 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 (Terminal.handlePrintSlow::batchableScalar, Terminal.handlePrintSlow::insertScalarBatch) 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 · TerminalView.keyDown (cognitive 142) · ×1
  • TerminalView.keyDown (cognitive 142) Sources/SwiftTerm/Mac/MacTerminalView.swift:2318 — TerminalView.keyDown has cognitive complexity 142 (threshold 15). Drivers by points: if/else 41 (76 pts), boolean chains 38, match/switch 4 (14 pts), ternaries 6 (14 pts) (nesting depth added 53). 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 · TerminalIOPipelineWorker.gatherMain (cognitive 127) · ×1
  • TerminalIOPipelineWorker.gatherMain (cognitive 127) Sources/SwiftTerm/TerminalIOPipeline.swift:559 — TerminalIOPipelineWorker.gatherMain has cognitive complexity 127 (threshold 15). Drivers by points: if/else 30 (106 pts), match/switch 3 (9 pts), loops 4 (7 pts), boolean chains 5 (nesting depth added 85). 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 · SnapshotTextBuilder.buildAttributedString (cognitive 124) · ×1
  • SnapshotTextBuilder.buildAttributedString (cognitive 124) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:449 — SnapshotTextBuilder.buildAttributedString has cognitive complexity 124 (threshold 15). Drivers by points: if/else 37 (85 pts), boolean chains 35, ternaries 1 (3 pts), loops 1 (nesting depth added 50). Of this number, 122 points are the body's own statements and 2 belong to one function item 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 · Terminal.cmdDecRqm (cognitive 104) · ×1
  • Terminal.cmdDecRqm (cognitive 104) Sources/SwiftTerm/Terminal.swift:5769 — Terminal.cmdDecRqm has cognitive complexity 104 (threshold 15). Drivers by points: ternaries 31 (93 pts), if/else 7, match/switch 2 (4 pts) (nesting depth added 64). 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 · MetalTerminalRenderer.placeRow (cognitive 102) · ×1
  • MetalTerminalRenderer.placeRow (cognitive 102) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2478 — MetalTerminalRenderer.placeRow has cognitive complexity 102 (threshold 15). Drivers by points: if/else 25 (62 pts), loops 10 (16 pts), boolean chains 12, match/switch 4 (6 pts), ternaries 2 (6 pts) (nesting depth added 49). Of this number, 101 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 · HarnessViewController.execute (cognitive 96) · ×1
  • HarnessViewController.execute (cognitive 96) Tools/BidiHarness/BidiHarness/HarnessViewController.swift:245 — HarnessViewController.execute has cognitive complexity 96 (threshold 15). Drivers by points: if/else 34 (66 pts), boolean chains 22, loops 2 (5 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 36). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TerminalView.doCommand (cognitive 85) · ×1
  • TerminalView.doCommand (cognitive 85) Sources/SwiftTerm/Mac/MacTerminalView.swift:2633 — TerminalView.doCommand has cognitive complexity 85 (threshold 15). Drivers by points: if/else 31 (71 pts), ternaries 5 (10 pts), match/switch 2 (3 pts), boolean chains 1 (nesting depth added 46). 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 · Terminal.makeRenderSnapshot (cognitive 73) · ×1
  • Terminal.makeRenderSnapshot (cognitive 73) Sources/SwiftTerm/Terminal.swift:7815 — Terminal.makeRenderSnapshot has cognitive complexity 73 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 20, ternaries 5 (16 pts), loops 3 (7 pts), match/switch 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.
D2 · Cognitive Complexity · Terminal.parseKittyGraphicsControl (cognitive 69) · ×1
  • Terminal.parseKittyGraphicsControl (cognitive 69) Sources/SwiftTerm/KittyGraphics.swift:331 — Terminal.parseKittyGraphicsControl has cognitive complexity 69 (threshold 15). Drivers by points: if/else 18 (42 pts), boolean chains 21, ternaries 4 (5 pts), loops 1 (nesting depth added 25). Of this number, 57 points are the body's own statements and 12 belong to 3 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 · Buffer.resize (cognitive 68) · ×1
  • Buffer.resize (cognitive 68) Sources/SwiftTerm/Buffer.swift:946 — Buffer.resize has cognitive complexity 68 (threshold 15). Drivers by points: if/else 23 (51 pts), loops 6 (16 pts), boolean chains 1 (nesting depth added 38). 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 · Buffer.reflowNarrower (cognitive 66) · ×1
  • Buffer.reflowNarrower (cognitive 66) Sources/SwiftTerm/Buffer.swift:1521 — Buffer.reflowNarrower has cognitive complexity 66 (threshold 15). Drivers by points: if/else 18 (46 pts), loops 8 (16 pts), boolean chains 4 (nesting depth added 36). 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 · Terminal.csiCopyRectangularArea (cognitive 65) · ×1
  • Terminal.csiCopyRectangularArea (cognitive 65) Sources/SwiftTerm/Terminal.swift:4864 — Terminal.csiCopyRectangularArea has cognitive complexity 65 (threshold 15). Drivers by points: if/else 6 (21 pts), loops 4 (18 pts), ternaries 8 (16 pts), boolean chains 10 (nesting depth added 37). 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 · KittyKeyboardEncoder.encode (cognitive 64) · ×1
  • KittyKeyboardEncoder.encode (cognitive 64) Sources/SwiftTerm/KittyKeyboardEncoder.swift:168 — KittyKeyboardEncoder.encode has cognitive complexity 64 (threshold 15). Drivers by points: boolean chains 32, if/else 16 (28 pts), match/switch 2 (4 pts) (nesting depth added 14). 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 · BoxDrawingRenderer.swift.linesChar (cognitive 64) · ×1
  • BoxDrawingRenderer.swift.linesChar (cognitive 64) Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:248 — BoxDrawingRenderer.swift.linesChar has cognitive complexity 64 (threshold 15). Drivers by points: if/else 24 (28 pts), boolean chains 16, ternaries 8 (16 pts), match/switch 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.
D2 · Cognitive Complexity · ProgramStatusReport.parse (cognitive 59) · ×1
  • ProgramStatusReport.parse (cognitive 59) Sources/SwiftTerm/ProgramStatus.swift:139 — ProgramStatusReport.parse has cognitive complexity 59 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 10, ternaries 4 (8 pts), match/switch 2 (4 pts), 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 · TerminalSnapshot.refresh (cognitive 59) · ×1
  • TerminalSnapshot.refresh (cognitive 59) Sources/SwiftTerm/Apple/TerminalSnapshot.swift:338 — TerminalSnapshot.refresh has cognitive complexity 59 (threshold 15). Drivers by points: if/else 18 (29 pts), boolean chains 18, loops 4 (6 pts), match/switch 1 (4 pts), ternaries 1 (2 pts) (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.
D2 · Cognitive Complexity · KittyFileTransfer.convert (cognitive 58) · ×1
  • KittyFileTransfer.convert (cognitive 58) TerminalApp/WebTerminal/Sources/WebTerminalServer/KittyFileTransfer.swift:135 — KittyFileTransfer.convert has cognitive complexity 58 (threshold 15). Drivers by points: boolean chains 24, if/else 12 (24 pts), loops 4 (6 pts), ternaries 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.
D2 · Cognitive Complexity · ViewController.validateUserInterfaceItem (cognitive 58) · ×1
  • ViewController.validateUserInterfaceItem (cognitive 58) TerminalApp/MacTerminal/ViewController.swift:653 — ViewController.validateUserInterfaceItem has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (31 pts), ternaries 9 (27 pts) (nesting depth added 28). 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 · SnapshotEncoder.encode (cognitive 55) · ×1
  • SnapshotEncoder.encode (cognitive 55) Sources/SwiftTermWebWasm/SnapshotEncoder.swift:41 — SnapshotEncoder.encode has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 13, ternaries 4 (7 pts), loops 4 (6 pts), match/switch 2 (5 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 · MetalTerminalRenderer.buildCursorDrawData (cognitive 54) · ×1
  • MetalTerminalRenderer.buildCursorDrawData (cognitive 54) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3931 — MetalTerminalRenderer.buildCursorDrawData has cognitive complexity 54 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 6 (12 pts), match/switch 3 (8 pts), boolean chains 7, loops 2 (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 · TerminalBidi.shapeArabic (cognitive 52) · ×1
  • TerminalBidi.shapeArabic (cognitive 52) Sources/SwiftTerm/Apple/TerminalBidi.swift:348 — TerminalBidi.shapeArabic has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 18, if/else 10 (17 pts), loops 5 (11 pts), ternaries 2 (6 pts) (nesting depth added 17). Of this number, 43 points are the body's own statements and 9 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 · Terminal.scrollGeneral (cognitive 51) · ×1
  • Terminal.scrollGeneral (cognitive 51) Sources/SwiftTerm/Terminal.swift:8238 — Terminal.scrollGeneral has cognitive complexity 51 (threshold 15). Drivers by points: if/else 22 (35 pts), boolean chains 8, ternaries 2 (6 pts), loops 1 (2 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 · ClipboardController.run (cognitive 51) · ×1
  • ClipboardController.run (cognitive 51) TerminalApp/WebTerminal/Public/clipboard.js:122 — ClipboardController.run has cognitive complexity 51 (threshold 15). Drivers by points: if/else 17 (28 pts), ternaries 4 (14 pts), loops 2 (5 pts), boolean chains 3, error handling 1 (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.
D2 · Cognitive Complexity · TerminalBidi.buildParagraph (cognitive 50) · ×1
  • TerminalBidi.buildParagraph (cognitive 50) Sources/SwiftTerm/Apple/TerminalBidi.swift:672 — TerminalBidi.buildParagraph has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 7 (15 pts), boolean chains 11, ternaries 1 (nesting depth added 20). Of this number, 40 points are the body's own statements and 10 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 · TerminalView.scrollWheel (cognitive 50) · ×1
  • TerminalView.scrollWheel (cognitive 50) Sources/SwiftTerm/Mac/MacTerminalView.swift:4617 — TerminalView.scrollWheel has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (27 pts), ternaries 7 (16 pts), loops 2 (4 pts), boolean chains 3 (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 · snapshot.decodeSnapshot (cognitive 47) · ×1
  • snapshot.decodeSnapshot (cognitive 47) Web/src/snapshot.ts:6 — snapshot.decodeSnapshot has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 21, if/else 14 (19 pts), error handling 1 (4 pts), loops 2 (3 pts) (nesting depth added 9). Of this number, 40 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 · Terminal.kittyGraphicsAdvanceAnimations (cognitive 46) · ×1
  • Terminal.kittyGraphicsAdvanceAnimations (cognitive 46) Sources/SwiftTerm/KittyGraphics.swift:2485 — Terminal.kittyGraphicsAdvanceAnimations has cognitive complexity 46 (threshold 15). Drivers by points: if/else 12 (33 pts), boolean chains 9, loops 2 (4 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 · Table.canChange (cognitive 46) · ×1
  • Table.canChange (cognitive 46) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift:200 — Table.canChange has cognitive complexity 46 (threshold 15). Drivers by points: if/else 7 (22 pts), loops 8 (22 pts), boolean chains 1, error handling 1 (nesting depth added 29). 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 · analyze-time-profile.main (cognitive 45) · ×1
  • analyze-time-profile.main (cognitive 45) Tools/SwiftTermBenchmarks/analyze-time-profile.py:17 — analyze-time-profile.main has cognitive complexity 45 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 4 (12 pts), loops 6 (11 pts), boolean chains 4, error handling 1 (2 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 · KittyFileTransfer.receive (cognitive 44) · ×1
  • KittyFileTransfer.receive (cognitive 44) TerminalApp/WebTerminal/Sources/WebTerminalServer/KittyFileTransfer.swift:56 — KittyFileTransfer.receive has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 10, match/switch 1 (2 pts), loops 1 (nesting depth added 16). Of this number, 43 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 · events.decodeEvent (cognitive 44) · ×1
  • events.decodeEvent (cognitive 44) Web/src/events.ts:4 — events.decodeEvent has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 12, error handling 2 (3 pts), ternaries 2 (3 pts), match/switch 1 (nesting depth added 13). Of this number, 38 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 · Terminal.osciTerm2 (cognitive 43) · ×1
  • Terminal.osciTerm2 (cognitive 43) Sources/SwiftTerm/Terminal.swift:3836 — Terminal.osciTerm2 has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 12, ternaries 1 (2 pts), loops 1, match/switch 1 (nesting depth added 10). Of this number, 19 points are the body's own statements and 24 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 · Terminal.implicitLinkMatch (cognitive 43) · ×1
  • Terminal.implicitLinkMatch (cognitive 43) Sources/SwiftTerm/Terminal.swift:9390 — Terminal.implicitLinkMatch has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 12, 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 · MetalTerminalRenderer.buildDrawDataPass (cognitive 41) · ×1
  • MetalTerminalRenderer.buildDrawDataPass (cognitive 41) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1681 — MetalTerminalRenderer.buildDrawDataPass has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (22 pts), match/switch 3 (8 pts), ternaries 2 (6 pts), boolean chains 4, 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 · SelectionService.urlRange (cognitive 39) · ×1
  • SelectionService.urlRange (cognitive 39) Sources/SwiftTerm/SelectionService.swift:1288 — SelectionService.urlRange has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 17, if/else 6 (12 pts), loops 6 (10 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 · SixelDcsHandler.sizePixels (cognitive 39) · ×1
  • SixelDcsHandler.sizePixels (cognitive 39) Sources/SwiftTerm/SixelDcsHandler.swift:254 — SixelDcsHandler.sizePixels has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (30 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (2 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 · Terminal.buildGhosttyImplicitLineMap (cognitive 39) · ×1
  • Terminal.buildGhosttyImplicitLineMap (cognitive 39) Sources/SwiftTerm/Terminal.swift:9629 — Terminal.buildGhosttyImplicitLineMap has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 13, loops 4 (5 pts), ternaries 1 (2 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 · MetalTerminalRenderer.render (cognitive 39) · ×1
  • MetalTerminalRenderer.render (cognitive 39) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1336 — MetalTerminalRenderer.render has cognitive complexity 39 (threshold 15). Drivers by points: if/else 30 (34 pts), boolean chains 4, ternaries 1 (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 · BufferLine.copyFrom (cognitive 38) · ×1
  • BufferLine.copyFrom (cognitive 38) Sources/SwiftTerm/BufferLine.swift:885 — BufferLine.copyFrom has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 14, loops 1 (2 pts), 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.
D2 · Cognitive Complexity · KittyClipboardBase64Decoder.append (cognitive 38) · ×1
  • KittyClipboardBase64Decoder.append (cognitive 38) Sources/SwiftTerm/KittyClipboardProtocol.swift:460 — KittyClipboardBase64Decoder.append has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (33 pts), match/switch 1 (4 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.
D2 · Cognitive Complexity · SelectionService.selectedColumns (cognitive 38) · ×1
  • SelectionService.selectedColumns (cognitive 38) Sources/SwiftTerm/SelectionService.swift:271 — SelectionService.selectedColumns has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (21 pts), ternaries 4 (11 pts), boolean chains 6 (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 · Terminal.handleKittyAnimationFrame (cognitive 38) · ×1
  • Terminal.handleKittyAnimationFrame (cognitive 38) Sources/SwiftTerm/KittyGraphics.swift:524 — Terminal.handleKittyAnimationFrame has cognitive complexity 38 (threshold 15). Drivers by points: if/else 14 (20 pts), ternaries 5 (10 pts), boolean chains 5, loops 1 (3 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 · TerminalBidi.computeVisualOrder (cognitive 38) · ×1
  • TerminalBidi.computeVisualOrder (cognitive 38) Sources/SwiftTerm/Apple/TerminalBidi.swift:251 — TerminalBidi.computeVisualOrder has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (19 pts), ternaries 2 (8 pts), loops 5 (7 pts), boolean chains 4 (nesting depth added 15). Of this number, 30 points are the body's own statements and 8 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 · Buffer.getLinesToRemove (cognitive 37) · ×1
  • Buffer.getLinesToRemove (cognitive 37) Sources/SwiftTerm/Buffer.swift:1288 — Buffer.getLinesToRemove has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 4 (7 pts), boolean chains 4 (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 · Terminal.scanUserInputForSubmission (cognitive 37) · ×1
  • Terminal.scanUserInputForSubmission (cognitive 37) Sources/SwiftTerm/Terminal.swift:2966 — Terminal.scanUserInputForSubmission has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (33 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (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 · TerminalView.drawRunAttributes (cognitive 37) · ×1
  • TerminalView.drawRunAttributes (cognitive 37) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3038 — TerminalView.drawRunAttributes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 3 (6 pts), match/switch 2 (5 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 18). Of this number, 19 points are the body's own statements and 18 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 · Buffer.semanticPromptInvariantsHold (cognitive 36) · ×1
  • Buffer.semanticPromptInvariantsHold (cognitive 36) Sources/SwiftTerm/Buffer.swift:1120 — Buffer.semanticPromptInvariantsHold has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (25 pts), loops 4 (7 pts), boolean chains 4 (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 · Terminal.displayKittyImage (cognitive 36) · ×1
  • Terminal.displayKittyImage (cognitive 36) Sources/SwiftTerm/KittyGraphics.swift:1567 — Terminal.displayKittyImage has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 12, ternaries 4 (6 pts), loops 1 (2 pts), match/switch 1 (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 · Terminal.visibleKittyPlaceholderPlacements (cognitive 35) · ×1
  • Terminal.visibleKittyPlaceholderPlacements (cognitive 35) Sources/SwiftTerm/Portable/TerminalKittyPlaceholders.swift:23 — Terminal.visibleKittyPlaceholderPlacements has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 10, loops 2 (3 pts), ternaries 1 (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 · TerminalView.sendKittyTextInput (cognitive 35) · ×1
  • TerminalView.sendKittyTextInput (cognitive 35) Sources/SwiftTerm/iOS/iOSTerminalView.swift:2854 — TerminalView.sendKittyTextInput has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 10, ternaries 1 (2 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 · MetalTerminalRenderer.preparePlainRow (cognitive 35) · ×1
  • MetalTerminalRenderer.preparePlainRow (cognitive 35) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2326 — MetalTerminalRenderer.preparePlainRow has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (19 pts), ternaries 3 (9 pts), loops 4 (5 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · main.swift.top-level code (cognitive 35) · ×1
  • main.swift.top-level code (cognitive 35) Tools/RenderBench/Sources/RenderBench/main.swift:36 — main.swift.top-level code has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 7, loops 2 (3 pts), match/switch 1 (2 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 · connect (cognitive 35) · ×1
  • connect (cognitive 35) TerminalApp/WebTerminal/Public/app.js:66 — connect has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 7, ternaries 2 (4 pts), error handling 3, other 1 (nesting depth added 6). Most of this is not in the body itself: 7 of the 35 points are its own statements and the rest belongs to 14 function items inside it that branch (a function literal at line 117, shortcut, a function literal at line 139, …). 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 · KittyPlaceholderDecoder.decode (cognitive 34) · ×1
  • KittyPlaceholderDecoder.decode (cognitive 34) Sources/SwiftTerm/KittyPlaceholder.swift:48 — KittyPlaceholderDecoder.decode has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 15, if/else 11 (15 pts), match/switch 2 (3 pts), 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 · Terminal.oscSemanticPrompt (cognitive 34) · ×1
  • Terminal.oscSemanticPrompt (cognitive 34) Sources/SwiftTerm/Terminal.swift:3443 — Terminal.oscSemanticPrompt has cognitive complexity 34 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 6, match/switch 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 · Terminal.reverseIndex (cognitive 34) · ×1
  • Terminal.reverseIndex (cognitive 34) Sources/SwiftTerm/Terminal.swift:9080 — Terminal.reverseIndex has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 2 (8 pts), boolean chains 4, loops 1 (4 pts) (nesting depth added 19). 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 · Buffer.reflowWider (cognitive 33) · ×1
  • Buffer.reflowWider (cognitive 33) Sources/SwiftTerm/Buffer.swift:1390 — Buffer.reflowWider has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 4 (8 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 · CaretView.drawCursor (cognitive 33) · ×1
  • CaretView.drawCursor (cognitive 33) Sources/SwiftTerm/Apple/CaretView.swift:14 — CaretView.drawCursor has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 6, ternaries 1 (5 pts), loops 2 (4 pts), match/switch 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 · TerminalView.insertText (cognitive 33) · ×1
  • TerminalView.insertText (cognitive 33) Sources/SwiftTerm/Mac/MacTerminalView.swift:2762 — TerminalView.insertText has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 10 (nesting depth added 13). 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 · TerminalInputController.pointerDown (cognitive 33) · ×1
  • TerminalInputController.pointerDown (cognitive 33) Web/src/input.ts:149 — TerminalInputController.pointerDown has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 4 (9 pts), boolean chains 7, error handling 1 (nesting depth added 8). None of this is in the body itself: all 33 points belong to one function literal inside it that branches (line 149). 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 · TerminalInputController.wheel (cognitive 33) · ×1
  • TerminalInputController.wheel (cognitive 33) Web/src/input.ts:252 — TerminalInputController.wheel has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 8 (18 pts), if/else 7 (8 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 14). None of this is in the body itself: all 33 points belong to one function literal inside it that branches (line 252). 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 · Terminal.decodeKittyPayloadDetailed (cognitive 32) · ×1
  • Terminal.decodeKittyPayloadDetailed (cognitive 32) Sources/SwiftTerm/KittyGraphics.swift:982 — Terminal.decodeKittyPayloadDetailed has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 8, ternaries 1 (2 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 · SnapshotTextBuilder.plainRow (cognitive 32) · ×1
  • SnapshotTextBuilder.plainRow (cognitive 32) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:770 — SnapshotTextBuilder.plainRow has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 9, ternaries 1 (2 pts), loops 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 · Buffer.semanticRowKind (cognitive 31) · ×1
  • Buffer.semanticRowKind (cognitive 31) Sources/SwiftTerm/Buffer.swift:568 — Buffer.semanticRowKind has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (20 pts), ternaries 2 (8 pts), boolean chains 2, 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 · Terminal.kittyGraphicsRenderSnapshot (cognitive 31) · ×1
  • Terminal.kittyGraphicsRenderSnapshot (cognitive 31) Sources/SwiftTerm/KittyGraphics.swift:2596 — Terminal.kittyGraphicsRenderSnapshot has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, ternaries 2 (4 pts), loops 2, match/switch 1 (2 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 · TerminalView.panSelectionHandler (cognitive 31) · ×1
  • TerminalView.panSelectionHandler (cognitive 31) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1397 — TerminalView.panSelectionHandler has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 2, match/switch 1 (nesting depth added 15). Of this number, 30 points are the body's own statements and 1 belongs to one function item inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TerminalView.accessibilityAttributedDisplayTextLocked (cognitive 30) · ×1
  • TerminalView.accessibilityAttributedDisplayTextLocked (cognitive 30) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4025 — TerminalView.accessibilityAttributedDisplayTextLocked has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 3, boolean chains 2, ternaries 1 (2 pts), match/switch 1 (nesting depth added 10). Of this number, 28 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 · TerminalSession.run (cognitive 30) · ×1
  • TerminalSession.run (cognitive 30) TerminalApp/WebTerminal/Sources/WebTerminalServer/TerminalSession.swift:159 — TerminalSession.run has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (17 pts), match/switch 2 (6 pts), loops 2 (4 pts), boolean chains 2, error handling 1 (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 · SelectionService.adjustForInPlaceScroll (cognitive 29) · ×1
  • SelectionService.adjustForInPlaceScroll (cognitive 29) Sources/SwiftTerm/SelectionService.swift:74 — SelectionService.adjustForInPlaceScroll has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (18 pts), boolean chains 10, ternaries 1 (nesting depth added 3). Of this number, 25 points are the body's own statements and 4 belong to one function item 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 · Terminal.cmdWindowOptions (cognitive 29) · ×1
  • Terminal.cmdWindowOptions (cognitive 29) Sources/SwiftTerm/Terminal.swift:5208 — Terminal.cmdWindowOptions has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (28 pts), match/switch 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 · TerminalView.getAttributes (cognitive 29) · ×1
  • TerminalView.getAttributes (cognitive 29) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2667 — TerminalView.getAttributes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 6). 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 · WasmGraphicsState.update (cognitive 29) · ×1
  • WasmGraphicsState.update (cognitive 29) Sources/SwiftTermWebWasm/GraphicsExports.swift:47 — WasmGraphicsState.update has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 7 (8 pts), ternaries 3 (6 pts), boolean chains 5 (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 · KittyKeyboardEncoder.encodeCsiU (cognitive 28) · ×1
  • KittyKeyboardEncoder.encodeCsiU (cognitive 28) Sources/SwiftTerm/KittyKeyboardEncoder.swift:409 — KittyKeyboardEncoder.encodeCsiU has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 5, match/switch 1 (2 pts), ternaries 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 · SearchEngine.match (cognitive 28) · ×1
  • SearchEngine.match (cognitive 28) Sources/SwiftTerm/SearchEngine.swift:301 — SearchEngine.match has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, loops 2 (3 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 · SixelDcsHandler.unhook (cognitive 28) · ×1
  • SixelDcsHandler.unhook (cognitive 28) Sources/SwiftTerm/SixelDcsHandler.swift:128 — SixelDcsHandler.unhook has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 5, loops 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 · Terminal.cmdEraseInDisplay (cognitive 28) · ×1
  • Terminal.cmdEraseInDisplay (cognitive 28) Sources/SwiftTerm/Terminal.swift:4464 — Terminal.cmdEraseInDisplay has cognitive complexity 28 (threshold 15). Drivers by points: loops 5 (13 pts), if/else 5 (7 pts), boolean chains 4, match/switch 2 (3 pts), ternaries 1 (nesting depth added 11). 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 · Terminal.sendHostMouse (cognitive 28) · ×1
  • Terminal.sendHostMouse (cognitive 28) Sources/SwiftTerm/Terminal.swift:9023 — Terminal.sendHostMouse has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (11 pts), ternaries 2 (3 pts), match/switch 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 · Attribute.toSgr (cognitive 27) · ×1
  • Attribute.toSgr (cognitive 27) Sources/SwiftTerm/CharData.swift:135 — Attribute.toSgr has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 4 (12 pts), match/switch 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 · Terminal.handleKittyDelete (cognitive 27) · ×1
  • Terminal.handleKittyDelete (cognitive 27) Sources/SwiftTerm/KittyGraphics.swift:848 — Terminal.handleKittyDelete has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 8, 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 · TerminalView.forwardWheel (cognitive 27) · ×1
  • TerminalView.forwardWheel (cognitive 27) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1273 — TerminalView.forwardWheel has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 4 (8 pts), boolean chains 3, loops 2 (3 pts), 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 · ViewController.startBaselineFromLaunchArguments (cognitive 27) · ×1
  • ViewController.startBaselineFromLaunchArguments (cognitive 27) TerminalApp/MacTerminal/ViewController.swift:1418 — ViewController.startBaselineFromLaunchArguments has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (20 pts), ternaries 2 (5 pts), boolean chains 2 (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 · KeyboardInputController.keydown (cognitive 27) · ×1
  • KeyboardInputController.keydown (cognitive 27) Web/src/keyboard.ts:136 — KeyboardInputController.keydown has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 5 (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 · KittyClipboardMetadata.parse (cognitive 26) · ×1
  • KittyClipboardMetadata.parse (cognitive 26) Sources/SwiftTerm/KittyClipboardProtocol.swift:561 — KittyClipboardMetadata.parse has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 4, 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 · Terminal.resolveKittyPlacementOrigin (cognitive 26) · ×1
  • Terminal.resolveKittyPlacementOrigin (cognitive 26) Sources/SwiftTerm/KittyGraphics.swift:1676 — Terminal.resolveKittyPlacementOrigin has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 5, 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 · TerminalView.mapColor (cognitive 26) · ×1
  • TerminalView.mapColor (cognitive 26) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2228 — TerminalView.mapColor has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 3 (9 pts), boolean chains 1, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TerminalView.updateFloatingCursor (cognitive 26) · ×1
  • TerminalView.updateFloatingCursor (cognitive 26) Sources/SwiftTerm/iOS/iOSTextInput.swift:467 — TerminalView.updateFloatingCursor has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 4 (14 pts), if/else 8 (12 pts) (nesting depth added 14). 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 · EscapeSequenceParser.dispatchEsc (cognitive 25) · ×1
  • EscapeSequenceParser.dispatchEsc (cognitive 25) Sources/SwiftTerm/EscapeSequenceParser.swift:692 — EscapeSequenceParser.dispatchEsc has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 5 (13 pts), if/else 10 (12 pts) (nesting depth added 10). 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SearchEngine.findPreviousWithSelection (cognitive 25) · ×1
  • SearchEngine.findPreviousWithSelection (cognitive 25) Sources/SwiftTerm/SearchEngine.swift:159 — SearchEngine.findPreviousWithSelection has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (5 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 · SnapshotTextBuilder.buildAttributes (cognitive 25) · ×1
  • SnapshotTextBuilder.buildAttributes (cognitive 25) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:302 — SnapshotTextBuilder.buildAttributes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 3 (6 pts), boolean chains 4 (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 · TerminalRenderOwner.prepareFrame (cognitive 25) · ×1
  • TerminalRenderOwner.prepareFrame (cognitive 25) Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:513 — TerminalRenderOwner.prepareFrame has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (17 pts), ternaries 3 (5 pts), boolean chains 3 (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 · GlyphAtlas.write (cognitive 25) · ×1
  • GlyphAtlas.write (cognitive 25) Sources/SwiftTerm/Apple/Metal/GlyphAtlas.swift:168 — GlyphAtlas.write has cognitive complexity 25 (threshold 15). Drivers by points: loops 11 (21 pts), match/switch 1 (2 pts), boolean chains 1, if/else 1 (nesting depth added 11). 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 · WasmRuntime.constructor (cognitive 25) · ×1
  • WasmRuntime.constructor (cognitive 25) Web/src/loader.ts:32 — WasmRuntime.constructor has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 4 (6 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 · Buffer.rearrange (cognitive 24) · ×1
  • Buffer.rearrange (cognitive 24) Sources/SwiftTerm/Buffer.swift:1662 — Buffer.rearrange has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3 (8 pts), boolean chains 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 · Buffer.insertCharacter (cognitive 24) · ×1
  • Buffer.insertCharacter (cognitive 24) Sources/SwiftTerm/Buffer.swift:1888 — Buffer.insertCharacter has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 3 (6 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 · EscapeSequenceParser.appendOscBytes (cognitive 24) · ×1
  • EscapeSequenceParser.appendOscBytes (cognitive 24) Sources/SwiftTerm/EscapeSequenceParser.swift:942 — EscapeSequenceParser.appendOscBytes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 2 (3 pts), loops 2, boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 8 of the 24 points are its own statements and the rest belongs to 3 function items inside it that branch (isProgramStatusOscAfterAppending, appendBytes, retainDroppedOscTail). 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.
D2 · Cognitive Complexity · SearchEngine.findNextWithSelection (cognitive 24) · ×1
  • SearchEngine.findNextWithSelection (cognitive 24) Sources/SwiftTerm/SearchEngine.swift:102 — SearchEngine.findNextWithSelection has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (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 · SelectionService.pathRange (cognitive 24) · ×1
  • SelectionService.pathRange (cognitive 24) Sources/SwiftTerm/SelectionService.swift:1377 — SelectionService.pathRange has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, loops 6 (7 pts), if/else 3 (5 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 · Terminal.cmdDeleteLines (cognitive 24) · ×1
  • Terminal.cmdDeleteLines (cognitive 24) Sources/SwiftTerm/Terminal.swift:7432 — Terminal.cmdDeleteLines has cognitive complexity 24 (threshold 15). Drivers by points: loops 4 (13 pts), if/else 4 (6 pts), boolean chains 4, ternaries 1 (nesting depth added 11). 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 · Terminal.handleKittyAnimationComposition (cognitive 24) · ×1
  • Terminal.handleKittyAnimationComposition (cognitive 24) Sources/SwiftTerm/KittyGraphics.swift:694 — Terminal.handleKittyAnimationComposition has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, if/else 10, ternaries 3 (4 pts) (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 · UnicodeUtil.graphemeJoinNonEmojiModifier (cognitive 24) · ×1
  • UnicodeUtil.graphemeJoinNonEmojiModifier (cognitive 24) Sources/SwiftTerm/Utilities.swift:451 — UnicodeUtil.graphemeJoinNonEmojiModifier has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 4 (8 pts), boolean chains 4 (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 · SnapshotTextBuilder.swift.mapColor (cognitive 24) · ×1
  • SnapshotTextBuilder.swift.mapColor (cognitive 24) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:1123 — SnapshotTextBuilder.swift.mapColor has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 3 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · EscapeSequenceParser.dispatchCsi (cognitive 23) · ×1
  • EscapeSequenceParser.dispatchCsi (cognitive 23) Sources/SwiftTerm/EscapeSequenceParser.swift:605 — EscapeSequenceParser.dispatchCsi has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · KittyKeyboardEncoder.encodeFunctionalKey (cognitive 23) · ×1
  • KittyKeyboardEncoder.encodeFunctionalKey (cognitive 23) Sources/SwiftTerm/KittyKeyboardEncoder.swift:342 — KittyKeyboardEncoder.encodeFunctionalKey has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, ternaries 2 (4 pts), match/switch 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 · Terminal.cmdDECRQCRA (cognitive 23) · ×1
  • Terminal.cmdDECRQCRA (cognitive 23) Sources/SwiftTerm/Terminal.swift:4981 — Terminal.cmdDECRQCRA has cognitive complexity 23 (threshold 15). Drivers by points: loops 3 (12 pts), ternaries 3 (7 pts), if/else 2 (3 pts), boolean chains 1 (nesting depth added 14). 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 · Terminal.cmdDeviceStatus (cognitive 23) · ×1
  • Terminal.cmdDeviceStatus (cognitive 23) Sources/SwiftTerm/Terminal.swift:6064 — Terminal.cmdDeviceStatus has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 4, match/switch 2 (4 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 · Terminal._getSelectedLines (cognitive 23) · ×1
  • Terminal._getSelectedLines (cognitive 23) Sources/SwiftTerm/Terminal.swift:10003 — Terminal._getSelectedLines has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 10). Of this number, 19 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 · Terminal.readKittyFileData (cognitive 23) · ×1
  • Terminal.readKittyFileData (cognitive 23) Sources/SwiftTerm/KittyGraphics.swift:1429 — Terminal.readKittyFileData has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, loops 1, ternaries 1 (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.
D2 · Cognitive Complexity · SnapshotTextBuilder.plainStyle (cognitive 23) · ×1
  • SnapshotTextBuilder.plainStyle (cognitive 23) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:840 — SnapshotTextBuilder.plainStyle has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 3 (6 pts), boolean chains 3 (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 · TerminalView.singleTap (cognitive 23) · ×1
  • TerminalView.singleTap (cognitive 23) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1031 — TerminalView.singleTap has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 3 (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 · Terminal.handleSemanticPromptClick (cognitive 22) · ×1
  • Terminal.handleSemanticPromptClick (cognitive 22) Sources/SwiftTerm/Terminal.swift:3319 — Terminal.handleSemanticPromptClick has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 10, match/switch 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 · Terminal.parseSemanticPromptOptions (cognitive 22) · ×1
  • Terminal.parseSemanticPromptOptions (cognitive 22) Sources/SwiftTerm/Terminal.swift:3390 — Terminal.parseSemanticPromptOptions has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 5 (14 pts), if/else 6 (7 pts), loops 1 (nesting depth added 10). 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Terminal.cmdInsertLines (cognitive 22) · ×1
  • Terminal.cmdInsertLines (cognitive 22) Sources/SwiftTerm/Terminal.swift:4603 — Terminal.cmdInsertLines has cognitive complexity 22 (threshold 15). Drivers by points: loops 4 (12 pts), if/else 4 (5 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 10). 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 · Terminal.cmdCharAttributes · ×1
  • Terminal.cmdCharAttributes::parseExtendedColor (cognitive 22) Sources/SwiftTerm/Terminal.swift:6290 — Terminal.cmdCharAttributes::parseExtendedColor has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), match/switch 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. This shape REPEATS in the file: one other method here (Terminal.cmdCharAttributes) 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 · Terminal.cmdSendDeviceAttributes (cognitive 22) · ×1
  • Terminal.cmdSendDeviceAttributes (cognitive 22) Sources/SwiftTerm/Terminal.swift:7099 — Terminal.cmdSendDeviceAttributes has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5, ternaries 1 (2 pts) (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.
D2 · Cognitive Complexity · SnapshotTextBuilder.sameAttributes (cognitive 22) · ×1
  • SnapshotTextBuilder.sameAttributes (cognitive 22) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:988 — SnapshotTextBuilder.sameAttributes has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 14, if/else 7 (8 pts) (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 · TerminalView.mouseUp (cognitive 22) · ×1
  • TerminalView.mouseUp (cognitive 22) Sources/SwiftTerm/Mac/MacTerminalView.swift:4174 — TerminalView.mouseUp has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, if/else 10. 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 · TerminalView.pressesEnded (cognitive 22) · ×1
  • TerminalView.pressesEnded (cognitive 22) Sources/SwiftTerm/iOS/iOSTerminalView.swift:3555 — TerminalView.pressesEnded has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 2, match/switch 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 · TerminalRowText.swift.terminalRowText (cognitive 22) · ×1
  • TerminalRowText.swift.terminalRowText (cognitive 22) Sources/SwiftTerm/TerminalRowText.swift:1 — TerminalRowText.swift.terminalRowText has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (4 pts), boolean chains 3, ternaries 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 · main.swift.top-level code (cognitive 22) · ×1
  • main.swift.top-level code (cognitive 22) Tools/SwiftTermBenchmarks/Sources/SwiftTermProfile/main.swift:50 — main.swift.top-level code has cognitive complexity 22 (threshold 15). Drivers by points: loops 6 (14 pts), if/else 7, ternaries 1 (nesting depth added 8). 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 · KittyClipboardProtocol.selectForRead (cognitive 21) · ×1
  • KittyClipboardProtocol.selectForRead (cognitive 21) Sources/SwiftTerm/KittyClipboardProtocol.swift:1243 — KittyClipboardProtocol.selectForRead has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, loops 1, match/switch 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 · SelectionService.updatePointerSelection (cognitive 21) · ×1
  • SelectionService.updatePointerSelection (cognitive 21) Sources/SwiftTerm/SelectionService.swift:1128 — SelectionService.updatePointerSelection has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, match/switch 1 (2 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 · Terminal.handleKittyAnimationControl (cognitive 21) · ×1
  • Terminal.handleKittyAnimationControl (cognitive 21) Sources/SwiftTerm/KittyGraphics.swift:643 — Terminal.handleKittyAnimationControl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, ternaries 2 (4 pts), match/switch 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 · Terminal.decompressZlib (cognitive 21) · ×1
  • Terminal.decompressZlib (cognitive 21) Sources/SwiftTerm/KittyGraphics.swift:2708 — Terminal.decompressZlib has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, error handling 1, 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 · TerminalIOPipelineWorker.parseMain (cognitive 21) · ×1
  • TerminalIOPipelineWorker.parseMain (cognitive 21) Sources/SwiftTerm/TerminalIOPipeline.swift:473 — TerminalIOPipelineWorker.parseMain has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 3, loops 2 (3 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 · TerminalBidi.explicitRightToLeftLayout (cognitive 21) · ×1
  • TerminalBidi.explicitRightToLeftLayout (cognitive 21) Sources/SwiftTerm/Apple/TerminalBidi.swift:1013 — TerminalBidi.explicitRightToLeftLayout has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 4). Of this number, 14 points are the body's own statements and 7 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 · TerminalView.flagsChanged (cognitive 21) · ×1
  • TerminalView.flagsChanged (cognitive 21) Sources/SwiftTerm/Mac/MacTerminalView.swift:2158 — TerminalView.flagsChanged has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4, ternaries 1 (2 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 · PlainTextFont.shapesOneToOne (cognitive 21) · ×1
  • PlainTextFont.shapesOneToOne (cognitive 21) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift:92 — PlainTextFont.shapesOneToOne has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 2 (3 pts), ternaries 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 · HarnessViewController.runAssertions (cognitive 21) · ×1
  • HarnessViewController.runAssertions (cognitive 21) Tools/BidiHarness/BidiHarness/HarnessViewController.swift:711 — HarnessViewController.runAssertions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 3 (6 pts), boolean chains 5, loops 2 (5 pts), ternaries 2 (4 pts), match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Color.parseColor (cognitive 20) · ×1
  • Color.parseColor (cognitive 20) Sources/SwiftTerm/Colors.swift:403 — Color.parseColor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, match/switch 2 (3 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 2 function items inside it that branch (parseHex, makeColor). 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.
D2 · Cognitive Complexity · SearchLineCache.translateBufferLineToStringWithWrap (cognitive 20) · ×1
  • SearchLineCache.translateBufferLineToStringWithWrap (cognitive 20) Sources/SwiftTerm/SearchLineCache.swift:62 — SearchLineCache.translateBufferLineToStringWithWrap has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 5, ternaries 1 (2 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 · Terminal.reverseWrapBackward (cognitive 20) · ×1
  • Terminal.reverseWrapBackward (cognitive 20) Sources/SwiftTerm/Terminal.swift:4221 — Terminal.reverseWrapBackward has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, ternaries 2, 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 · Terminal.cmdCharAttributes (cognitive 20) · ×1
  • Terminal.cmdCharAttributes (cognitive 20) Sources/SwiftTerm/Terminal.swift:6226 — Terminal.cmdCharAttributes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19 (35 pts), match/switch 4 (7 pts), boolean chains 4, loops 2, ternaries 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 (Terminal.cmdCharAttributes::parseExtendedColor) 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 · Terminal.decodePngToRgba (cognitive 20) · ×1
  • Terminal.decodePngToRgba (cognitive 20) Sources/SwiftTerm/KittyGraphics.swift:1091 — Terminal.decodePngToRgba has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 3). 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 · Table.subtableCanApply (cognitive 20) · ×1
  • Table.subtableCanApply (cognitive 20) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift:255 — Table.subtableCanApply has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (7 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. 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. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · regen_unicode_width_data.terminal_width (cognitive 20) · ×1
  • regen_unicode_width_data.terminal_width (cognitive 20) scripts/regen_unicode_width_data.py:308 — regen_unicode_width_data.terminal_width has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (17 pts), ternaries 1 (2 pts), 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.
D2 · Cognitive Complexity · KeyboardInputController.normalize (cognitive 20) · ×1
  • KeyboardInputController.normalize (cognitive 20) Web/src/keyboard.ts:114 — KeyboardInputController.normalize has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (9 pts), ternaries 2 (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 · TerminalInputController.pointerMove (cognitive 20) · ×1
  • TerminalInputController.pointerMove (cognitive 20) Web/src/input.ts:186 — TerminalInputController.pointerMove has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, ternaries 1 (nesting depth added 3). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 186). 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 · CircularBufferLineList.shiftElements (cognitive 19) · ×1
  • CircularBufferLineList.shiftElements (cognitive 19) Sources/SwiftTerm/CircularList.swift:465 — CircularBufferLineList.shiftElements has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (7 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 · EscapeSequenceParser.consumeOscRun (cognitive 19) · ×1
  • EscapeSequenceParser.consumeOscRun (cognitive 19) Sources/SwiftTerm/EscapeSequenceParser.swift:1026 — EscapeSequenceParser.consumeOscRun has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 5, loops 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 · KittyClipboardProtocol.handleRead (cognitive 19) · ×1
  • KittyClipboardProtocol.handleRead (cognitive 19) Sources/SwiftTerm/KittyClipboardProtocol.swift:1132 — KittyClipboardProtocol.handleRead has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8, ternaries 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 · KittyClipboardProtocol.commitWrite (cognitive 19) · ×1
  • KittyClipboardProtocol.commitWrite (cognitive 19) Sources/SwiftTerm/KittyClipboardProtocol.swift:1467 — KittyClipboardProtocol.commitWrite has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, match/switch 1 (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 · ProgramStatusReport.decodeText (cognitive 19) · ×1
  • ProgramStatusReport.decodeText (cognitive 19) Sources/SwiftTerm/ProgramStatus.swift:228 — ProgramStatusReport.decodeText has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 pts), match/switch 1 (2 pts), loops 1 (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 · PseudoTerminalHelpers.fork (cognitive 19) · ×1
  • PseudoTerminalHelpers.fork (cognitive 19) Sources/SwiftTerm/Pty.swift:61 — PseudoTerminalHelpers.fork has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (16 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 · SelectionService.balancedSearchForward (cognitive 19) · ×1
  • SelectionService.balancedSearchForward (cognitive 19) Sources/SwiftTerm/SelectionService.swift:816 — SelectionService.balancedSearchForward has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 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 · SixelDcsHandler.readPixels (cognitive 19) · ×1
  • SixelDcsHandler.readPixels (cognitive 19) Sources/SwiftTerm/SixelDcsHandler.swift:306 — SixelDcsHandler.readPixels has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (5 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 7). 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 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 · Terminal.handleKittyKeyboardProtocol (cognitive 19) · ×1
  • Terminal.handleKittyKeyboardProtocol (cognitive 19) Sources/SwiftTerm/Terminal.swift:1490 — Terminal.handleKittyKeyboardProtocol has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (2 pts), ternaries 1 (2 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 · Terminal.garbageCollectPayload (cognitive 19) · ×1
  • Terminal.garbageCollectPayload (cognitive 19) Sources/SwiftTerm/Terminal.swift:7967 — Terminal.garbageCollectPayload has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (7 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 · Terminal.scroll (cognitive 19) · ×1
  • Terminal.scroll (cognitive 19) Sources/SwiftTerm/Terminal.swift:8178 — Terminal.scroll has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 2, ternaries 1 (2 pts) (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 · Terminal.removeOrphanedKittyPlacements (cognitive 19) · ×1
  • Terminal.removeOrphanedKittyPlacements (cognitive 19) Sources/SwiftTerm/KittyGraphics.swift:2216 — Terminal.removeOrphanedKittyPlacements has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 pts), ternaries 2 (5 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 · MetalTerminalRenderer.glyphEntry (cognitive 19) · ×1
  • MetalTerminalRenderer.glyphEntry (cognitive 19) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3080 — MetalTerminalRenderer.glyphEntry has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), match/switch 2, ternaries 2, boolean chains 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 · MetalTerminalRenderer.renderCustomGlyphBitmap (cognitive 19) · ×1
  • MetalTerminalRenderer.renderCustomGlyphBitmap (cognitive 19) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3294 — MetalTerminalRenderer.renderCustomGlyphBitmap has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 1 (2 pts), match/switch 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 · PlainTextFont.analyze (cognitive 19) · ×1
  • PlainTextFont.analyze (cognitive 19) Sources/SwiftTerm/Apple/Metal/PlainTextFont.swift:45 — PlainTextFont.analyze has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, 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 · InputExports.swift.terminalMouse (cognitive 19) · ×1
  • InputExports.swift.terminalMouse (cognitive 19) Sources/SwiftTermWebWasm/InputExports.swift:33 — InputExports.swift.terminalMouse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 7, ternaries 3, match/switch 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 · KittyFileTransfer.openFile (cognitive 19) · ×1
  • KittyFileTransfer.openFile (cognitive 19) TerminalApp/WebTerminal/Sources/WebTerminalServer/KittyFileTransfer.swift:236 — KittyFileTransfer.openFile has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (7 pts), loops 1 (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 · VTEBenchWorkloads.cursorMotion (cognitive 19) · ×1
  • VTEBenchWorkloads.cursorMotion (cognitive 19) Tools/SwiftTermBenchmarks/Sources/VTEBenchWorkloads/VTEBenchWorkload.swift:177 — VTEBenchWorkloads.cursorMotion has cognitive complexity 19 (threshold 15). Drivers by points: loops 6 (15 pts), if/else 1 (3 pts), boolean chains 1 (nesting depth added 11). 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 · Buffer.insertScalarRun (cognitive 18) · ×1
  • Buffer.insertScalarRun (cognitive 18) Sources/SwiftTerm/Buffer.swift:1847 — Buffer.insertScalarRun has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 3, boolean chains 1, 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 · CircularBufferLineList.shiftUpAndRecycle (cognitive 18) · ×1
  • CircularBufferLineList.shiftUpAndRecycle (cognitive 18) Sources/SwiftTerm/CircularList.swift:510 — CircularBufferLineList.shiftUpAndRecycle has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (6 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 · SelectionService.balancedSearchBackward (cognitive 18) · ×1
  • SelectionService.balancedSearchBackward (cognitive 18) Sources/SwiftTerm/SelectionService.swift:858 — SelectionService.balancedSearchBackward has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 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 · SelectionService.extendToWordBoundary (cognitive 18) · ×1
  • SelectionService.extendToWordBoundary (cognitive 18) Sources/SwiftTerm/SelectionService.swift:898 — SelectionService.extendToWordBoundary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, loops 2 (4 pts), match/switch 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 · TerminalView.mouseDragged (cognitive 18) · ×1
  • TerminalView.mouseDragged (cognitive 18) Sources/SwiftTerm/Mac/MacTerminalView.swift:4273 — TerminalView.mouseDragged has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 2 (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 · TerminalView.insertImage (cognitive 18) · ×1
  • TerminalView.insertImage (cognitive 18) Sources/SwiftTerm/Apple/AppleTerminalView.swift:4973 — TerminalView.insertImage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), match/switch 4 (5 pts), boolean chains 3, loops 1 (nesting depth added 3). Of this number, 17 points are the body's own statements and 1 belongs to one function item 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 · TerminalAccessory.setupUI (cognitive 18) · ×1
  • TerminalAccessory.setupUI (cognitive 18) Sources/SwiftTerm/iOS/iOSAccessoryView.swift:187 — TerminalAccessory.setupUI has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10, ternaries 4, boolean chains 2, loops 2. Of this number, 14 points are the body's own statements and 4 belong to 2 function items inside it that branch. 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 · main.swift.fuzzMe (cognitive 18) · ×1
  • main.swift.fuzzMe (cognitive 18) Sources/SwiftTermFuzz/main.swift:20 — main.swift.fuzzMe has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 2 (5 pts), match/switch 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 · InputExports.swift.terminalKey (cognitive 18) · ×1
  • InputExports.swift.terminalKey (cognitive 18) Sources/SwiftTermWebWasm/InputExports.swift:64 — InputExports.swift.terminalKey has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 5, ternaries 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 · ArtifactCapture.captureWindow (cognitive 18) · ×1
  • ArtifactCapture.captureWindow (cognitive 18) Tools/BidiHarness/BidiHarness/ArtifactCapture.swift:55 — ArtifactCapture.captureWindow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, ternaries 1 (2 pts) (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.
D2 · Cognitive Complexity · run-pty-benchmark.report_outliers (cognitive 18) · ×1
  • run-pty-benchmark.report_outliers (cognitive 18) Tools/run-pty-benchmark.py:241 — run-pty-benchmark.report_outliers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (6 pts), error handling 1 (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 · ByteRunScanner.firstC0OrByte (cognitive 17) · ×1
  • ByteRunScanner.firstC0OrByte (cognitive 17) Sources/SwiftTerm/ByteRunScanner.swift:143 — ByteRunScanner.firstC0OrByte has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), loops 4 (6 pts), boolean chains 3 (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 · SelectionService.logicalLineCells (cognitive 17) · ×1
  • SelectionService.logicalLineCells (cognitive 17) Sources/SwiftTerm/SelectionService.swift:1234 — SelectionService.logicalLineCells has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 2 (6 pts), loops 4 (5 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 · Terminal.cmdScrollDown (cognitive 17) · ×1
  • Terminal.cmdScrollDown (cognitive 17) Sources/SwiftTerm/Terminal.swift:7255 — Terminal.cmdScrollDown has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (9 pts), ternaries 3 (5 pts), if/else 3 (nesting depth added 7). 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: one other method here (Terminal.cmdScrollUp) 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 · Terminal.cmdScrollUp (cognitive 17) · ×1
  • Terminal.cmdScrollUp (cognitive 17) Sources/SwiftTerm/Terminal.swift:7310 — Terminal.cmdScrollUp has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (9 pts), ternaries 3 (5 pts), if/else 3 (nesting depth added 7). 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: one other method here (Terminal.cmdScrollDown) 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 · Terminal.seamContainsGhosttyImplicitLink (cognitive 17) · ×1
  • Terminal.seamContainsGhosttyImplicitLink (cognitive 17) Sources/SwiftTerm/Terminal.swift:9831 — Terminal.seamContainsGhosttyImplicitLink has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, loops 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 · Terminal.sendHostKey (cognitive 17) · ×1
  • Terminal.sendHostKey (cognitive 17) Sources/SwiftTerm/TerminalWebInput.swift:50 — Terminal.sendHostKey has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 6 (7 pts), boolean chains 2 (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 · accept (cognitive 17) · ×1
  • accept (cognitive 17) TerminalApp/WebTerminal/Public/clipboard.js:75 — accept has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, ternaries 3 (4 pts) (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.
D2 · Cognitive Complexity · show (cognitive 17) · ×1
  • show (cognitive 17) TerminalApp/WebTerminal/Public/clipboard.js:105 — show has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (7 pts), if/else 5, boolean chains 4, other 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.
D2 · Cognitive Complexity · BufferLine.setPackedScalarRun (cognitive 16) · ×1
  • BufferLine.setPackedScalarRun (cognitive 16) Sources/SwiftTerm/BufferLine.swift:430 — BufferLine.setPackedScalarRun has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 4, loops 2 (4 pts), ternaries 1 (nesting depth added 3). 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 · CellArena.synchronizeSnapshotPrefix (cognitive 16) · ×1
  • CellArena.synchronizeSnapshotPrefix (cognitive 16) Sources/SwiftTerm/CellStorage.swift:426 — CellArena.synchronizeSnapshotPrefix has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, loops 1 (2 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 · LocalProcess.startProcessWithForkpty (cognitive 16) · ×1
  • LocalProcess.startProcessWithForkpty (cognitive 16) Sources/SwiftTerm/LocalProcess.swift:580 — LocalProcess.startProcessWithForkpty has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), ternaries 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 · SelectionService.selectedContentIsUnchanged (cognitive 16) · ×1
  • SelectionService.selectedContentIsUnchanged (cognitive 16) Sources/SwiftTerm/SelectionService.swift:227 — SelectionService.selectedContentIsUnchanged has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 6, loops 1 (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 · SelectionService.shiftExtend (cognitive 16) · ×1
  • SelectionService.shiftExtend (cognitive 16) Sources/SwiftTerm/SelectionService.swift:544 — SelectionService.shiftExtend has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (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 · SelectionService.blockText (cognitive 16) · ×1
  • SelectionService.blockText (cognitive 16) Sources/SwiftTerm/SelectionService.swift:1076 — SelectionService.blockText has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (5 pts), loops 2 (3 pts), ternaries 1 (2 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 · Terminal.linkRowEdgeInfo (cognitive 16) · ×1
  • Terminal.linkRowEdgeInfo (cognitive 16) Sources/SwiftTerm/Terminal.swift:9781 — Terminal.linkRowEdgeInfo has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, loops 2 (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 · Terminal.insertRasterImage (cognitive 16) · ×1
  • Terminal.insertRasterImage (cognitive 16) Sources/SwiftTerm/Portable/TerminalRasterImage.swift:49 — Terminal.insertRasterImage has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 5, match/switch 2 (3 pts), loops 1 (nesting depth added 1). 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, 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 · TerminalBidi.detectedBaseDirection (cognitive 16) · ×1
  • TerminalBidi.detectedBaseDirection (cognitive 16) Sources/SwiftTerm/Apple/TerminalBidi.swift:622 — TerminalBidi.detectedBaseDirection has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (3 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 · TerminalRenderOwner.semanticPromptRow (cognitive 16) · ×1
  • TerminalRenderOwner.semanticPromptRow (cognitive 16) Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:440 — TerminalRenderOwner.semanticPromptRow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (4 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 · TerminalView.kittyClipboardSnapshot (cognitive 16) · ×1
  • TerminalView.kittyClipboardSnapshot (cognitive 16) Sources/SwiftTerm/Apple/AppleKittyClipboard.swift:157 — TerminalView.kittyClipboardSnapshot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, 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 · TerminalView.commitTextInput (cognitive 16) · ×1
  • TerminalView.commitTextInput (cognitive 16) Sources/SwiftTerm/iOS/iOSTerminalView.swift:2477 — TerminalView.commitTextInput has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, match/switch 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 · TerminalView.processPendingKoreanResyllabification (cognitive 16) · ×1
  • TerminalView.processPendingKoreanResyllabification (cognitive 16) Sources/SwiftTerm/iOS/iOSTerminalView.swift:2984 — TerminalView.processPendingKoreanResyllabification has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), loops 2 (4 pts), boolean chains 3, match/switch 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 · GlyphAtlas.ensureRegion (cognitive 16) · ×1
  • GlyphAtlas.ensureRegion (cognitive 16) Sources/SwiftTerm/Apple/Metal/GlyphAtlas.swift:124 — GlyphAtlas.ensureRegion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · ServerConfiguration.init (cognitive 16) · ×1
  • ServerConfiguration.init (cognitive 16) TerminalApp/WebTerminal/Sources/WebTerminalServer/ServerConfiguration.swift:18 — ServerConfiguration.init has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (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 · ViewController.runMetalToggleScenario (cognitive 16) · ×1
  • ViewController.runMetalToggleScenario (cognitive 16) TerminalApp/MacTerminal/ViewController.swift:888 — ViewController.runMetalToggleScenario has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6, ternaries 4, error handling 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 1). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 2 function items inside it that branch (flip, settleAndDraw). 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.
D2 · Cognitive Complexity · ViewController.runResizeFloodScenario (cognitive 16) · ×1
  • ViewController.runResizeFloodScenario (cognitive 16) TerminalApp/MacTerminal/ViewController.swift:1104 — ViewController.runResizeFloodScenario has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 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 · SocketControlServer.serve (cognitive 16) · ×1
  • SocketControlServer.serve (cognitive 16) Tools/BidiHarness/BidiHarness/SocketControlServer.swift:95 — SocketControlServer.serve has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 2 (4 pts), error handling 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 · analyze-cpu-counters.main (cognitive 16) · ×1
  • analyze-cpu-counters.main (cognitive 16) Tools/SwiftTermBenchmarks/analyze-cpu-counters.py:24 — analyze-cpu-counters.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 2, boolean chains 1 (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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (24 shared lines) · ×1
  • Near-duplicate member pair (24 shared lines) Sources/SwiftTerm/Terminal.swift:7255 — Sources/SwiftTerm/Terminal.swift:7255-7305 | Sources/SwiftTerm/Terminal.swift:7310-7360 — These two members are variants of one another: 24 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×1
  • Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3178 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:3178-3187 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3243-3252 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (21–25 lines × 2) · ×1
  • Duplicated block (21–25 lines × 2) Sources/SwiftTerm/CircularList.swift:172 — Sources/SwiftTerm/CircularList.swift:172-196 | Sources/SwiftTerm/CircularList.swift:465-485 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/CircularList.swift:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) Sources/SwiftTerm/Mac/MacCaretView.swift:61 — Sources/SwiftTerm/Mac/MacCaretView.swift:61-85 | Sources/SwiftTerm/iOS/iOSCaretView.swift:94-117 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×1
  • Duplicated block (23 lines × 2) Sources/SwiftTerm/CircularList.swift:129 — Sources/SwiftTerm/CircularList.swift:129-151 | Sources/SwiftTerm/CircularList.swift:411-433 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/CircularList.swift:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `items` to `[T]` in one and `[BufferLine]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/SwiftTerm/CircularList.swift:435` calls `lineAttached` and `Sources/SwiftTerm/CircularList.swift:152` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×1
  • Duplicated block (22 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3773 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:3773-3794 | Sources/SwiftTerm/Apple/CaretView.swift:115-136 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/AppleTerminalView.swift:3773` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:5089 — Sources/SwiftTerm/Mac/MacTerminalView.swift:5089-5108 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3873-3892 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×1
  • Duplicated block (19 lines × 2) Sources/SwiftTerm/Profiling.swift:79 — Sources/SwiftTerm/Profiling.swift:79-97 | Sources/SwiftTerm/Profiling.swift:100-118 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×1
  • Duplicated block (17–18 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3051 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:3051-3068 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4567-4583 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×1
  • Duplicated block (18 lines × 2) Sources/SwiftTerm/iOS/iOSTerminalView.swift:3290 — Sources/SwiftTerm/iOS/iOSTerminalView.swift:3290-3307 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3336-3353 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/iOS/iOSTerminalView.swift:3290` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (4–17 lines × 3) · ×1
  • Duplicated block (4–17 lines × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2541 — Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2541-2544 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4432-4448 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4586-4602 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4432` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4448` calls `transformPoint`, `CGPoint`, `min` and `Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2544` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×1
  • Duplicated block (16 lines × 2) Sources/SwiftTerm/BufferLine.swift:368 — Sources/SwiftTerm/BufferLine.swift:368-383 | Sources/SwiftTerm/BufferLine.swift:406-421 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/BufferLine.swift:368` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:306 — Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:306-320 | Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:844-857 — 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.
D4 · Code Duplication · Duplicated block (14 lines × 6) · ×1
  • Duplicated block (14 lines × 6) Sources/SwiftTerm/CharSets.swift:97 — Sources/SwiftTerm/CharSets.swift:97-110 | Sources/SwiftTerm/CharSets.swift:132-145 | Sources/SwiftTerm/CharSets.swift:150-163 | Sources/SwiftTerm/CharSets.swift:166-179 | Sources/SwiftTerm/CharSets.swift:184-197 | Sources/SwiftTerm/CharSets.swift:219-232 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/CharSets.swift:97` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4905 — Sources/SwiftTerm/Mac/MacTerminalView.swift:4905-4918 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3724-3734 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) Sources/SwiftTerm/SearchEngine.swift:53 — Sources/SwiftTerm/SearchEngine.swift:53-66 | Sources/SwiftTerm/SearchEngine.swift:126-137 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/SearchEngine.swift:53` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–13 lines × 4) · ×1
  • Duplicated block (10–13 lines × 4) Sources/SwiftTerm/CharSets.swift:64 — Sources/SwiftTerm/CharSets.swift:64-76 | Sources/SwiftTerm/CharSets.swift:116-125 | Sources/SwiftTerm/CharSets.swift:204-213 | Sources/SwiftTerm/CharSets.swift:239-248 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/CharSets.swift:64` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/SwiftTerm/CharSets.swift:76` calls `Character` and `Sources/SwiftTerm/CharSets.swift:125` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) Sources/SwiftTerm/KittyGraphics.swift:1320 — Sources/SwiftTerm/KittyGraphics.swift:1320-1332 | Sources/SwiftTerm/KittyGraphics.swift:1359-1370 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/KittyGraphics.swift:1320` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–13 lines × 2) · ×1
  • Duplicated block (8–13 lines × 2) Sources/SwiftTerm/Terminal.swift:10052 — Sources/SwiftTerm/Terminal.swift:10052-10064 | Sources/SwiftTerm/Terminal.swift:10088-10095 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Terminal.swift:10088` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/SwiftTerm/Terminal.swift:10087` calls `translateBufferLineToString` and `Sources/SwiftTerm/Terminal.swift:10050` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3473 — Sources/SwiftTerm/Apple/AppleTerminalView.swift:3473-3481 | Sources/SwiftTerm/Apple/AppleTerminalView.swift:3486-3496 — 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.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×1
  • Duplicated block (5–6 lines × 2) Sources/SwiftTerm/Terminal.swift:6303 — Sources/SwiftTerm/Terminal.swift:6303-6307 | Sources/SwiftTerm/Terminal.swift:6311-6316 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Terminal.swift:6311` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 11) · ×1
  • Duplicated block (5 lines × 11) Sources/SwiftTerm/CharSets.swift:61 — Sources/SwiftTerm/CharSets.swift:61-65 | Sources/SwiftTerm/CharSets.swift:96-100 | Sources/SwiftTerm/CharSets.swift:113-117 | Sources/SwiftTerm/CharSets.swift:131-135 | Sources/SwiftTerm/CharSets.swift:149-153 | Sources/SwiftTerm/CharSets.swift:165-169 | Sources/SwiftTerm/CharSets.swift:183-187 | Sources/SwiftTerm/CharSets.swift:201-205 | Sources/SwiftTerm/CharSets.swift:218-222 | Sources/SwiftTerm/CharSets.swift:236-240 | Sources/SwiftTerm/CharSets.swift:257-261 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/CharSets.swift:61` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/SwiftTerm/CharSets.swift:118` calls `Character` and `Sources/SwiftTerm/CharSets.swift:107` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×1
  • Duplicated block (5 lines × 3) Sources/SwiftTerm/Terminal.swift:6301 — Sources/SwiftTerm/Terminal.swift:6301-6305 | Sources/SwiftTerm/Terminal.swift:6309-6313 | Sources/SwiftTerm/Terminal.swift:6330-6334 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Terminal.swift:6301` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) Sources/SwiftTerm/Colors.swift:464 — Sources/SwiftTerm/Colors.swift:464-468 | Sources/SwiftTerm/Colors.swift:469-473 | Sources/SwiftTerm/Colors.swift:474-478 | Sources/SwiftTerm/Colors.swift:479-483 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Colors.swift:464` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
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.
R1 · Type Safety · Type Safety · ×1
  • Type Safety — 0 typed · 16 plain JS — the untyped files are TerminalApp/WebTerminal/Public/app.js, TerminalApp/WebTerminal/Public/clipboard.js, Tests/WebWasmTests/browser-input.mjs, REDACTED, Tests/WebWasmTests/canvas-grid.mjs, Tests/WebWasmTests/conformance.test.mjs (+10 more).
R10 · Code Duplication · Duplicated block with local edits (9 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (9 matched lines × 2 locations) TerminalApp/WebTerminal/Public/app.js:206 — TerminalApp/WebTerminal/Public/app.js:206 · TerminalApp/WebTerminal/Public/app.js:237 — the two spans are one implementation copied and then locally edited — 83 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.
R2 · Cyclomatic Complexity · Complex function run (cyclomatic 27, cognitive 46) · ×1
  • Complex function run (cyclomatic 27, cognitive 46) TerminalApp/WebTerminal/Public/clipboard.js:122 — run has cyclomatic complexity 27 and cognitive complexity 46; 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 accept (cyclomatic 16, cognitive 17) · ×1
  • Complex function accept (cyclomatic 16, cognitive 17) TerminalApp/WebTerminal/Public/clipboard.js:75 — accept has cyclomatic complexity 16 and cognitive complexity 17; 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 show (cyclomatic 16, cognitive 17) · ×1
  • Complex function show (cyclomatic 16, cognitive 17) TerminalApp/WebTerminal/Public/clipboard.js:105 — show has cyclomatic complexity 16 and cognitive complexity 17; 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 pump (cyclomatic 15, cognitive 14) · ×1
  • Complex function pump (cyclomatic 15, cognitive 14) TerminalApp/WebTerminal/Public/app.js:174 — pump has cyclomatic complexity 15 and cognitive complexity 14; 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 paste (cyclomatic 14, cognitive 15) · ×1
  • Complex function paste (cyclomatic 14, cognitive 15) TerminalApp/WebTerminal/Public/app.js:206 — paste has cyclomatic complexity 14 and cognitive complexity 15; 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 makeClipboardItem (cyclomatic 13, cognitive 15) · ×1
  • Complex function makeClipboardItem (cyclomatic 13, cognitive 15) TerminalApp/WebTerminal/Public/clipboard.js:14 — makeClipboardItem has cyclomatic complexity 13 and cognitive complexity 15; 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 12, cognitive 19) · ×1
  • Complex function (anonymous) (cyclomatic 12, cognitive 19) TerminalApp/WebTerminal/Public/app.js:117 — (anonymous) has cyclomatic complexity 12 and cognitive complexity 19; 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 decodeServerMessage (cyclomatic 12, cognitive 11) · ×1
  • Complex function decodeServerMessage (cyclomatic 12, cognitive 11) TerminalApp/WebTerminal/Public/app.js:25 — decodeServerMessage has cyclomatic complexity 12 and cognitive complexity 11; 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 updateInput (cyclomatic 12, cognitive 11) · ×1
  • Complex function updateInput (cyclomatic 12, cognitive 11) TerminalApp/WebTerminal/Public/app.js:224 — updateInput has cyclomatic complexity 12 and cognitive complexity 11; 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 (anonymous) (cyclomatic 11, cognitive 32) · ×1
  • Complex function (anonymous) (cyclomatic 11, cognitive 32) Tests/WebWasmTests/canvas-grid.mjs:6 — (anonymous) has cyclomatic complexity 11 and cognitive complexity 32; 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.
Minor — 29 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×16
  • Duplicated predicate Sources/SwiftTerm/Mac/MacCaretView.swift:67 — `!data.textBlinkVisible && data.cellAttribute.style.contains(.blink)` appears character-identically in 2 files — Sources/SwiftTerm/Mac/MacCaretView.swift, Sources/SwiftTerm/iOS/iOSCaretView.swift. 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 Sources/SwiftTerm/HeadlessTerminal.swift:8 — `!os(iOS) && !os(Windows) && !os(WASI) && !os(Android)` appears character-identically in 2 files — Sources/SwiftTerm/HeadlessTerminal.swift, Sources/SwiftTerm/TerminalIOPipeline.swift. 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 Sources/SwiftTerm/Mac/MacTerminalView.swift:5090 — `Thread.isMainThread && !source.terminalLock.isLockedByCurrentThread` appears character-identically in 2 files — Sources/SwiftTerm/Mac/MacTerminalView.swift, Sources/SwiftTerm/iOS/iOSTerminalView.swift. 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 Sources/SwiftTerm/Mac/MacTerminalView.swift:2982 — `backspaceSendsControlH || terminalState.3` appears character-identically in 2 files — Sources/SwiftTerm/Mac/MacTerminalView.swift, Sources/SwiftTerm/iOS/iOSTerminalView.swift. 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 Sources/SwiftTerm/Apple/AppleTerminalView.swift:3214 — `drawRect.width <= 0 || drawRect.height <= 0` appears character-identically in 2 files — Sources/SwiftTerm/Apple/AppleTerminalView.swift, Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift. 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 Sources/SwiftTerm/Apple/TerminalBidi.swift:590 — `first > 0 && buffer.lines[first].isWrapped` appears character-identically in 2 files — Sources/SwiftTerm/Apple/TerminalBidi.swift, Sources/SwiftTerm/Terminal.swift. 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 Sources/SwiftTerm/Apple/TerminalBidi.swift:598 — `last + 1 < buffer.lines.count && buffer.lines[last + 1].isWrapped` appears character-identically in 2 files — Sources/SwiftTerm/Apple/TerminalBidi.swift, Sources/SwiftTerm/Terminal.swift. 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 Sources/SwiftTerm/Mac/MacTerminalView.swift:2208 — `linkHighlightMode == .hover || linkHighlightMode == .hoverWithModifier` appears character-identically in 2 files — Sources/SwiftTerm/Mac/MacTerminalView.swift, Sources/SwiftTerm/iOS/iOSTerminalView.swift. 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 Sources/SwiftTerm/Apple/ArabicShapingData.swift:10 — `os(macOS) || os(iOS) || os(visionOS) || os(macCatalyst)` appears character-identically in 10 files — Sources/SwiftTerm/Apple/ArabicShapingData.swift, Sources/SwiftTerm/Apple/BidiMirroringData.swift, Sources/SwiftTerm/Apple/Metal/MetalRenderTarget.swift, Sources/SwiftTerm/Apple/Metal/TerminalMetalLayerView.swift. 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 Sources/SwiftTerm/Apple/FrameDriver.swift:8 — `os(macOS) || os(iOS) || os(visionOS) || os(tvOS)` appears character-identically in 2 files — Sources/SwiftTerm/Apple/FrameDriver.swift, Sources/SwiftTerm/Apple/TerminalProgressBarView.swift. 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 Sources/SwiftTerm/Apple/AppleTerminalView.swift:3821 — `placeholder.placementId != 0 && record.placementId != placeholder.placementId` appears character-identically in 2 files — Sources/SwiftTerm/Apple/AppleTerminalView.swift, Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift. 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 Sources/SwiftTerm/Apple/AppleTerminalView.swift:3845 — `placementRect.width <= 0 || placementRect.height <= 0` appears character-identically in 2 files — Sources/SwiftTerm/Apple/AppleTerminalView.swift, Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift. 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 Sources/SwiftTerm/Apple/AppleTerminalView.swift:2922 — `position.row >= 0 && position.row < buffer.lines.count` appears character-identically in 2 files — Sources/SwiftTerm/Apple/AppleTerminalView.swift, Sources/SwiftTerm/Terminal.swift. 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 Sources/SwiftTerm/Apple/AppleTerminalView.swift:3824 — `record.geometry.columns > placeholder.placeholderCol && record.geometry.rows > placeholder.placeholderRow && record.geometry.columns > 0 && …` appears character-identically in 2 files — Sources/SwiftTerm/Apple/AppleTerminalView.swift, Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift. 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 Sources/SwiftTerm/KittyKeyboardEncoder.swift:919 — `scalar.value < 0x20 || (scalar.value >= 0x7f && scalar.value <= 0x9f)` appears character-identically in 2 files — Sources/SwiftTerm/KittyKeyboardEncoder.swift, Sources/SwiftTerm/Mac/MacTerminalView.swift. 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 Sources/SwiftTerm/Apple/AppleTerminalView.swift:3064 — `underlineStyle.contains(.patternDash) || underlineStyle.contains(.patternDashDot) || underlineStyle.contains(.patternDashDotDot)` appears character-identically in 2 files — Sources/SwiftTerm/Apple/AppleTerminalView.swift, Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift. 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.
D16 · Bus Factor · Off-boarding risk · ×1
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 49 significant file(s) lose their only recent owner: Sources/SwiftTerm/KittyClipboardProtocol.swift, TerminalApp/MacTerminal/ViewController.swift, Tools/BidiHarness/BidiHarness/HarnessViewController.swift, Sources/SwiftTerm/BufferLine.swift, Sources/SwiftTerm/KittyKeyboardEncoder.swift, TerminalApp/MacTerminal/IOBaselineHarness.swift, Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift, scripts/regen_unicode_width_data.py (+41 more). Pair on, review, or document these before any departure.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 6 project(s) overshoot their size bounds, lowering Project Cohesion to 6.7/10. The most over is `(repository root)` (66180 LoC, 554 module-visible types across 18 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.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 1/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `TerminalApp`, `TerminalApp/WebTerminal`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST REDACTED:6 — No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 10784 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation Web/package.json:25 — `Web/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
PF1 · Benchmark discipline · Benchmarks don't track allocations · ×1
  • Benchmarks don't track allocations Tools/SwiftTermBenchmarks/Benchmarks/SwiftTermBenchmarks/SwiftTermBenchmarks.swift — A Swift package-benchmark suite exists but nothing turns on its allocation measurement — allocations (the main way hot code pressures a garbage collector or allocator) aren't being measured.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×1
  • Silent fallback default on parse failure Tools/run-pty-benchmark.py:196 — `percent_delta` returns `'na'` when `(KeyError, ValueError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. 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.
X7 · Silent fallback defaults · Silent fallback default in catch · ×1
  • Silent fallback default in catch Web/src/loader.ts:61 — `errorDetail` 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 — 51 finding(s)
D10 · Test Quality · Skipped (documented) · ×43
  • Skipped (documented): rowAndCursorGlyphOriginsUseDevicePixels Tests/SwiftTermTests/GlyphPixelAlignmentTests.swift:69 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): rowAndCursorGlyphsHaveSameBitmapPlacement Tests/SwiftTermTests/GlyphPixelAlignmentTests.swift:126 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): aSixtyFourMiBFragmentedWriteCommits Tests/SwiftTermTests/KittyClipboardProtocolTests.swift:1435 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): testKittySharedMemoryLoad Tests/SwiftTermTests/KittyTransmissionTests.swift:218 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): testKittySharedMemoryBoundsRejected Tests/SwiftTermTests/KittyTransmissionTests.swift:245 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): testKittyUnicodePlaceholderFrameFromSharedMemory Tests/SwiftTermTests/KittyTransmissionTests.swift:314 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): testKittySharedMemoryNameWithoutLeadingSlashIsRefused Tests/SwiftTermTests/KittyTransmissionTests.swift:339 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): testKittySharedMemoryOffsetCountsTheImageFromTheOffset Tests/SwiftTermTests/KittyTransmissionTests.swift:364 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): testKittySharedMemorySizeIsClampedToTheObject Tests/SwiftTermTests/KittyTransmissionTests.swift:392 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): attributesDrawAsTheShapedPathDraws Tests/SwiftTermTests/MetalPlainTextTests.swift:346 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): runsMergeWhereTheAttributedStringMerges Tests/SwiftTermTests/MetalPlainTextTests.swift:377 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): contrastDrawsAsTheShapedPathDraws Tests/SwiftTermTests/MetalPlainTextTests.swift:397 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): translucentBackgroundsDrawAsTheShapedPathDraws Tests/SwiftTermTests/MetalPlainTextTests.swift:433 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): linksDrawAsTheShapedPathDraws Tests/SwiftTermTests/MetalPlainTextTests.swift:464 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): denseColorDrawsAsTheShapedPathDraws Tests/SwiftTermTests/MetalPlainTextTests.swift:475 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): otherRowsKeepTheShapedPath Tests/SwiftTermTests/MetalPlainTextTests.swift:496 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): aFontThatIsNotPlainIsShaped Tests/SwiftTermTests/MetalPlainTextTests.swift:511 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): anOptionalLigatureDrawsAsTheShapedPathDraws Tests/SwiftTermTests/MetalPlainTextTests.swift:520 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): plainRowsScrollAsShapedRowsDo Tests/SwiftTermTests/MetalPlainTextTests.swift:529 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): scrollingOutputMovesRowsInsteadOfRebuildingThem Tests/SwiftTermTests/MetalRowCacheTests.swift:236 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): scrollingAFullScrollbackRebuildsTheRecycledLine Tests/SwiftTermTests/MetalRowCacheTests.swift:260 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): scrollingTheViewMovesRows Tests/SwiftTermTests/MetalRowCacheTests.swift:275 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): anUnchangedFrameReusesEveryRow Tests/SwiftTermTests/MetalRowCacheTests.swift:300 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): decLineSizesMoveExactly Tests/SwiftTermTests/MetalRowCacheTests.swift:315 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): bidiRowsAreRebuiltWhenTheyMove Tests/SwiftTermTests/MetalRowCacheTests.swift:328 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • + 18 more in this group — see findings.md.
D12 · Dependency Hygiene · Outdated · ×8
  • Outdated: benchmark — `benchmark` is resolved at 1.36.2, but 1.38.1 is the newest release tagged on https://github.com/ordo-one/benchmark within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update benchmark` reaches this one with no change to Package.swift.
  • Outdated: hummingbird — `hummingbird` is resolved at 2.26.0, but 2.28.0 is the newest release tagged on https://github.com/hummingbird-project/hummingbird.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update hummingbird` reaches this one with no change to Package.swift.
  • Outdated: hummingbird-websocket — `hummingbird-websocket` is resolved at 2.7.0, but 2.8.1 is the newest release tagged on https://github.com/hummingbird-project/hummingbird-websocket.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update hummingbird-websocket` reaches this one with no change to Package.swift.
  • Outdated: swift-argument-parser — `swift-argument-parser` is resolved at 1.7.0, but 1.8.2 is the newest release tagged on https://github.com/apple/swift-argument-parser within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-argument-parser` reaches this one with no change to Package.swift.
  • Outdated: swift-docc-plugin — `swift-docc-plugin` is resolved at 1.4.6, but 1.5.0 is the newest release tagged on https://github.com/apple/swift-docc-plugin within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-docc-plugin` reaches this one with no change to Package.swift.
  • Outdated: swift-nio — `swift-nio` is resolved at 2.102.0, but 2.104.0 is the newest release tagged on https://github.com/apple/swift-nio.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-nio` reaches this one with no change to Package.swift.
  • Outdated: swift-png — `swift-png` is resolved at 4.5.1, but 4.5.2 is the newest release tagged on https://github.com/tayloraswift/swift-png within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-png` reaches this one with no change to Package.swift.
  • Outdated: swift-websocket — `swift-websocket` is resolved at 1.6.1, but 1.6.2 is the newest release tagged on https://github.com/hummingbird-project/swift-websocket.git within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-websocket` reaches this one with no change to Package.swift.

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/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-a0a20421a3ab41f5ba2bdf50657db7ae/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-a0a20421a3ab41f5ba2bdf50657db7ae/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/watchdog-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 Web .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/** . --skip-db-update1artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
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 10 file(s) — `Sources/SwiftTerm/Apple/AppleTerminalView.swift`, `Sources/SwiftTerm/CharData.swift`, `Sources/SwiftTerm/CsiParameters.swift`, `Sources/SwiftTerm/KittyGraphics.swift`, `Sources/SwiftTerm/Mac/MacTerminalView.swift`, … (+5 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.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/** . --skip-db-update0artifacts/raw/trivy-fs.json

Run 01a18753-b5f6-7fb2-82d1-b6d73b436c6e · 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