Public report of migueldeicaza/SwiftTerm, published 15 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 15 November 2026, 01:45 UTC · Survey ID cd_1a31dd02f6454b86a758fba284f7e22d
migueldeicaza/SwiftTerm
Measured 15 November 2026, 01:45 UTC, at code version e1ff7f7
Supply-chain provenance & signing is not measured: Supply-chain provenance is not scored (this pipeline releases no artifact), but its build steps or GitHub Actions workflows have integrity defects, or nothing watches its dependency set for published advisories.
CAI scoreStrong
CriticalWeakAdequateStrongExemplary
Up 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: 78,890 lines of product code in 12 projects, tests not counted · Estimated rebuild effort: about 0.9 person-years · Weakest lens: Production Readiness, 48
Findings by how serious they are
21 critical951 serious79 minor
22 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
15 November 2026, 01:45 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
57of 57 dimensions measured by tools.
1032of 1051 findings point to an exact file and line, so you can open each one in the code. The other 19 concern the repository as a whole, such as missing documentation.
57dimensions across 8 lenses, read from 78,890 lines of product code in 12 projects.
migueldeicaza/SwiftTerm meets our standard for a template or a sample, though we found no automated security scanning of the code, its secrets or its dependencies. It scores 58 out of 100 and is rated Strong, and 18 of its 21 critical findings are security problems in the build pipeline.
Production Readiness, at 48, is the weakest lens and counts most in the score. The best first step is making the tests check their results, worth about 6 points. Adding automated security scanning would lift Production Readiness itself, also worth about 6. 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 pipeline step runs a download nobody checks. Pinning each tool to an exact version and checking the download against a checksum would close both risks. The two tests that check nothing need to check the result they produce.
The product code is 78,890 lines, about €130,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 forThe 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.
If Production Readiness rose from 48 to 52, the lowest score rated Strong, the score would rise from 58 to about 59.
Code composition: what the lines of code are
Product code 64%Tests 36%
New since the last survey: 207 findings
These 207 critical or serious findings weren't in the previous survey, on 29 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.
God Classes · MethodTooLong: CoreGraphicsPaintHost.drawTerminalContents Sources/SwiftTerm/Apple/AppleTerminalView.swift
God Classes · ClassTooLong: TerminalKeyboardRouter Sources/SwiftTerm/Mac/MacKeyboardRouter.swift
God Classes · MethodTooLong: TerminalKeyboardRouter.keyDown Sources/SwiftTerm/Mac/MacKeyboardRouter.swift
God Classes · FileTooLong: Mac/MacKeyboardRouter.swift Sources/SwiftTerm/Mac/MacKeyboardRouter.swift
God Classes · MethodTooLong: TerminalSnapshot.refresh Sources/SwiftTerm/Apple/TerminalSnapshot.swift
God Classes · MethodTooLong: TerminalKeyboardRouter.kittyFunctionalKey Sources/SwiftTerm/Mac/MacKeyboardRouter.swift
God Classes · TooManyMethods: TerminalRenderView Sources/SwiftTerm/Mac/MacTerminalRenderView.swift
God Classes · TooManyMethods: TerminalRenderView Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift
God Classes · FileTooLong: Apple/TerminalSnapshot.swift Sources/SwiftTerm/Apple/TerminalSnapshot.swift
God Classes · TooManyMethods: TerminalKeyboardRouter Sources/SwiftTerm/Mac/MacKeyboardRouter.swift
God Classes · MethodTooLong: TerminalKeyboardRouter.doCommand Sources/SwiftTerm/Mac/MacKeyboardRouter.swift
God Classes · TooManyMethods: CellStoragePage Sources/SwiftTerm/CellStorage.swift
God Classes · TooManyMethods: LocalProcessTerminalView Sources/SwiftTerm/Mac/MacLocalTerminalView.swift
God Classes · FileTooLong: Apple/FrameDriver.swift Sources/SwiftTerm/Apple/FrameDriver.swift
Code Duplication · Edited copy of a member (62 corresponding lines) TerminalApp/MacTerminal/ViewController.swift
Code Duplication · Edited copy of a member (66 corresponding lines) Sources/SwiftTerm/Terminal.swift
Code Duplication · Edited copy of a member (41 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift
Code Duplication · Edited copy of a member (30 corresponding lines) Sources/SwiftTerm/BufferLine.swift
Code Duplication · Edited copy of a member (37 corresponding lines) Sources/SwiftTerm/KittyGraphics.swift
Code Duplication · Edited copy of a member (24 corresponding lines) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
Code Duplication · Edited copy of a member (42 corresponding lines) Sources/SwiftTerm/CircularList.swift
Code Duplication · Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift
Code Duplication · Edited copy of a member (22 corresponding lines) Sources/SwiftTerm/iOS/iOSTerminalView.swift
Code Duplication · Edited copy of a member (42 corresponding lines) Sources/SwiftTerm/Buffer.swift
Code Duplication · Edited copy of a member (37 corresponding lines) Sources/SwiftTerm/CircularList.swift
Code Duplication · Edited copy of a member (30 corresponding lines) Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift
Code Duplication · Edited copy of a member (18 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift
Code Duplication · Edited copy of a member (34 corresponding lines) Sources/SwiftTerm/SelectionService.swift
Code Duplication · Edited copy of a member (22 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift
Code Duplication · Edited copy of a member (21 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift
Code Duplication · Edited copy of a member (32 corresponding lines) Sources/SwiftTerm/ByteRunScanner.swift
Code Duplication · Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/iOS/iOSDoubleButton.swift
Code Duplication · Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/BufferLine.swift
Code Duplication · Edited copies of one member (3 members, 30+ corresponding lines) Sources/SwiftTerm/ByteRunScanner.swift
Code Duplication · Edited copy of a member (28 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift
Code Duplication · Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
Code Duplication · Edited copy of a member (24 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift
Code Duplication · Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift
Code Duplication · Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/Mac/MacExtensions.swift
Code Duplication · Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift
Code Duplication · Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift
Code Duplication · Edited copy of a member (15 corresponding lines) Sources/SwiftTerm/Profiling.swift
Code Duplication · Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/CellStorage.swift
Code Duplication · Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift
Code Duplication · Edited copy of a member (19 corresponding lines) Sources/SwiftTerm/iOS/iOSTerminalView.swift
Code Duplication · Edited copy of a member (20 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift
Code Duplication · Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/Mac/MacExtensions.swift
Code Duplication · Edited copy of a member (14 corresponding lines) Sources/SwiftTerm/LineChangeTracker.swift
Code Duplication · Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/TerminalViewSearch.swift
Code Duplication · Edited copy of a member (16 corresponding lines) Sources/SwiftTerm/CellStorage.swift
Code Duplication · Edited copy of a member (15 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift
Code Duplication · Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift
Code Duplication · Edited copy of a member (25 corresponding lines) Sources/SwiftTerm/Terminal.swift
Code Duplication · Edited copy of a member (16 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift
Code Duplication · Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/iOS/iOSTerminalView.swift
Code Duplication · Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/KittyKeyboardEncoder.swift
Code Duplication · Edited copy of a member (15 corresponding lines) Sources/SwiftTerm/Apple/TerminalBidi.swift
Code Duplication · Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/CellStorage.swift
Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift
Code Duplication · Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/SearchService.swift
Code Duplication · Edited copy of a member (13 corresponding lines) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift
Code Duplication · Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift
Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) Sources/SwiftTerm/ByteRunScanner.swift
Code Duplication · Edited copy of a member (13 corresponding lines) Sources/SwiftTerm/Terminal.swift
Code Duplication · Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/Terminal.swift
Code Duplication · Edited copy of a member (12 corresponding lines) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift
Code Duplication · Edited copy of a member (19 corresponding lines) Sources/SwiftTermWebWasm/Exports.swift
Code Duplication · Edited copy of a member (13 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift
Code Duplication · Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/ByteRunScanner.swift
Code Duplication · Edited copy of a member (11 corresponding lines) Sources/SwiftTermWebWasm/Exports.swift
We compare every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.
Fixed since the last survey: 94 findings
These 94 critical or serious findings were in the previous survey, on 29 October 2026, and are gone from this one.
Outbound HTTP resilience · Outbound HTTP without resilience scripts/regen_unicode_width_data.py
Outbound HTTP resilience · Outbound HTTP without resilience scripts/regen_unicode_width_data.py
A11y enforcement · Accessibility enforcement below the top rung
Rebuild cost: about €130,000 · Estimate
Cost to rebuild
€43,000 to €210,000, for 709 to 2,249 hours of work, about 0.9 person-years for 1 to 2 engineers
Difficulty of the problem
Standard, 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 58. 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.
Size
Medium: 78,890 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 Assertions commented out finding(s) in Test Quality — start with MeanTests.swift.
Raises the score by about 6 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 6 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.
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 €130,000 to build again, about 0.9 person-years of work. Its weakest lens is Production Readiness, at 48 (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 6 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 5.8 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 12% on every change. The history of the code shows how much it changes: about 99,810 lines over the last 90 days, which is about 404,785 lines a year. At that pace, the extra work comes to an estimated 54.8 to 329 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · 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.
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.
28 modules, with 25 dependencies between them. 2 loops run through 4 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.
SwiftTermBuildInfoGenerator uses SwiftTerm, so a change to SwiftTerm can break SwiftTermBuildInfoGenerator, while a change to SwiftTermBuildInfoGenerator can't break SwiftTerm.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
Web.src.terminal uses Web.src.types, so a change to Web.src.types can break Web.src.terminal, while a change to Web.src.terminal can't break Web.src.types.
Position
Below the diagonal: Web.src.terminal uses a module listed above it, which is the healthy direction.
13→16 Web.src.terminal uses Web.src.loaderpart of a loop✕
Connections
1 pair of types, where a type in Web.src.terminal uses a type in Web.src.loader.
Web.src.terminal uses Web.src.loader, so a change to Web.src.loader can break Web.src.terminal, while a change to Web.src.terminal can't break Web.src.loader.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
SwiftTerm uses SwiftTermBuildInfoGenerator, so a change to SwiftTermBuildInfoGenerator can break SwiftTerm, while a change to SwiftTerm can't break SwiftTermBuildInfoGenerator.
Position
Below the diagonal: SwiftTerm uses a module listed above it, which is the healthy direction.
Web.src.keyboard uses Web.src.types, so a change to Web.src.types can break Web.src.keyboard, while a change to Web.src.keyboard can't break Web.src.types.
Position
Below the diagonal: Web.src.keyboard uses a module listed above it, which is the healthy direction.
Web.src.keyboard uses Web.src.terminal, so a change to Web.src.terminal can break Web.src.keyboard, while a change to Web.src.keyboard can't break Web.src.terminal.
Position
Below the diagonal: Web.src.keyboard uses a module listed above it, which is the healthy direction.
Web.src.loader uses Web.src.terminal, so a change to Web.src.terminal can break Web.src.loader, while a change to Web.src.loader can't break Web.src.terminal.
Position
Below the diagonal: Web.src.loader uses a module listed above it, which is the healthy direction.
28 pairs of types, where a type in SwiftTermWebWasm uses a type in SwiftTerm. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
TerminalApp~WebTerminal~WebTerminalServer uses SwiftTerm, so a change to SwiftTerm can break TerminalApp~WebTerminal~WebTerminalServer, while a change to TerminalApp~WebTerminal~WebTerminalServer can't break SwiftTerm.
Position
Below the diagonal: TerminalApp~WebTerminal~WebTerminalServer uses a module listed above it, which is the healthy direction.
Tools~RenderBench~RenderBench uses SwiftTerm, so a change to SwiftTerm can break Tools~RenderBench~RenderBench, while a change to Tools~RenderBench~RenderBench can't break SwiftTerm.
Position
Below the diagonal: Tools~RenderBench~RenderBench uses a module listed above it, which is the healthy direction.
Tools~SwiftTermBenchmarks~SwiftTermProfile uses SwiftTerm, so a change to SwiftTerm can break Tools~SwiftTermBenchmarks~SwiftTermProfile, while a change to Tools~SwiftTermBenchmarks~SwiftTermProfile can't break SwiftTerm.
Position
Below the diagonal: Tools~SwiftTermBenchmarks~SwiftTermProfile uses a module listed above it, which is the healthy direction.
Tools~SwiftTermBenchmarks~VTEBenchWorkloads uses SwiftTerm, so a change to SwiftTerm can break Tools~SwiftTermBenchmarks~VTEBenchWorkloads, while a change to Tools~SwiftTermBenchmarks~VTEBenchWorkloads can't break SwiftTerm.
Position
Below the diagonal: Tools~SwiftTermBenchmarks~VTEBenchWorkloads uses a module listed above it, which is the healthy direction.
Web.src.input uses Web.src.terminal, so a change to Web.src.terminal can break Web.src.input, while a change to Web.src.input can't break Web.src.terminal.
Position
Below the diagonal: Web.src.input uses a module listed above it, which is the healthy direction.
Web.src.input uses Web.src.keyboard, so a change to Web.src.keyboard can break Web.src.input, while a change to Web.src.input can't break Web.src.keyboard.
Position
Below the diagonal: Web.src.input uses a module listed above it, which is the healthy direction.
69 pairs of types, where a type in repository uses a type in SwiftTerm. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
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 category
Findings
Severity
A05:2025 — Injection
22
High / Critical
Roadmap
Top priorities: Resolve the 1 Assertions commented out finding(s) in Test Quality — start with MeanTests.swift; Resolve the 1 No assertions (empty test) finding(s) in Test Quality — start with FuzzerTests.swift; 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.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 Assertions commented out finding(s) in Test Quality — start with MeanTests.swift.
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.
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.
Resolve the 212 No assertions finding(s) in Test Quality — start with KittyKeyboardEncoderTests.swift (51), CsiParameterParsingTests.swift (32), ProfileSupportTests.swift (24).
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 we 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.
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 — 21
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 — 951
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 — 79
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 22
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 57 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.8, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 57 dimensions across the health lenses
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
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, 1032 of 1051 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.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
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.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 2,350 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `Sources/SwiftTerm/Apple/AppleTerminalView.swift`, `Sources/SwiftTerm/Apple/Metal/MetalShaderSource.swift`, `Sources/SwiftTerm/CharData.swift`, `Sources/SwiftTerm/CircularList.swift`, `Sources/SwiftTerm/CsiParameters.swift`, … (+10 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
D44 Platform End-of-Life — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
AXB1 Runtime evidence locked — no reproducible boot — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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. We then boot 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's 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 — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 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.
X1 Async correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X2 Cancellation propagation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, 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, got, undici, node:http; 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.
X27 Collection changed while being enumerated — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and Java, Rust, Erlang, F#, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded, no Java, Rust, Erlang, F#, Python, Dart, Ruby, Scala or Kotlin was found, and this repository's C, Swift (Foundation mutable collections) 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.
X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and 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, 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
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
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.
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.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
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.
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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
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.
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.
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.
+ 141 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 9 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with TerminalView.pressesBegan (cyclomatic 116), EscapeSequenceParser.parseBorrowed (cyclomatic 115), TerminalKeyboardRouter.keyDown (cyclomatic 105). — 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.8 to about 5.9/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
+ 186 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 8 bodies over 120 down to 120 or less in Cognitive Complexity — start with CoreGraphicsPaintHost.drawTerminalContents (cognitive 240), EscapeSequenceParser.parseBorrowed (cognitive 230), 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.5 to about 3.9/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
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.
Resolve the 23 FileTooLong finding(s) in God Classes — start with Terminal.swift, MetalTerminalRenderer.swift, AppleTerminalView.swift. — One of this dimension's main actionable groups (23 warning-level).
Resolve the 23 MethodTooLong finding(s) in God Classes — start with MetalTerminalRenderer.swift (6), MacKeyboardRouter.swift (3), iOSTerminalView.swift (2). — One of this dimension's main actionable groups (23 warning-level).
Resolve the 20 TooManyMethods finding(s) in God Classes — start with Terminal.swift, MacTerminalView.swift, iOSTerminalView.swift. — One of this dimension's main actionable groups (20 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
116 duplicated block group(s) detected. 6.7 % of the production lines (5,276 of 78,890) are in a reported copy. A further 115 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 10 of the 231 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
Edited copy of a member (11 corresponding lines) · ×9Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:475
Edited copy of a member (9 corresponding lines) · ×9Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:931
+ 73 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 13 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with MacTerminalView.swift (3), CellStorage.swift, Terminal.swift. — One of this dimension's main actionable groups (13 warning-level).
Resolve the 12 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with Terminal.swift (2), AppleTerminalView.swift (2), MacTerminalRenderView.swift (2). — One of this dimension's main actionable groups (12 warning-level).
Resolve the 10 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with MacTerminalRenderView.swift (3), MacTerminalView.swift (2), BoxDrawingRenderer.swift. — One of this dimension's main actionable groups (10 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
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.
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
Resolve the 2 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (2 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 15 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 (15 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D10 · Test Quality8.6 / 10Adequategated by 2 critical findings✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
47 skipped (45 with a documented reason), 214 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 2350 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
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).
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).
Resolve the 212 No assertions finding(s) in Test Quality — start with KittyKeyboardEncoderTests.swift (51), CsiParameterParsingTests.swift (32), ProfileSupportTests.swift (24). — One of this dimension's main actionable groups (212 warning-level).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
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.
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.
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.
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 Package.resolved 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 Package.resolved 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.
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.
Resolve the 21 Hotspot finding(s) in Churn × Complexity Hotspots — start with Terminal.swift, AppleTerminalView.swift, iOSTerminalView.swift. — One of this dimension's main actionable groups (21 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor7.1 / 10Strong✓ Tool-verified
What it measures: Whether knowledge is concentrated in too few people (the "bus factor").
Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.
41 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 143 of the 190 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
Further sole-owners (lower concentration)
What to do
Resolve the 1 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
22 deducted task-comment markers across 78890 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.
Resolve the 19 TodoComment finding(s) in Explicit Debt — start with Terminal.swift (12), Buffer.swift (2), SgrTests.swift. — One of this dimension's main actionable groups (19 warning-level).
Resolve the 3 FixmeComment finding(s) in Explicit Debt — start with Terminal.swift (3). — One of this dimension's main actionable groups (3 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
1 of 6 build units (SwiftPM, Xcode) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
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.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
0 % of calls cross a namespace and 0 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
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.
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).
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 4395, line 4416), `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
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).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
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.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
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.
Every significant source file has living knowledge — recently and meaningfully worked. Counted over 143 of the 190 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
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.
Resolve the 2 Change coupling finding(s) in Change Coupling — start with CircularList.swift, MacTerminalView.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.
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.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
No dependency in any ecosystem this repository declares is published as malicious.
✓ On the Gold path — maintain.
Detailed fixes: d43_recommendation.md.
Do you agree with this assessment?
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.
Do you agree with this assessment?
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.
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.
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.
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.
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.
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.
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.
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.
Do you agree with this assessment?
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.
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.
Do you agree with this assessment?
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.
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.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
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.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability5.0 / 10Adequate✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
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.
Add a health-check endpoint (a /health route on your Vapor/Hummingbird router) so orchestrators and load balancers can probe liveness/readiness.
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 3 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.
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 we 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.
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.
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.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
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.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
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.
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
Do you agree with this assessment?
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.
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.
Do you agree with this assessment?
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.
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.
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.
Do you agree with this assessment?
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.
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)
Do you agree with this assessment?
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).
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.
Unscored — 4 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.
D36 Supply-chain Provenance & Signing — 3 observation(s) recorded · The CI pipeline publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files). Build integrity and workflow-token hygiene are reported below: they describe what the CI runs and the token it runs with, neither of which is affected by whether the pipeline ships an artifact.
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 — 14 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 — 72 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
AX6 Interface segregation — AX6 reached only 3% of this repository's production lines — swift (77,352 lines), python (1,538 lines), c (53 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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 — D21 withholds its case and prefix conventions rows: 7 candidate(s) found and not reported.
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#, Visual Basic, TypeScript and JavaScript comments only; comments in this repository's .py, .swift source were not judged.
D25 ADR Conformance — no ADRs to check
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) — 15 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
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
P7 Outbound HTTP resilience — no outbound HTTP usage detected — no HTTP client call or construction in the JavaScript/TypeScript, Swift source (service entry point: TerminalApp/WebTerminal/Sources/WebTerminalServer/HTTPServer.swift:91 (Application())
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R4 Test Coverage — 12 test file(s) reach none of 2 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.
X1 Async correctness — X1 reached only 5% of this repository's production lines — swift (77,352 lines), c (53 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X12 Unreachable branch — X12 reached only 5% of this repository's production lines — swift (77,352 lines), c (53 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — X16 reached only 3% of this repository's production lines — swift (77,352 lines), python (1,538 lines), c (53 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X18 Disposal-pattern correctness — X18 reached only 3% of this repository's production lines — swift (77,352 lines), python (1,538 lines), c (53 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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.
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X27 Collection changed while being enumerated — 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
X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
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.
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.
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.
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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
FileTooLong: SwiftTerm/Terminal.swift Sources/SwiftTerm/Terminal.swift— FileTooLong — 5785 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5285 over it, 11.57× 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 — 3556 significant lines (blank, comment-only and punctuation-only lines excluded), about 80% of them inside a single declaration: MetalTerminalRenderer (1047-4767). The bar is 500 significant lines; this is 3056 over it, 7.11× 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 — 3294 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2794 over it, 6.59× 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: iOS/iOSTerminalView.swift Sources/SwiftTerm/iOS/iOSTerminalView.swift— FileTooLong — 2752 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: TerminalView (109-3941). The bar is 500 significant lines; this is 2252 over it, 5.50× 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: Mac/MacTerminalView.swift Sources/SwiftTerm/Mac/MacTerminalView.swift— FileTooLong — 2551 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: TerminalView (105-4298). The bar is 500 significant lines; this is 2051 over it, 5.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: 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/Buffer.swift Sources/SwiftTerm/Buffer.swift— FileTooLong — 1182 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: Buffer (45-2185). The bar is 500 significant lines; this is 682 over it, 2.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/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/EscapeSequenceParser.swift Sources/SwiftTerm/EscapeSequenceParser.swift— FileTooLong — 1124 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 624 over it, 2.25× 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: Mac/MacKeyboardRouter.swift Sources/SwiftTerm/Mac/MacKeyboardRouter.swift— FileTooLong — 961 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: TerminalKeyboardRouter (145-1371). The bar is 500 significant lines; this is 461 over it, 1.92× 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 — 845 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 345 over it, 1.69× 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 — 831 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 331 over it, 1.66× 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 — 796 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: SnapshotTextBuilder (118-1083). The bar is 500 significant lines; this is 296 over it, 1.59× 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 — 790 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: TerminalBidi (80-1214). The bar is 500 significant lines; this is 290 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: 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 — 684 significant lines (blank, comment-only and punctuation-only lines excluded), about 88% of them inside a single declaration: TerminalRenderOwner (147-966). The bar is 500 significant lines; this is 184 over it, 1.37× 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 — 634 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: BufferLine (15-1080). The bar is 500 significant lines; this is 134 over it, 1.27× 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/TerminalSnapshot.swift Sources/SwiftTerm/Apple/TerminalSnapshot.swift— FileTooLong — 603 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 103 over it, 1.21× 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/TerminalIOPipeline.swift Sources/SwiftTerm/TerminalIOPipeline.swift— FileTooLong — 602 significant lines (blank, comment-only and punctuation-only lines excluded), about 78% of them inside a single declaration: TerminalIOPipelineWorker (284-979). The bar is 500 significant lines; this is 102 over it, 1.20× 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: Apple/FrameDriver.swift Sources/SwiftTerm/Apple/FrameDriver.swift— FileTooLong — 503 significant lines (blank, comment-only and punctuation-only lines excluded), about 66% of them inside a single declaration: FrameDriver (296-791). The bar is 500 significant lines; this is 3 over it, 1.01× 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.
MethodTooLong: CoreGraphicsPaintHost.drawTerminalContents Sources/SwiftTerm/Apple/AppleTerminalView.swift:3406— MethodTooLong — drawTerminalContents runs 441 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 341 over it, 4.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.placeRow Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2481— 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:1923— 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:3239— 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:454— MethodTooLong — buildAttributedString runs 244 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 144 over it, 2.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: MetalTerminalRenderer.render Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1339— 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:3934— MethodTooLong — buildCursorDrawData runs 220 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 120 over it, 2.20× 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: TerminalKeyboardRouter.keyDown Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:267— MethodTooLong — keyDown runs 200 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 100 over it, 2.00× 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:1684— 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:345— 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: TerminalSnapshot.refresh Sources/SwiftTerm/Apple/TerminalSnapshot.swift:611— MethodTooLong — refresh runs 178 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 78 over it, 1.78× 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: TerminalKeyboardRouter.kittyFunctionalKey Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:941— 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:595— 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: 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:2561— 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:521— 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:2329— 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: TerminalKeyboardRouter.doCommand Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:631— MethodTooLong — doCommand runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.09× 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.
Hotspot: Sources/SwiftTerm/Terminal.swift Sources/SwiftTerm/Terminal.swift:2153— Sources/SwiftTerm/Terminal.swift changed 78 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 105 in Terminal.handlePrintSlow at line 2153. 9 of those changes were fix/bug commits, and the other 69 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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/Apple/AppleTerminalView.swift Sources/SwiftTerm/Apple/AppleTerminalView.swift:3406— Sources/SwiftTerm/Apple/AppleTerminalView.swift changed 60 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 101 in CoreGraphicsPaintHost.drawTerminalContents at line 3406. 6 of those changes were fix/bug commits, and the other 54 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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:3239— Sources/SwiftTerm/iOS/iOSTerminalView.swift changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in TerminalView.pressesBegan at line 3239. 9 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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:1195— Sources/SwiftTerm/EscapeSequenceParser.swift changed 30 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 115 in EscapeSequenceParser.parseBorrowed at line 1195. 2 of those changes were fix/bug commits, 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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/Mac/MacTerminalView.swift Sources/SwiftTerm/Mac/MacTerminalView.swift:3731— Sources/SwiftTerm/Mac/MacTerminalView.swift changed 64 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in TerminalView.scrollWheel at line 3731. 11 of those changes were fix/bug commits, and the other 53 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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/Metal/MetalTerminalRenderer.swift Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1923— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in MetalTerminalRenderer.prepareRow at line 1923. 4 of those changes were fix/bug commits, and the other 21 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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:454— Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 72 in SnapshotTextBuilder.buildAttributedString at line 454. 2 of those changes were fix/bug commits, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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:1045— Sources/SwiftTerm/Buffer.swift changed 31 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in Buffer.resize at line 1045. 8 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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: Sources/SwiftTerm/BufferLine.swift Sources/SwiftTerm/BufferLine.swift:946— Sources/SwiftTerm/BufferLine.swift changed 22 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in BufferLine.copyFrom at line 946. 2 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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:345— Sources/SwiftTerm/Apple/TerminalSnapshot.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 40 in TerminalSnapshot.refresh at line 345. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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:595— 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 595. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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/Apple/TerminalRenderOwner.swift Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:521— Sources/SwiftTerm/Apple/TerminalRenderOwner.swift changed 21 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in TerminalRenderOwner.prepareFrame at line 521. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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/SelectionService.swift Sources/SwiftTerm/SelectionService.swift:1305— Sources/SwiftTerm/SelectionService.swift changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in SelectionService.urlRange at line 1305. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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 4 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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/Utilities.swift Sources/SwiftTerm/Utilities.swift:428— 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 428. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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: Sources/SwiftTerm/Apple/CaretView.swift Sources/SwiftTerm/Apple/CaretView.swift:14— Sources/SwiftTerm/Apple/CaretView.swift changed 8 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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: Tools/RenderBench/Sources/RenderBench/main.swift Tools/RenderBench/Sources/RenderBench/main.swift:36— Tools/RenderBench/Sources/RenderBench/main.swift changed 4 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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/Pty.swift Sources/SwiftTerm/Pty.swift:62— Sources/SwiftTerm/Pty.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in PseudoTerminalHelpers.fork at line 62. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05:00' --full-history --no-merges -- Sources/SwiftTerm/Pty.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 17 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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.
Hotspot: Sources/SwiftTerm/SixelDcsHandler.swift Sources/SwiftTerm/SixelDcsHandler.swift:128— Sources/SwiftTerm/SixelDcsHandler.swift changed 4 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-08-16..2026-11-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-16 11:51:26 -05:00' --until='2026-11-14 11:51:26 -05: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.
TooManyMethods: Terminal Sources/SwiftTerm/Terminal.swift:391— TooManyMethods — 479 methods, declared across 11 files: SwiftTerm/Terminal.swift (357), SwiftTerm/KittyGraphics.swift (84), SwiftTerm/EmbeddedSupport.swift (8), Portable/TerminalViewport.swift (7), +7 more file(s). The bar is 30 methods; this is 449 over it, 15.97× 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 — 431 methods, declared across 9 files: Mac/MacTerminalView.swift (214), Apple/AppleTerminalView.swift (141), iOS/iOSTextInput.swift (36), iOS/iOSTerminalView.swift (15), +5 more file(s). The bar is 30 methods; this is 401 over it, 14.37× 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: Buffer Sources/SwiftTerm/Buffer.swift:45— TooManyMethods — 79 methods. The bar is 30 methods; this is 49 over it, 2.63× 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: 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 — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× 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 — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× 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 — 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: 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: TerminalRenderView Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:29— TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.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: TerminalRenderView Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:30— TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× 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: TerminalKeyboardRouter Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:144— TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: FrameDriver Sources/SwiftTerm/Apple/FrameDriver.swift:295— 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.
TooManyMethods: CellStoragePage Sources/SwiftTerm/CellStorage.swift:986— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× 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: LocalProcessTerminalView Sources/SwiftTerm/Mac/MacLocalTerminalView.swift:245— TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× 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.
TodoComment Tests/SwiftTermTests/SgrTests.swift:212— // 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:1030— // 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:2096— // 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:1820— // 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:1942— // 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:2789— // // 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:5659— // 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:6438— // 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:6439— // 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:6511— // 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:6516— // 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:6623— // 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:9500— // 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:1446— // 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/MacKeyboardRouter.swift:739— // 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/Apple/AppleTerminalView.swift:3405— // 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.
Low cohesion: TerminalView (LCOM4 27) Sources/SwiftTerm/Mac/MacTerminalView.swift:105— TerminalView's methods fall into 27 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 27 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: LocalProcessTerminalView (LCOM4 8) Sources/SwiftTerm/Mac/MacLocalTerminalView.swift:245— LocalProcessTerminalView'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: 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: 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: TerminalRenderView (LCOM4 4) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:29— TerminalRenderView'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.
ClassTooLong: MetalTerminalRenderer Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1047— ClassTooLong — 2856 significant lines (blank, comment-only and punctuation-only lines excluded), 77 methods. The bar is 400 significant lines; this is 2456 over it, 7.14× 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 — 2498 significant lines (blank, comment-only and punctuation-only lines excluded), 159 methods. The bar is 400 significant lines; this is 2098 over it, 6.25× 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/Mac/MacTerminalView.swift:105— ClassTooLong — 2388 significant lines (blank, comment-only and punctuation-only lines excluded), 431 methods. The bar is 400 significant lines; this is 1988 over it, 5.97× 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 — 1172 significant lines (blank, comment-only and punctuation-only lines excluded), 79 methods. The bar is 400 significant lines; this is 772 over it, 2.93× 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: TerminalKeyboardRouter Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:144— ClassTooLong — 898 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 498 over it, 2.25× 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: TerminalBidi Sources/SwiftTerm/Apple/TerminalBidi.swift:80— ClassTooLong — 759 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods. The bar is 400 significant lines; this is 359 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.
ClassTooLong: SnapshotTextBuilder Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:118— ClassTooLong — 659 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 259 over it, 1.65× 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 — 631 significant lines (blank, comment-only and punctuation-only lines excluded), 56 methods. The bar is 400 significant lines; this is 231 over it, 1.58× 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 — 600 significant lines (blank, comment-only and punctuation-only lines excluded), 51 methods. The bar is 400 significant lines; this is 200 over it, 1.50× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: TerminalIOPipelineWorker Sources/SwiftTerm/TerminalIOPipeline.swift:284— ClassTooLong — 469 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 69 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.
ClassTooLong: CellArena Sources/SwiftTerm/CellStorage.swift:305— ClassTooLong — 450 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 50 over it, 1.13× 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.
Duplicated block (7 lines × 2) Sources/SwiftTerm/CellStorage.swift:698— Sources/SwiftTerm/CellStorage.swift:698-704 | Sources/SwiftTerm/CellStorage.swift:756-762 — 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:698` 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:7683— Sources/SwiftTerm/Terminal.swift:7683-7689 | Sources/SwiftTerm/Terminal.swift:7738-7744 — 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:7683` 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) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4221— Sources/SwiftTerm/iOS/iOSTerminalView.swift:4221-4227 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:4244-4250 — 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:4221` 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 (7 lines × 2) TerminalApp/MacTerminal/ViewController.swift:919— TerminalApp/MacTerminal/ViewController.swift:919-925 | TerminalApp/MacTerminal/ViewController.swift:987-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:919` 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 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 (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/MacTerminalRenderView.swift:582— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:582-588 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:584-590 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (7 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:1691— Sources/SwiftTerm/Mac/MacTerminalView.swift:1691-1697 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2007-2013 — 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:4190— Sources/SwiftTerm/Mac/MacTerminalView.swift:4190-4196 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3928-3934 — 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:4198— Sources/SwiftTerm/Mac/MacTerminalView.swift:4198-4204 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3864-3870 — 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/AppleTerminalView.swift:309— Sources/SwiftTerm/Apple/AppleTerminalView.swift:309-315 | Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:385-391 — 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:309` 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 (7 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2214— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2214-2220 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2430-2436 — 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/Apple/Metal/MetalTerminalRenderer.swift:3669— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3669-3674 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4125-4130 — 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/Terminal.swift:2625— Sources/SwiftTerm/Terminal.swift:2625-2630 | Sources/SwiftTerm/Terminal.swift:2652-2659 — 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:2625` 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:7693— Sources/SwiftTerm/Terminal.swift:7693-7698 | Sources/SwiftTerm/Terminal.swift:7748-7753 — 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:7693` 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:4189— Sources/SwiftTerm/iOS/iOSTerminalView.swift:4189-4194 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:4233-4238 — 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:4189` 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/KittyGraphics.swift:420— Sources/SwiftTerm/KittyGraphics.swift:420-425 | Sources/SwiftTerm/KittyGraphics.swift:427-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. ★ 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 (6 lines × 2) Sources/SwiftTermWebWasm/GraphicsExports.swift:59— Sources/SwiftTermWebWasm/GraphicsExports.swift:59-64 | Sources/SwiftTermWebWasm/GraphicsExports.swift:73-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:59` 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 × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3280— Sources/SwiftTerm/Apple/AppleTerminalView.swift:3280-3285 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3239-3244 — 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/Mac/MacTerminalRenderView.swift:358— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:358-363 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:354-359 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:508— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:508-513 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:512-517 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
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.
Duplicated block (6 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3534— Sources/SwiftTerm/Apple/AppleTerminalView.swift:3534-3539 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2707-2712 — 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/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/Apple/Metal/MetalTerminalRenderer.swift:2207— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2207-2212 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2424-2428 — 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/Metal/MetalTerminalRenderer.swift:2207` 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/Mac/MacKeyboardRouter.swift:1118— Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:1118-1122 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2826-2830 — 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/MacKeyboardRouter.swift:1118` 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/Mac/MacTerminalRenderView.swift:172— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:172-176 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:167-171 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:179— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:179-183 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:174-178 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (5 lines × 2) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:515— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:515-519 | Sources/SwiftTerm/Mac/MacTerminalView.swift:1177-1181 — 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 (5 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:3952— Sources/SwiftTerm/Mac/MacTerminalView.swift:3952-3956 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3660-3664 — 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/MacTerminalView.swift:4055— Sources/SwiftTerm/Mac/MacTerminalView.swift:4055-4059 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3753-3757 — 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:186— Sources/SwiftTerm/Apple/AppleTerminalView.swift:186-190 | Sources/SwiftTerm/Apple/AppleTerminalView.swift:216-220 — 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/AppleTerminalView.swift:186` 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) 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.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×9
Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:475— Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:475-485 | Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:487-497 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4220— Sources/SwiftTerm/iOS/iOSTerminalView.swift:4220-4230 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:4243-4253 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/ByteRunScanner.swift:20— Sources/SwiftTerm/ByteRunScanner.swift:20-30 | Sources/SwiftTerm/ByteRunScanner.swift:67-77 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) Sources/SwiftTermWebWasm/Exports.swift:148— Sources/SwiftTermWebWasm/Exports.swift:148-159 | Sources/SwiftTermWebWasm/SelectionExports.swift:3-13 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3710— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3710-3723 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3747-3757 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:841— Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:841-852 | Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:942-952 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift:4649— Sources/SwiftTerm/Apple/AppleTerminalView.swift:4649-4662 | Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:715-725 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/Locked.swift:115— Sources/SwiftTerm/Locked.swift:115-125 | Sources/SwiftTerm/Locked.swift:185-195 — These two members are one piece of code written twice and then edited apart: 11 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.
Edited copy of a member (11 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:1296— Sources/SwiftTerm/Mac/MacTerminalView.swift:1296-1306 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:1743-1753 — These two members are one piece of code written twice and then edited apart: 11 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· Edited copy of a member (9 corresponding lines) · ×9
Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:931— Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:931-939 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2551-2559 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/Mac/MacExtensions.swift:16— Sources/SwiftTerm/Mac/MacExtensions.swift:16-29 | Sources/SwiftTerm/iOS/iOSExtensions.swift:13-21 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:3051— Sources/SwiftTerm/Mac/MacTerminalView.swift:3051-3059 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:1009-1017 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/KittyGraphics.swift:2160— Sources/SwiftTerm/KittyGraphics.swift:2160-2168 | Sources/SwiftTerm/KittyGraphics.swift:2184-2196 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/KittyGraphics.swift:2100— Sources/SwiftTerm/KittyGraphics.swift:2100-2110 | Sources/SwiftTerm/KittyGraphics.swift:2204-2212 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:4089— Sources/SwiftTerm/Mac/MacTerminalView.swift:4089-4097 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3829-3837 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/Profiling.swift:236— Sources/SwiftTerm/Profiling.swift:236-244 | Sources/SwiftTerm/Profiling.swift:246-254 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:1228— Sources/SwiftTerm/Mac/MacTerminalView.swift:1228-1237 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:685-693 — These two members are one piece of code written twice and then edited apart: 9 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.
Edited copy of a member (9 corresponding lines) Tools/SwiftTermBenchmarks/Sources/VTEBenchWorkloads/VTEBenchWorkload.swift:387— Tools/SwiftTermBenchmarks/Sources/VTEBenchWorkloads/VTEBenchWorkload.swift:387-397 | Tools/SwiftTermBenchmarks/Sources/VTEBenchWorkloads/VTEBenchWorkload.swift:399-407 — These two members are one piece of code written twice and then edited apart: 9 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.
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:3929— Sources/SwiftTerm/Apple/AppleTerminalView.swift:3929-3938 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2805-2814 — 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:3929` 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/TerminalBidi.swift:760— Sources/SwiftTerm/Apple/TerminalBidi.swift:760-769 | Sources/SwiftTerm/Apple/TerminalBidi.swift:1075-1084 — 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:760` 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:2956— Sources/SwiftTerm/Mac/MacTerminalView.swift:2956-2965 | 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:2956` 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) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3287— Sources/SwiftTerm/Apple/AppleTerminalView.swift:3287-3296 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3246-3255 — 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) TerminalApp/MacTerminal/ViewController.swift:939— TerminalApp/MacTerminal/ViewController.swift:939-948 | TerminalApp/MacTerminal/ViewController.swift:1003-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:939` 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) 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/MacCaretView.swift:94— Sources/SwiftTerm/Mac/MacCaretView.swift:94-103 | Sources/SwiftTerm/iOS/iOSCaretView.swift:120-129 — 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:1285— Sources/SwiftTerm/Mac/MacTerminalView.swift:1285-1294 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:1732-1741 — 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 (8 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:727— Sources/SwiftTerm/Apple/AppleTerminalView.swift:727-734 | Sources/SwiftTerm/Apple/TerminalSnapshot.swift:254-261 — 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/KittyGraphics.swift:2161— Sources/SwiftTerm/KittyGraphics.swift:2161-2168 | Sources/SwiftTerm/KittyGraphics.swift:2189-2196 — 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:2189` 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 `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 (8 lines × 2) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:499— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:499-506 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:503-510 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:499` 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 (8 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4090— Sources/SwiftTerm/Mac/MacTerminalView.swift:4090-4097 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3830-3837 — 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:2652— Sources/SwiftTerm/Terminal.swift:2652-2659 | Sources/SwiftTerm/Terminal.swift:2665-2672 — 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.
Duplicated block (8 lines × 2) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:349— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:349-356 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:345-352 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:365— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:365-372 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:361-368 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (8 lines × 2) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:539— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:539-546 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:542-549 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×8
Edited copy of a member (14 corresponding lines) Sources/SwiftTerm/LineChangeTracker.swift:58— Sources/SwiftTerm/LineChangeTracker.swift:58-71 | Sources/SwiftTerm/LineChangeTracker.swift:79-98 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:300— Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:300-313 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2268-2291 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:222— Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:222-235 | Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:239-254 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) Sources/SwiftTerm/CircularList.swift:588— Sources/SwiftTerm/CircularList.swift:588-606 | Sources/SwiftTerm/CircularList.swift:610-623 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) Sources/SwiftTerm/Terminal.swift:3775— Sources/SwiftTerm/Terminal.swift:3775-3788 | Sources/SwiftTerm/Terminal.swift:3791-3804 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:4099— Sources/SwiftTerm/Mac/MacTerminalView.swift:4099-4115 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3077-3090 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) Sources/SwiftTerm/Terminal.swift:6983— Sources/SwiftTerm/Terminal.swift:6983-6996 | Sources/SwiftTerm/Terminal.swift:7227-7240 — These two members are one piece of code written twice and then edited apart: 14 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.
Edited copy of a member (14 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:428— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:428-441 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:424-437 — These two members are one piece of code written twice and then edited apart: 14 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.
Duplicated block (11 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3134— Sources/SwiftTerm/Apple/AppleTerminalView.swift:3134-3144 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4506-4516 — 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:3306-3316 — 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:2773— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2773-2783 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2786-2796 — 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/Mac/MacTerminalView.swift:603— Sources/SwiftTerm/Mac/MacTerminalView.swift:603-613 | 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:3586— Sources/SwiftTerm/Mac/MacTerminalView.swift:3586-3596 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:1645-1655 — 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:3586` 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:1644` calls `calculateTapHit` and `Sources/SwiftTerm/Mac/MacTerminalView.swift:3585` 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/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:2485— Sources/SwiftTerm/Terminal.swift:2485-2495 | Sources/SwiftTerm/Terminal.swift:2518-2529 — 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:2518` 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.
Duplicated block (11 lines × 2) Sources/SwiftTerm/Terminal.swift:7665— Sources/SwiftTerm/Terminal.swift:7665-7675 | Sources/SwiftTerm/Terminal.swift:7720-7730 — 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:7665` 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 (9 lines × 2) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4625— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4625-4633 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4650-4658 — 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/Apple/TerminalSnapshot.swift:461— Sources/SwiftTerm/Apple/TerminalSnapshot.swift:461-469 | Sources/SwiftTerm/Apple/TerminalSnapshot.swift:712-720 — 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:832— Sources/SwiftTerm/CellStorage.swift:832-840 | Sources/SwiftTerm/CellStorage.swift:848-856 — 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:832` 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:4045— Sources/SwiftTerm/Mac/MacTerminalView.swift:4045-4053 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3743-3751 — 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:4045` 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.
Duplicated block (9 lines × 2) Tools/BidiHarness/BidiHarness/ArtifactCapture.swift:158— Tools/BidiHarness/BidiHarness/ArtifactCapture.swift:158-166 | Tools/BidiHarness/BidiHarness/SocketControlServer.swift:36-44 — 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 `Tools/BidiHarness/BidiHarness/ArtifactCapture.swift:158` 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· Edited copy of a member (17 corresponding lines) · ×7
Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/iOS/iOSDoubleButton.swift:93— Sources/SwiftTerm/iOS/iOSDoubleButton.swift:93-110 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3634-3650 — These two members are one piece of code written twice and then edited apart: 17 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.
Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3852— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3852-3868 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3907-3932 — These two members are one piece of code written twice and then edited apart: 17 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.
Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/CellStorage.swift:692— Sources/SwiftTerm/CellStorage.swift:692-709 | Sources/SwiftTerm/CellStorage.swift:751-767 — These two members are one piece of code written twice and then edited apart: 17 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.
Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/KittyKeyboardEncoder.swift:508— Sources/SwiftTerm/KittyKeyboardEncoder.swift:508-531 | Sources/SwiftTerm/KittyKeyboardEncoder.swift:533-549 — These two members are one piece of code written twice and then edited apart: 17 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.
Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/CellStorage.swift:148— Sources/SwiftTerm/CellStorage.swift:148-166 | Sources/SwiftTerm/CellStorage.swift:170-186 — These two members are one piece of code written twice and then edited apart: 17 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.
Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/SearchService.swift:57— Sources/SwiftTerm/SearchService.swift:57-73 | Sources/SwiftTerm/SearchService.swift:75-91 — These two members are one piece of code written twice and then edited apart: 17 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.
Edited copy of a member (17 corresponding lines) Sources/SwiftTerm/Terminal.swift:10355— Sources/SwiftTerm/Terminal.swift:10355-10371 | Sources/SwiftTerm/Terminal.swift:10373-10394 — These two members are one piece of code written twice and then edited apart: 17 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· Edited copy of a member (23 corresponding lines) · ×6
Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:374— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:374-396 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:370-392 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/BufferLine.swift:696— Sources/SwiftTerm/BufferLine.swift:696-718 | Sources/SwiftTerm/BufferLine.swift:727-749 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4620— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4620-4642 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4644-4669 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2927— Sources/SwiftTerm/Apple/AppleTerminalView.swift:2927-2949 | Sources/SwiftTerm/Terminal.swift:9945-9967 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/TerminalViewSearch.swift:21— Sources/SwiftTerm/TerminalViewSearch.swift:21-43 | Sources/SwiftTerm/TerminalViewSearch.swift:51-73 — These two members are one piece of code written twice and then edited apart: 23 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.
Edited copy of a member (23 corresponding lines) Sources/SwiftTerm/Terminal.swift:8130— Sources/SwiftTerm/Terminal.swift:8130-8152 | Sources/SwiftTerm/Terminal.swift:8155-8178 — These two members are one piece of code written twice and then edited apart: 23 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· Edited copy of a member (13 corresponding lines) · ×6
Edited copy of a member (13 corresponding lines) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:1319— Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:1319-1331 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2800-2813 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) Sources/SwiftTerm/Terminal.swift:2717— Sources/SwiftTerm/Terminal.swift:2717-2729 | Sources/SwiftTerm/Terminal.swift:2731-2743 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift:910— Sources/SwiftTerm/Apple/AppleTerminalView.swift:910-922 | Sources/SwiftTerm/Apple/AppleTerminalView.swift:3091-3107 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) Sources/SwiftTerm/Terminal.swift:8351— Sources/SwiftTerm/Terminal.swift:8351-8365 | Sources/SwiftTerm/Terminal.swift:8413-8425 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) TerminalApp/iOSTerminal/UIKitSshTerminalView.swift:264— TerminalApp/iOSTerminal/UIKitSshTerminalView.swift:264-277 | TerminalApp/iOSTerminal/UIKitSshTerminalView.swift:318-330 — These two members are one piece of code written twice and then edited apart: 13 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.
Edited copy of a member (13 corresponding lines) Sources/SwiftTerm/Terminal.swift:7425— Sources/SwiftTerm/Terminal.swift:7425-7437 | Sources/SwiftTerm/Terminal.swift:7444-7456 — These two members are one piece of code written twice and then edited apart: 13 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.
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:326— Sources/SwiftTerm/ByteRunScanner.swift:326-337 | Sources/SwiftTerm/ByteRunScanner.swift:359-370 — 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:326` 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:639— Sources/SwiftTerm/Mac/MacTerminalView.swift:639-650 | 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· Edited copy of a member (10 corresponding lines) · ×5
Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/Mac/MacExtensions.swift:44— Sources/SwiftTerm/Mac/MacExtensions.swift:44-56 | Sources/SwiftTerm/iOS/iOSExtensions.swift:32-41 — 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.
Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:338— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:338-347 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:334-343 — 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.
Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4188— Sources/SwiftTerm/iOS/iOSTerminalView.swift:4188-4197 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:4232-4241 — 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.
Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/CellStorage.swift:546— Sources/SwiftTerm/CellStorage.swift:546-559 | Sources/SwiftTerm/CellStorage.swift:563-572 — 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.
Edited copy of a member (10 corresponding lines) Sources/SwiftTerm/HangulInput.swift:189— Sources/SwiftTerm/HangulInput.swift:189-198 | Sources/SwiftTerm/HangulInput.swift:203-213 — 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· Edited copy of a member (15 corresponding lines) · ×4
Edited copy of a member (15 corresponding lines) Sources/SwiftTerm/Profiling.swift:568— Sources/SwiftTerm/Profiling.swift:568-587 | Sources/SwiftTerm/Profiling.swift:589-603 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:244— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:244-258 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:249-265 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) Sources/SwiftTerm/Apple/TerminalBidi.swift:1124— Sources/SwiftTerm/Apple/TerminalBidi.swift:1124-1141 | Sources/SwiftTerm/Apple/TerminalBidi.swift:1143-1157 — These two members are one piece of code written twice and then edited apart: 15 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.
Edited copy of a member (15 corresponding lines) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1236— Sources/SwiftTerm/iOS/iOSTerminalView.swift:1236-1250 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:1352-1366 — These two members are one piece of code written twice and then edited apart: 15 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· Edited copy of a member (16 corresponding lines) · ×4
Edited copy of a member (16 corresponding lines) Sources/SwiftTerm/CellStorage.swift:831— Sources/SwiftTerm/CellStorage.swift:831-846 | Sources/SwiftTerm/CellStorage.swift:847-863 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:4037— Sources/SwiftTerm/Mac/MacTerminalView.swift:4037-4053 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3736-3751 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) Sources/SwiftTerm/Terminal.swift:4491— Sources/SwiftTerm/Terminal.swift:4491-4506 | Sources/SwiftTerm/Terminal.swift:4512-4532 — These two members are one piece of code written twice and then edited apart: 16 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.
Edited copy of a member (16 corresponding lines) Tools/SwiftTermBenchmarks/Sources/VTEBenchWorkloads/VTEBenchWorkload.swift:347— Tools/SwiftTermBenchmarks/Sources/VTEBenchWorkloads/VTEBenchWorkload.swift:347-365 | Tools/SwiftTermBenchmarks/Sources/VTEBenchWorkloads/VTEBenchWorkload.swift:370-385 — These two members are one piece of code written twice and then edited apart: 16 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· Edited copy of a member (12 corresponding lines) · ×4
Edited copy of a member (12 corresponding lines) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:1117— Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:1117-1128 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2825-2836 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) Sources/SwiftTerm/Mac/MacLocalTerminalView.swift:190— Sources/SwiftTerm/Mac/MacLocalTerminalView.swift:190-201 | Sources/SwiftTerm/Mac/MacLocalTerminalView.swift:203-214 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) Sources/SwiftTerm/CellStorage.swift:909— Sources/SwiftTerm/CellStorage.swift:909-920 | Sources/SwiftTermWebWasm/SnapshotEncoder.swift:19-32 — These two members are one piece of code written twice and then edited apart: 12 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.
Edited copy of a member (12 corresponding lines) Sources/SwiftTermWebWasm/GraphicsExports.swift:172— Sources/SwiftTermWebWasm/GraphicsExports.swift:172-183 | Sources/SwiftTermWebWasm/GraphicsExports.swift:200-211 — These two members are one piece of code written twice and then edited apart: 12 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· Edited copy of a member (6 corresponding lines) · ×4
Edited copy of a member (6 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:153— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:153-158 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:149-154 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:161— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:161-167 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:157-162 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift:1880— Sources/SwiftTerm/Apple/AppleTerminalView.swift:1880-1886 | Sources/SwiftTerm/Terminal.swift:1880-1885 — These two members are one piece of code written twice and then edited apart: 6 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.
Edited copy of a member (6 corresponding lines) Sources/SwiftTerm/DECPrivateModes.swift:32— Sources/SwiftTerm/DECPrivateModes.swift:32-37 | Sources/SwiftTerm/KittyGraphicsSnapshot.swift:37-42 — These two members are one piece of code written twice and then edited apart: 6 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· Edited copy of a member (7 corresponding lines) · ×4
Edited copy of a member (7 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:1723— Sources/SwiftTerm/Mac/MacTerminalView.swift:1723-1729 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2018-2024 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:559— Sources/SwiftTerm/Mac/MacTerminalView.swift:559-567 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:452-458 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:4081— Sources/SwiftTerm/Mac/MacTerminalView.swift:4081-4087 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3821-3827 — These two members are one piece of code written twice and then edited apart: 7 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.
Edited copy of a member (7 corresponding lines) Sources/SwiftTerm/Mac/MacExtensions.swift:64— Sources/SwiftTerm/Mac/MacExtensions.swift:64-71 | Sources/SwiftTerm/iOS/iOSExtensions.swift:52-58 — These two members are one piece of code written twice and then edited apart: 7 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· Edited copy of a member (8 corresponding lines) · ×4
Edited copy of a member (8 corresponding lines) Sources/SwiftTerm/TerminalIOPipeline.swift:60— Sources/SwiftTerm/TerminalIOPipeline.swift:60-67 | Sources/SwiftTerm/TerminalIOPipeline.swift:69-76 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) Sources/SwiftTerm/Terminal.swift:4653— Sources/SwiftTerm/Terminal.swift:4653-4660 | Sources/SwiftTerm/Terminal.swift:7615-7623 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) Sources/SwiftTerm/KittyKeyboardEncoder.swift:935— Sources/SwiftTerm/KittyKeyboardEncoder.swift:935-942 | Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:1346-1354 — These two members are one piece of code written twice and then edited apart: 8 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.
Edited copy of a member (8 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:579— Sources/SwiftTerm/Mac/MacTerminalView.swift:579-586 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:469-477 — These two members are one piece of code written twice and then edited apart: 8 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.
FixmeComment Sources/SwiftTerm/Terminal.swift:2790— // // 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:2810— // // 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:2814— // // 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· Edited copy of a member (19 corresponding lines) · ×3
Edited copy of a member (19 corresponding lines) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4140— Sources/SwiftTerm/iOS/iOSTerminalView.swift:4140-4158 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:4166-4186 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) Sources/SwiftTermWebWasm/Exports.swift:89— Sources/SwiftTermWebWasm/Exports.swift:89-108 | Sources/SwiftTermWebWasm/Exports.swift:110-128 — These two members are one piece of code written twice and then edited apart: 19 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.
Edited copy of a member (19 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:1246— Sources/SwiftTerm/Mac/MacTerminalView.swift:1246-1271 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:702-720 — These two members are one piece of code written twice and then edited apart: 19 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· Edited copy of a member (5 corresponding lines) · ×3
Edited copy of a member (5 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:143— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:143-147 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:139-143 — These two members are one piece of code written twice and then edited apart: 5 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.
Edited copy of a member (5 corresponding lines) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:28— Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:28-34 | Sources/SwiftTerm/SearchOptions.swift:21-25 — These two members are one piece of code written twice and then edited apart: 5 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.
Edited copy of a member (5 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:1221— Sources/SwiftTerm/Mac/MacTerminalView.swift:1221-1226 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:679-683 — These two members are one piece of code written twice and then edited apart: 5 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.
Duplicated block (13 lines × 2) Sources/SwiftTerm/Apple/TerminalSnapshot.swift:566— Sources/SwiftTerm/Apple/TerminalSnapshot.swift:566-578 | Sources/SwiftTerm/Apple/TerminalSnapshot.swift:809-821 — 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/TerminalSnapshot.swift:566` 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 after the matched lines, `Sources/SwiftTerm/Apple/TerminalSnapshot.swift:581` calls `completePendingBidi` and `Sources/SwiftTerm/Apple/TerminalSnapshot.swift:823` 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 (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:846— Sources/SwiftTerm/SelectionService.swift:846-858 | Sources/SwiftTerm/SelectionService.swift:884-896 — 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:846` 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 (7–8 lines × 2) Sources/SwiftTerm/CellStorage.swift:457— Sources/SwiftTerm/CellStorage.swift:457-464 | Sources/SwiftTerm/CellStorage.swift:629-635 — 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:628` 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:3890— Sources/SwiftTerm/Mac/MacTerminalView.swift:3890-3896 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2042-2049 — 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:3890` 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.
Duplicated block (7–8 lines × 2) Sources/SwiftTerm/Terminal.swift:6707— Sources/SwiftTerm/Terminal.swift:6707-6713 | Sources/SwiftTerm/Terminal.swift:6715-6722 — 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:6715` 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.
Duplicated block (6 lines × 3) Sources/SwiftTerm/ByteRunScanner.swift:36— Sources/SwiftTerm/ByteRunScanner.swift:36-41 | Sources/SwiftTerm/ByteRunScanner.swift:83-88 | Sources/SwiftTerm/ByteRunScanner.swift:120-126 — 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/Terminal.swift:6707— Sources/SwiftTerm/Terminal.swift:6707-6712 | Sources/SwiftTerm/Terminal.swift:6715-6720 | Sources/SwiftTerm/Terminal.swift:6736-6741 — 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:6707` 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) 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.
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.
Terminal.handlePrintSlow::batchableScalar (cyclomatic 23) Sources/SwiftTerm/Terminal.swift:2237— Terminal.handlePrintSlow::batchableScalar 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. 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 (cyclomatic 18) Sources/SwiftTerm/Terminal.swift:2342— Terminal.handlePrintSlow::insertScalarBatch 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. 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 (cognitive 31) Sources/SwiftTerm/Terminal.swift:2237— Terminal.handlePrintSlow::batchableScalar has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 11, ternaries 4 (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. 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 20) Sources/SwiftTerm/Terminal.swift:2342— Terminal.handlePrintSlow::insertScalarBatch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition. 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.
FunctionTooLong: AppleTerminalView.swift.top-level code Sources/SwiftTerm/Apple/AppleTerminalView.swift:21— FunctionTooLong — top-level code 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.
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.
Change coupling: CircularList.swift ↔ MacDebugView.swift Sources/SwiftTerm/CircularList.swift:1— `Sources/SwiftTerm/CircularList.swift` and `Sources/SwiftTerm/Mac/MacDebugView.swift` change together 54% of the time (7 of the 13 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 7 shared commits counted here, the most recent 3 are `fe3f9e5e` Store terminal rows as compact packed cells; `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 … — run `git show` on any of them.
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.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×2
Edited copy of a member (30 corresponding lines) Sources/SwiftTerm/BufferLine.swift:393— Sources/SwiftTerm/BufferLine.swift:393-424 | Sources/SwiftTerm/BufferLine.swift:426-455 — These two members are one piece of code written twice and then edited apart: 30 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.
Edited copy of a member (30 corresponding lines) Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:405— Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:405-434 | Sources/SwiftTerm/Apple/BoxDrawingRenderer.swift:436-465 — These two members are one piece of code written twice and then edited apart: 30 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· Edited copy of a member (37 corresponding lines) · ×2
Edited copy of a member (37 corresponding lines) Sources/SwiftTerm/KittyGraphics.swift:1292— Sources/SwiftTerm/KittyGraphics.swift:1292-1332 | Sources/SwiftTerm/KittyGraphics.swift:1334-1370 — These two members are one piece of code written twice and then edited apart: 37 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.
Edited copy of a member (37 corresponding lines) Sources/SwiftTerm/CircularList.swift:127— Sources/SwiftTerm/CircularList.swift:127-163 | Sources/SwiftTerm/CircularList.swift:487-531 — These two members are one piece of code written twice and then edited apart: 37 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· Edited copy of a member (24 corresponding lines) · ×2
Edited copy of a member (24 corresponding lines) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4441— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4441-4464 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4595-4618 — These two members are one piece of code written twice and then edited apart: 24 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.
Edited copy of a member (24 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:483— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:483-506 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:487-510 — These two members are one piece of code written twice and then edited apart: 24 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· Edited copy of a member (42 corresponding lines) · ×2
Edited copy of a member (42 corresponding lines) Sources/SwiftTerm/CircularList.swift:172— Sources/SwiftTerm/CircularList.swift:172-214 | Sources/SwiftTerm/CircularList.swift:543-584 — These two members are one piece of code written twice and then edited apart: 42 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.
Edited copy of a member (42 corresponding lines) Sources/SwiftTerm/Buffer.swift:1890— Sources/SwiftTerm/Buffer.swift:1890-1931 | Sources/SwiftTerm/Buffer.swift:1936-1983 — These two members are one piece of code written twice and then edited apart: 42 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· Edited copy of a member (22 corresponding lines) · ×2
Edited copy of a member (22 corresponding lines) Sources/SwiftTerm/iOS/iOSTerminalView.swift:2944— Sources/SwiftTerm/iOS/iOSTerminalView.swift:2944-2965 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3019-3045 — These two members are one piece of code written twice and then edited apart: 22 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.
Edited copy of a member (22 corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift:169— Sources/SwiftTerm/Apple/AppleTerminalView.swift:169-190 | Sources/SwiftTerm/Apple/AppleTerminalView.swift:195-220 — These two members are one piece of code written twice and then edited apart: 22 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· Edited copies of one member (3 members, 15+ corresponding lines) · ×2
Edited copies of one member (3 members, 15+ corresponding lines) Sources/SwiftTerm/ByteRunScanner.swift:152— Sources/SwiftTerm/ByteRunScanner.swift:152-166 | Sources/SwiftTerm/ByteRunScanner.swift:168-182 | Sources/SwiftTerm/ByteRunScanner.swift:184-202 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 15+ corresponding lines) scripts/regen_unicode_width_data.py:255— scripts/regen_unicode_width_data.py:255-269 | scripts/regen_unicode_width_data.py:273-287 | scripts/regen_unicode_width_data.py:291-305 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, 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 out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 6+ corresponding lines) · ×2
Edited copies of one member (3 members, 6+ corresponding lines) Sources/SwiftTermWebWasm/Exports.swift:196— Sources/SwiftTermWebWasm/Exports.swift:196-201 | Sources/SwiftTermWebWasm/GraphicsExports.swift:185-190 | Sources/SwiftTermWebWasm/InputExports.swift:13-18 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, 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 out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 6+ corresponding lines) Sources/SwiftTermWebWasm/Exports.swift:222— Sources/SwiftTermWebWasm/Exports.swift:222-227 | Sources/SwiftTermWebWasm/GraphicsExports.swift:185-190 | Sources/SwiftTermWebWasm/InputExports.swift:6-11 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, 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 out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (3 corresponding lines) · ×2
Edited copy of a member (3 corresponding lines) Sources/SwiftTerm/Portable/WASIHostEvents.swift:13— Sources/SwiftTerm/Portable/WASIHostEvents.swift:13-15 | Sources/SwiftTerm/TerminalLock.swift:116-119 — These two members are one piece of code written twice and then edited apart: 3 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.
Edited copy of a member (3 corresponding lines) Sources/SwiftTerm/Portable/WASIHostEvents.swift:16— Sources/SwiftTerm/Portable/WASIHostEvents.swift:16-18 | Sources/SwiftTerm/TerminalLock.swift:109-114 — These two members are one piece of code written twice and then edited apart: 3 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· Edited copy of a member (4 corresponding lines) · ×2
Edited copy of a member (4 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:3046— Sources/SwiftTerm/Mac/MacTerminalView.swift:3046-3049 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:1004-1007 — These two members are one piece of code written twice and then edited apart: 4 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.
Edited copy of a member (4 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:221— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:221-224 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:220-223 — These two members are one piece of code written twice and then edited apart: 4 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.
Duplicated block (20 lines × 2) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:398— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:398-417 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:394-413 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:398` 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 (20 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4206— Sources/SwiftTerm/Mac/MacTerminalView.swift:4206-4225 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3872-3891 — 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 (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:2928— Sources/SwiftTerm/Mac/MacTerminalView.swift:2928-2942 | 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:2928` 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 (14 lines × 2) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:483— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:483-496 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:487-500 — before extracting anything, compare `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift` and `Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 95 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:483` 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 (14 lines × 2) Sources/SwiftTerm/iOS/iOSTerminalView.swift:2997— Sources/SwiftTerm/iOS/iOSTerminalView.swift:2997-3010 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3030-3043 — 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 × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2565— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2565-2575 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2596-2606 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2618-2628 — 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 (11 lines × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1982— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1982-1992 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2011-2021 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2035-2045 — 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:1982` 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 (8 lines × 3) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2770— Sources/SwiftTerm/Apple/AppleTerminalView.swift:2770-2777 | Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:375-382 | Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:1192-1199 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SwiftTerm/Apple/AppleTerminalView.swift:2770` 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 (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.
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.04, instability 0.00, distance 0.96 — zone of pain — concrete and depended on by 8 project(s), so it's rigid to change.
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.
TerminalView.pressesBegan (cyclomatic 116) Sources/SwiftTerm/iOS/iOSTerminalView.swift:3239— 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.
EscapeSequenceParser.parseBorrowed (cyclomatic 115) Sources/SwiftTerm/EscapeSequenceParser.swift:1195— EscapeSequenceParser.parseBorrowed has cyclomatic complexity 115 (threshold 15). Of this number, 111 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.
TerminalKeyboardRouter.keyDown (cyclomatic 105) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:267— TerminalKeyboardRouter.keyDown has cyclomatic complexity 105 (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.
CoreGraphicsPaintHost.drawTerminalContents (cyclomatic 101) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3406— CoreGraphicsPaintHost.drawTerminalContents has cyclomatic complexity 101 (threshold 15). Of this number, 87 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.
Terminal.cmdDecRqm (cyclomatic 92) Sources/SwiftTerm/Terminal.swift:6181— Terminal.cmdDecRqm has cyclomatic complexity 92 (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.
TerminalKeyboardRouter.kittyFunctionalKey (cyclomatic 82) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:941— TerminalKeyboardRouter.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.
SnapshotTextBuilder.buildAttributedString (cyclomatic 72) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:454— SnapshotTextBuilder.buildAttributedString has cyclomatic complexity 72 (threshold 15). Of this number, 70 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.
TerminalKeyboardRouter.doCommand (cyclomatic 68) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:631— TerminalKeyboardRouter.doCommand has cyclomatic complexity 68 (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.
EscapeSequenceParser.dispatchCsi (cyclomatic 63) Sources/SwiftTerm/EscapeSequenceParser.swift:619— EscapeSequenceParser.dispatchCsi has cyclomatic complexity 63 (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.
MetalTerminalRenderer.prepareRow (cyclomatic 59) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1923— 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.
MetalTerminalRenderer.placeRow (cyclomatic 59) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2481— 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.
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.
Terminal.cmdCharAttributes (cyclomatic 58) Sources/SwiftTerm/Terminal.swift:6632— 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.
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.
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.
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.
TerminalSnapshot.refresh (cyclomatic 51) Sources/SwiftTerm/Apple/TerminalSnapshot.swift:611— TerminalSnapshot.refresh has cyclomatic complexity 51 (threshold 15). Of this number, 48 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.
Terminal.handlePrintSlow (cyclomatic 49) Sources/SwiftTerm/Terminal.swift:2153— Terminal.handlePrintSlow has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: 2 other methods here (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.
TerminalIOPipelineWorker.gatherMain (cyclomatic 48) Sources/SwiftTerm/TerminalIOPipeline.swift:595— 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.
Terminal.makeRenderSnapshot (cyclomatic 44) Sources/SwiftTerm/Terminal.swift:8214— 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.
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.
Terminal.cmdWindowOptions (cyclomatic 42) Sources/SwiftTerm/Terminal.swift:5597— Terminal.cmdWindowOptions has cyclomatic complexity 42 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
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.
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.
Terminal.setMode (cyclomatic 41) Sources/SwiftTerm/Terminal.swift:7242— Terminal.setMode 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.
TerminalSnapshot.refresh (cyclomatic 40) Sources/SwiftTerm/Apple/TerminalSnapshot.swift:345— 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.
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.
Terminal.resetMode (cyclomatic 39) Sources/SwiftTerm/Terminal.swift:7026— Terminal.resetMode 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.
MetalTerminalRenderer.buildCursorDrawData (cyclomatic 39) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3934— MetalTerminalRenderer.buildCursorDrawData 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.
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.
EscapeSequenceParser.dispatchEsc (cyclomatic 36) Sources/SwiftTerm/EscapeSequenceParser.swift:725— 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.
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.
TerminalBidi.shapeArabic (cyclomatic 35) Sources/SwiftTerm/Apple/TerminalBidi.swift:380— 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.
MetalTerminalRenderer.render (cyclomatic 35) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1339— 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.
Terminal.osciTerm2 (cyclomatic 33) Sources/SwiftTerm/Terminal.swift:4197— 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.
Terminal.csiCopyRectangularArea (cyclomatic 31) Sources/SwiftTerm/Terminal.swift:5244— Terminal.csiCopyRectangularArea 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.
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.
TerminalBidi.buildParagraph (cyclomatic 31) Sources/SwiftTerm/Apple/TerminalBidi.swift:708— 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.
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.
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.
Buffer.reflowNarrower (cyclomatic 30) Sources/SwiftTerm/Buffer.swift:1632— Buffer.reflowNarrower 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.
SelectionService.urlRange (cyclomatic 30) Sources/SwiftTerm/SelectionService.swift:1305— 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.
Terminal.buildGhosttyImplicitLineMap (cyclomatic 30) Sources/SwiftTerm/Terminal.swift:10071— 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.
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.
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.
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.
TerminalView.scrollWheel (cyclomatic 29) Sources/SwiftTerm/Mac/MacTerminalView.swift:3731— 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.
BufferLine.copyFrom (cyclomatic 28) Sources/SwiftTerm/BufferLine.swift:946— BufferLine.copyFrom 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.
Terminal.implicitLinkMatch (cyclomatic 28) Sources/SwiftTerm/Terminal.swift:9832— 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.
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.
Buffer.resize (cyclomatic 27) Sources/SwiftTerm/Buffer.swift:1045— 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.
Terminal.sendHostMouse (cyclomatic 27) Sources/SwiftTerm/Terminal.swift:9464— 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.
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.
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.
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.
Terminal.oscSemanticPrompt (cyclomatic 25) Sources/SwiftTerm/Terminal.swift:3641— 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.
Terminal.scrollGeneral (cyclomatic 25) Sources/SwiftTerm/Terminal.swift:8682— Terminal.scrollGeneral 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.
TerminalContentSnapshot.exportPieces (cyclomatic 25) Sources/SwiftTerm/TerminalContentSnapshot.swift:314— TerminalContentSnapshot.exportPieces 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.
MetalTerminalRenderer.buildDrawDataPass (cyclomatic 25) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1684— 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.
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.
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.
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.
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.
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.
TerminalView.sendKittyTextInput (cyclomatic 24) Sources/SwiftTerm/iOS/iOSTerminalView.swift:2845— 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.
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.
Terminal.cmdDeviceStatus (cyclomatic 23) Sources/SwiftTerm/Terminal.swift:6472— 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.
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.
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.
CoreGraphicsPaintHost.drawRunAttributes (cyclomatic 23) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3147— CoreGraphicsPaintHost.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.
TerminalBidi.computeVisualOrder (cyclomatic 23) Sources/SwiftTerm/Apple/TerminalBidi.swift:283— 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.
TerminalView.mouseUp (cyclomatic 23) Sources/SwiftTerm/Mac/MacTerminalView.swift:3288— 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.
Color.parseColor (cyclomatic 22) Sources/SwiftTerm/Colors.swift:405— 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.
SelectionService.pathRange (cyclomatic 22) Sources/SwiftTerm/SelectionService.swift:1394— 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.
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.
SnapshotTextBuilder.plainRow (cyclomatic 22) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:779— SnapshotTextBuilder.plainRow 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.
SnapshotTextBuilder.sameAttributes (cyclomatic 22) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:997— 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.
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.
TerminalView.accessibilityAttributedDisplayTextLocked (cyclomatic 22) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4033— 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.
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.
Attribute.sgrParameters (cyclomatic 21) Sources/SwiftTerm/CharData.swift:142— Attribute.sgrParameters 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.
Terminal.applyDECPrivateMode (cyclomatic 21) Sources/SwiftTerm/Terminal.swift:6092— Terminal.applyDECPrivateMode has cyclomatic complexity 21 (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.
TerminalKeyboardRouter.insertText (cyclomatic 21) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:757— TerminalKeyboardRouter.insertText has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
TerminalView.getAttributes (cyclomatic 21) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2712— 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.
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.
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.
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.
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.
Terminal.parseSemanticPromptOptions (cyclomatic 20) Sources/SwiftTerm/Terminal.swift:3588— 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.
Terminal.cmdEraseInDisplay (cyclomatic 20) Sources/SwiftTerm/Terminal.swift:4839— 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.
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.
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.
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.
TerminalView.insertImage (cyclomatic 20) Sources/SwiftTerm/Apple/AppleTerminalView.swift:5105— 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.
TerminalView.forwardWheel (cyclomatic 20) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1274— 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.
Buffer.semanticPromptInvariantsHold (cyclomatic 19) Sources/SwiftTerm/Buffer.swift:1225— 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.
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.
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.
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.
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.
Terminal.scanUserInputForSubmission (cyclomatic 19) Sources/SwiftTerm/Terminal.swift:3164— 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.
Terminal.handleSemanticPromptClick (cyclomatic 19) Sources/SwiftTerm/Terminal.swift:3517— 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.
Terminal.cmdSendDeviceAttributes (cyclomatic 19) Sources/SwiftTerm/Terminal.swift:7496— 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.
Terminal.scroll (cyclomatic 19) Sources/SwiftTerm/Terminal.swift:8622— 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.
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.
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.
UnicodeUtil.graphemeJoinNonEmojiModifier (cyclomatic 19) Sources/SwiftTerm/Utilities.swift:428— 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.
SnapshotTextBuilder.buildAttributes (cyclomatic 19) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:307— 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.
MetalTerminalRenderer.glyphEntry (cyclomatic 19) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3083— 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.
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.
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.
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.
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.
Buffer.getLinesToRemove (cyclomatic 18) Sources/SwiftTerm/Buffer.swift:1399— 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.
Buffer.insertScalarRun (cyclomatic 18) Sources/SwiftTerm/Buffer.swift:2005— Buffer.insertScalarRun 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.
Buffer.insertCharacter (cyclomatic 18) Sources/SwiftTerm/Buffer.swift:2077— Buffer.insertCharacter 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.
EscapeSequenceParser.simpleCsiLength (cyclomatic 18) Sources/SwiftTerm/EscapeSequenceParser.swift:933— EscapeSequenceParser.simpleCsiLength 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: EscapeSequenceParser.dispatchOsc (cyclomatic 24) 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.
EscapeSequenceParser.appendOscBytes (cyclomatic 18) Sources/SwiftTerm/EscapeSequenceParser.swift:1047— 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 24) 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.
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.
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.
Terminal.insertPlainScalar (cyclomatic 18) Sources/SwiftTerm/Terminal.swift:2115— Terminal.insertPlainScalar 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.
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.
TerminalContentSnapshot.ansiRepresentation (cyclomatic 18) Sources/SwiftTerm/TerminalContentSnapshot.swift:229— TerminalContentSnapshot.ansiRepresentation has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
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.
TerminalView.validateUserInterfaceItem (cyclomatic 18) Sources/SwiftTerm/Mac/MacTerminalView.swift:2635— 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.
MetalTerminalRenderer.preparePlainRow (cyclomatic 18) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2329— 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.
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.
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.
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.
PseudoTerminalHelpers.fork (cyclomatic 17) Sources/SwiftTerm/Pty.swift:62— PseudoTerminalHelpers.fork 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.
Terminal.handleKittyKeyboardProtocol (cyclomatic 17) Sources/SwiftTerm/Terminal.swift:1515— 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.
SnapshotTextBuilder.plainStyle (cyclomatic 17) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:849— 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.
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.
TerminalView.panSelectionHandler (cyclomatic 17) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1398— 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.
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.
Buffer.semanticRowKind (cyclomatic 16) Sources/SwiftTerm/Buffer.swift:601— 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.
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.
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.
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.
TerminalRenderOwner.prepareFrame (cyclomatic 16) Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:521— 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.
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.
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.
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.
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.
CoreGraphicsPaintHost.drawTerminalContents (cognitive 240) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3406— CoreGraphicsPaintHost.drawTerminalContents has cognitive complexity 240 (threshold 15). Drivers by points: if/else 56 (146 pts), loops 15 (42 pts), ternaries 6 (27 pts), boolean chains 21, match/switch 2 (4 pts) (nesting depth added 140). Of this number, 220 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.
EscapeSequenceParser.parseBorrowed (cognitive 230) Sources/SwiftTerm/EscapeSequenceParser.swift:1195— EscapeSequenceParser.parseBorrowed has cognitive complexity 230 (threshold 15). Drivers by points: if/else 61 (154 pts), ternaries 10 (37 pts), boolean chains 27, loops 4 (6 pts), match/switch 2 (6 pts) (nesting depth added 126). Of this number, 225 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.
TerminalView.pressesBegan (cognitive 183) Sources/SwiftTerm/iOS/iOSTerminalView.swift:3239— 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.
MetalTerminalRenderer.prepareRow (cognitive 154) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1923— 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.
TerminalKeyboardRouter.keyDown (cognitive 141) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:267— TerminalKeyboardRouter.keyDown has cognitive complexity 141 (threshold 15). Drivers by points: if/else 42 (75 pts), boolean chains 38, match/switch 4 (14 pts), ternaries 6 (14 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Terminal.handlePrintSlow (cognitive 132) Sources/SwiftTerm/Terminal.swift:2153— Terminal.handlePrintSlow has cognitive complexity 132 (threshold 15). Drivers by points: if/else 65 (144 pts), boolean chains 34, ternaries 8 (18 pts), loops 5 (8 pts) (nesting depth added 92). 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.
TerminalIOPipelineWorker.gatherMain (cognitive 127) Sources/SwiftTerm/TerminalIOPipeline.swift:595— 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.
SnapshotTextBuilder.buildAttributedString (cognitive 126) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:454— SnapshotTextBuilder.buildAttributedString has cognitive complexity 126 (threshold 15). Drivers by points: if/else 38 (86 pts), boolean chains 36, ternaries 1 (3 pts), loops 1 (nesting depth added 50). Of this number, 124 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.
Terminal.cmdDecRqm (cognitive 106) Sources/SwiftTerm/Terminal.swift:6181— Terminal.cmdDecRqm has cognitive complexity 106 (threshold 15). Drivers by points: ternaries 31 (93 pts), if/else 8, match/switch 2 (4 pts), boolean chains 1 (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.
MetalTerminalRenderer.placeRow (cognitive 102) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2481— 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.
TerminalKeyboardRouter.doCommand (cognitive 86) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:631— TerminalKeyboardRouter.doCommand has cognitive complexity 86 (threshold 15). Drivers by points: if/else 32 (72 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.
TerminalSnapshot.refresh (cognitive 76) Sources/SwiftTerm/Apple/TerminalSnapshot.swift:611— TerminalSnapshot.refresh has cognitive complexity 76 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 23, loops 7 (12 pts), match/switch 1 (5 pts), ternaries 3 (5 pts) (nesting depth added 25). Of this number, 73 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.
Terminal.csiCopyRectangularArea (cognitive 73) Sources/SwiftTerm/Terminal.swift:5244— Terminal.csiCopyRectangularArea has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 10 (24 pts), if/else 6 (21 pts), loops 4 (18 pts), boolean chains 10 (nesting depth added 43). 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.
Terminal.makeRenderSnapshot (cognitive 73) Sources/SwiftTerm/Terminal.swift:8214— 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.
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.
Buffer.resize (cognitive 68) Sources/SwiftTerm/Buffer.swift:1045— Buffer.resize has cognitive complexity 68 (threshold 15). Drivers by points: if/else 22 (50 pts), loops 6 (16 pts), boolean chains 1, ternaries 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.
Buffer.reflowNarrower (cognitive 68) Sources/SwiftTerm/Buffer.swift:1632— Buffer.reflowNarrower has cognitive complexity 68 (threshold 15). Drivers by points: if/else 18 (46 pts), loops 8 (16 pts), boolean chains 6 (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.
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.
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.
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.
TerminalSnapshot.refresh (cognitive 59) Sources/SwiftTerm/Apple/TerminalSnapshot.swift:345— 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.
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.
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.
MetalTerminalRenderer.buildCursorDrawData (cognitive 55) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3934— MetalTerminalRenderer.buildCursorDrawData has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (24 pts), ternaries 6 (12 pts), boolean chains 8, match/switch 3 (8 pts), 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.
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.
TerminalBidi.shapeArabic (cognitive 52) Sources/SwiftTerm/Apple/TerminalBidi.swift:380— 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.
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.
TerminalBidi.buildParagraph (cognitive 50) Sources/SwiftTerm/Apple/TerminalBidi.swift:708— 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.
TerminalView.scrollWheel (cognitive 50) Sources/SwiftTerm/Mac/MacTerminalView.swift:3731— 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.
Terminal.scrollGeneral (cognitive 47) Sources/SwiftTerm/Terminal.swift:8682— Terminal.scrollGeneral has cognitive complexity 47 (threshold 15). Drivers by points: if/else 20 (33 pts), boolean chains 6, 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.
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.
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.
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.
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.
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.
Terminal.osciTerm2 (cognitive 43) Sources/SwiftTerm/Terminal.swift:4197— 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.
Terminal.implicitLinkMatch (cognitive 43) Sources/SwiftTerm/Terminal.swift:9832— 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.
MetalTerminalRenderer.buildDrawDataPass (cognitive 41) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1684— 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.
BufferLine.copyFrom (cognitive 40) Sources/SwiftTerm/BufferLine.swift:946— BufferLine.copyFrom has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 15, 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.
TerminalContentSnapshot.exportPieces (cognitive 40) Sources/SwiftTerm/TerminalContentSnapshot.swift:314— TerminalContentSnapshot.exportPieces has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 13, loops 3 (6 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.
SelectionService.urlRange (cognitive 39) Sources/SwiftTerm/SelectionService.swift:1305— 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.
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.
Terminal.buildGhosttyImplicitLineMap (cognitive 39) Sources/SwiftTerm/Terminal.swift:10071— 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.
MetalTerminalRenderer.render (cognitive 39) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:1339— 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.
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.
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.
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.
TerminalBidi.computeVisualOrder (cognitive 38) Sources/SwiftTerm/Apple/TerminalBidi.swift:283— 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.
Buffer.getLinesToRemove (cognitive 37) Sources/SwiftTerm/Buffer.swift:1399— 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.
Terminal.scanUserInputForSubmission (cognitive 37) Sources/SwiftTerm/Terminal.swift:3164— 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.
CoreGraphicsPaintHost.drawRunAttributes (cognitive 37) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3147— CoreGraphicsPaintHost.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.
Buffer.semanticPromptInvariantsHold (cognitive 36) Sources/SwiftTerm/Buffer.swift:1225— 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.
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.
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.
TerminalView.sendKittyTextInput (cognitive 35) Sources/SwiftTerm/iOS/iOSTerminalView.swift:2845— 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.
MetalTerminalRenderer.preparePlainRow (cognitive 35) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2329— 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.
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.
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.
Terminal.oscSemanticPrompt (cognitive 34) Sources/SwiftTerm/Terminal.swift:3641— 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.
Terminal.reverseIndex (cognitive 34) Sources/SwiftTerm/Terminal.swift:9521— 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.
Buffer.reflowWider (cognitive 33) Sources/SwiftTerm/Buffer.swift:1501— 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.
EscapeSequenceParser.dispatchCsi (cognitive 33) Sources/SwiftTerm/EscapeSequenceParser.swift:619— EscapeSequenceParser.dispatchCsi has cognitive complexity 33 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 1, 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.
SnapshotTextBuilder.plainRow (cognitive 33) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:779— SnapshotTextBuilder.plainRow has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 10, 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.
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.
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.
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.
Buffer.insertScalarRun (cognitive 32) Sources/SwiftTerm/Buffer.swift:2005— Buffer.insertScalarRun has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 4, loops 2 (4 pts), ternaries 3 (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.
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.
Buffer.semanticRowKind (cognitive 31) Sources/SwiftTerm/Buffer.swift:601— 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.
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.
TerminalView.panSelectionHandler (cognitive 31) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1398— 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.
TerminalContentSnapshot.ansiRepresentation (cognitive 30) Sources/SwiftTerm/TerminalContentSnapshot.swift:229— TerminalContentSnapshot.ansiRepresentation has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (5 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 14). 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.
TerminalView.accessibilityAttributedDisplayTextLocked (cognitive 30) Sources/SwiftTerm/iOS/iOSTerminalView.swift:4033— 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.
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.
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.
Terminal.cmdWindowOptions (cognitive 29) Sources/SwiftTerm/Terminal.swift:5597— 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.
TerminalView.getAttributes (cognitive 29) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2712— 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.
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.
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.
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.
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.
Terminal.cmdEraseInDisplay (cognitive 28) Sources/SwiftTerm/Terminal.swift:4839— 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.
Terminal.sendHostMouse (cognitive 28) Sources/SwiftTerm/Terminal.swift:9464— 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.
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.
TerminalView.forwardWheel (cognitive 27) Sources/SwiftTerm/iOS/iOSTerminalView.swift:1274— 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.
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.
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.
Buffer.insertCharacter (cognitive 26) Sources/SwiftTerm/Buffer.swift:2077— Buffer.insertCharacter has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 4 (7 pts), boolean chains 3, 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.
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.
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.
TerminalView.mapColor (cognitive 26) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2256— 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.
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.
EscapeSequenceParser.dispatchEsc (cognitive 25) Sources/SwiftTerm/EscapeSequenceParser.swift:725— 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.
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.
SnapshotTextBuilder.buildAttributes (cognitive 25) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:307— 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.
TerminalRenderOwner.prepareFrame (cognitive 25) Sources/SwiftTerm/Apple/TerminalRenderOwner.swift:521— 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.
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.
Buffer.rearrange (cognitive 24) Sources/SwiftTerm/Buffer.swift:1777— 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.
EscapeSequenceParser.simpleCsiLength (cognitive 24) Sources/SwiftTerm/EscapeSequenceParser.swift:933— EscapeSequenceParser.simpleCsiLength has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 7, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
EscapeSequenceParser.appendOscBytes (cognitive 24) Sources/SwiftTerm/EscapeSequenceParser.swift:1047— 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.
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.
SelectionService.pathRange (cognitive 24) Sources/SwiftTerm/SelectionService.swift:1394— 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.
Terminal.cmdDECRQCRA (cognitive 24) Sources/SwiftTerm/Terminal.swift:5360— Terminal.cmdDECRQCRA has cognitive complexity 24 (threshold 15). Drivers by points: loops 3 (12 pts), ternaries 3 (7 pts), if/else 2 (3 pts), boolean chains 2 (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.
Terminal.cmdDeleteLines (cognitive 24) Sources/SwiftTerm/Terminal.swift:7837— 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.
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.
UnicodeUtil.graphemeJoinNonEmojiModifier (cognitive 24) Sources/SwiftTerm/Utilities.swift:428— 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.
SnapshotTextBuilder.swift.mapColor (cognitive 24) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:1132— 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.
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.
PseudoTerminalHelpers.fork (cognitive 23) Sources/SwiftTerm/Pty.swift:62— PseudoTerminalHelpers.fork has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Terminal.cmdDeviceStatus (cognitive 23) Sources/SwiftTerm/Terminal.swift:6472— 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.
Terminal._getSelectedLines (cognitive 23) Sources/SwiftTerm/Terminal.swift:10445— 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.
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.
SnapshotTextBuilder.plainStyle (cognitive 23) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:849— 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.
TerminalKeyboardRouter.insertText (cognitive 23) Sources/SwiftTerm/Mac/MacKeyboardRouter.swift:757— TerminalKeyboardRouter.insertText has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 10 (11 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.
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.
BufferLine.setPackedScalarRun (cognitive 22) Sources/SwiftTerm/BufferLine.swift:460— BufferLine.setPackedScalarRun has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3 (6 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.
Terminal.handleSemanticPromptClick (cognitive 22) Sources/SwiftTerm/Terminal.swift:3517— 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.
Terminal.parseSemanticPromptOptions (cognitive 22) Sources/SwiftTerm/Terminal.swift:3588— 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.
Terminal.cmdInsertLines (cognitive 22) Sources/SwiftTerm/Terminal.swift:4978— 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.
Terminal.cmdCharAttributes::parseExtendedColor (cognitive 22) Sources/SwiftTerm/Terminal.swift:6696— 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.
Terminal.cmdSendDeviceAttributes (cognitive 22) Sources/SwiftTerm/Terminal.swift:7496— 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.
SnapshotTextBuilder.sameAttributes (cognitive 22) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:997— 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.
TerminalView.mouseUp (cognitive 22) Sources/SwiftTerm/Mac/MacTerminalView.swift:3288— 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.
TerminalView.pressesEnded (cognitive 22) Sources/SwiftTerm/iOS/iOSTerminalView.swift:3560— 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.
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.
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.
SelectionService.updatePointerSelection (cognitive 21) Sources/SwiftTerm/SelectionService.swift:1145— 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.
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.
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.
TerminalIOPipelineWorker.parseMain (cognitive 21) Sources/SwiftTerm/TerminalIOPipeline.swift:509— 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.
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.
Color.parseColor (cognitive 20) Sources/SwiftTerm/Colors.swift:405— 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.
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.
Terminal.reverseWrapBackward (cognitive 20) Sources/SwiftTerm/Terminal.swift:4580— 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.
Terminal.cmdCharAttributes (cognitive 20) Sources/SwiftTerm/Terminal.swift:6632— 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.
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.
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.
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.
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.
CircularBufferLineList.shiftElements (cognitive 19) Sources/SwiftTerm/CircularList.swift:543— 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.
EscapeSequenceParser.consumeOscRun (cognitive 19) Sources/SwiftTerm/EscapeSequenceParser.swift:1131— 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.
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.
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.
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.
SelectionService.balancedSearchForward (cognitive 19) Sources/SwiftTerm/SelectionService.swift:833— 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.
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.
Terminal.handleKittyKeyboardProtocol (cognitive 19) Sources/SwiftTerm/Terminal.swift:1515— 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.
Terminal.insertPlainScalar (cognitive 19) Sources/SwiftTerm/Terminal.swift:2115— Terminal.insertPlainScalar has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, ternaries 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Terminal.scroll (cognitive 19) Sources/SwiftTerm/Terminal.swift:8622— 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.
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.
TerminalBidi.explicitRightToLeftLayout (cognitive 19) Sources/SwiftTerm/Apple/TerminalBidi.swift:1066— TerminalBidi.explicitRightToLeftLayout has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 4). Of this number, 12 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.
MetalTerminalRenderer.glyphEntry (cognitive 19) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3083— 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.
MetalTerminalRenderer.renderCustomGlyphBitmap (cognitive 19) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:3297— 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.
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.
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.
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.
CircularBufferLineList.shiftUpAndRecycleLines (cognitive 18) Sources/SwiftTerm/CircularList.swift:627— CircularBufferLineList.shiftUpAndRecycleLines 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.
SelectionService.balancedSearchBackward (cognitive 18) Sources/SwiftTerm/SelectionService.swift:875— 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.
SelectionService.extendToWordBoundary (cognitive 18) Sources/SwiftTerm/SelectionService.swift:915— 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.
Terminal.resolveActiveHyperlink (cognitive 18) Sources/SwiftTerm/Terminal.swift:3936— Terminal.resolveActiveHyperlink has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 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.
Terminal.csiX (cognitive 18) Sources/SwiftTerm/Terminal.swift:5301— Terminal.csiX has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (7 pts), loops 2 (7 pts), boolean chains 2, ternaries 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.
Terminal.sendHostKey (cognitive 18) Sources/SwiftTerm/TerminalWebInput.swift:55— Terminal.sendHostKey has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 6 (7 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TerminalView.mouseDragged (cognitive 18) Sources/SwiftTerm/Mac/MacTerminalView.swift:3387— 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.
TerminalView.insertImage (cognitive 18) Sources/SwiftTerm/Apple/AppleTerminalView.swift:5105— 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.
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.
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.
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.
SelectionService.logicalLineCells (cognitive 17) Sources/SwiftTerm/SelectionService.swift:1251— 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.
Terminal.cmdScrollDown (cognitive 17) Sources/SwiftTerm/Terminal.swift:7662— 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.
Terminal.cmdScrollUp (cognitive 17) Sources/SwiftTerm/Terminal.swift:7717— 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.
Terminal.seamContainsGhosttyImplicitLink (cognitive 17) Sources/SwiftTerm/Terminal.swift:10273— 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.
ExternalRenderOwner.prepare (cognitive 17) Sources/SwiftTerm/Apple/ExternalRenderOwner.swift:57— ExternalRenderOwner.prepare has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 5, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
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.
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.
Attribute.sgrParameters (cognitive 16) Sources/SwiftTerm/CharData.swift:142— Attribute.sgrParameters has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, match/switch 2 (4 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LocalProcess.startProcessWithForkpty (cognitive 16) Sources/SwiftTerm/LocalProcess.swift:637— 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.
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.
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.
SelectionService.blockText (cognitive 16) Sources/SwiftTerm/SelectionService.swift:1093— 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.
Terminal.linkRowEdgeInfo (cognitive 16) Sources/SwiftTerm/Terminal.swift:10223— 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.
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.
TerminalBidi.detectedBaseDirection (cognitive 16) Sources/SwiftTerm/Apple/TerminalBidi.swift:658— 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.
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.
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.
TerminalView.commitTextInput (cognitive 16) Sources/SwiftTerm/iOS/iOSTerminalView.swift:2467— 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.
GlyphAtlas.ensureRegion (cognitive 16) Sources/SwiftTerm/Apple/Metal/GlyphAtlas.swift:122— 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.
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.
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.
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.
Near-duplicate member pair (24 shared lines) Sources/SwiftTerm/Terminal.swift:7662— Sources/SwiftTerm/Terminal.swift:7662-7712 | Sources/SwiftTerm/Terminal.swift:7717-7767 — 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 (62 corresponding lines) · ×1
Edited copy of a member (62 corresponding lines) TerminalApp/MacTerminal/ViewController.swift:888— TerminalApp/MacTerminal/ViewController.swift:888-950 | TerminalApp/MacTerminal/ViewController.swift:953-1014 — These two members are one piece of code written twice and then edited apart: 62 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· Edited copy of a member (66 corresponding lines) · ×1
Edited copy of a member (66 corresponding lines) Sources/SwiftTerm/Terminal.swift:4978— Sources/SwiftTerm/Terminal.swift:4978-5055 | Sources/SwiftTerm/Terminal.swift:7837-7902 — These two members are one piece of code written twice and then edited apart: 66 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· Edited copy of a member (41 corresponding lines) · ×1
Edited copy of a member (41 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:2924— Sources/SwiftTerm/Mac/MacTerminalView.swift:2924-2965 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:888-928 — These two members are one piece of code written twice and then edited apart: 41 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· Edited copy of a member (18 corresponding lines) · ×1
Edited copy of a member (18 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:443— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:443-460 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:439-464 — These two members are one piece of code written twice and then edited apart: 18 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· Edited copy of a member (34 corresponding lines) · ×1
Edited copy of a member (34 corresponding lines) Sources/SwiftTerm/SelectionService.swift:833— Sources/SwiftTerm/SelectionService.swift:833-869 | Sources/SwiftTerm/SelectionService.swift:875-908 — These two members are one piece of code written twice and then edited apart: 34 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· Edited copy of a member (21 corresponding lines) · ×1
Edited copy of a member (21 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalView.swift:3885— Sources/SwiftTerm/Mac/MacTerminalView.swift:3885-3905 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:2039-2059 — These two members are one piece of code written twice and then edited apart: 21 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· Edited copy of a member (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) Sources/SwiftTerm/ByteRunScanner.swift:324— Sources/SwiftTerm/ByteRunScanner.swift:324-355 | Sources/SwiftTerm/ByteRunScanner.swift:357-388 — These two members are one piece of code written twice and then edited apart: 32 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· Edited copies of one member (3 members, 30+ corresponding lines) · ×1
Edited copies of one member (3 members, 30+ corresponding lines) Sources/SwiftTerm/ByteRunScanner.swift:34— Sources/SwiftTerm/ByteRunScanner.swift:34-63 | Sources/SwiftTerm/ByteRunScanner.swift:81-110 | Sources/SwiftTerm/ByteRunScanner.swift:117-149 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 30 lines, 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 out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×1
Edited copy of a member (28 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:398— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:398-425 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:394-421 — These two members are one piece of code written twice and then edited apart: 28 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· Edited copy of a member (20 corresponding lines) · ×1
Edited copy of a member (20 corresponding lines) Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:548— Sources/SwiftTerm/Mac/MacTerminalRenderView.swift:548-568 | Sources/SwiftTerm/iOS/iOSTerminalRenderView.swift:551-570 — These two members are one piece of code written twice and then edited apart: 20 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· Edited copy of a member (25 corresponding lines) · ×1
Edited copy of a member (25 corresponding lines) Sources/SwiftTerm/Terminal.swift:2006— Sources/SwiftTerm/Terminal.swift:2006-2039 | Sources/SwiftTerm/Terminal.swift:2060-2084 — These two members are one piece of code written twice and then edited apart: 25 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· Edited copies of one member (3 members, 23+ corresponding lines) · ×1
Edited copies of one member (3 members, 23+ corresponding lines) Sources/SwiftTerm/Apple/AppleTerminalView.swift:1390— Sources/SwiftTerm/Apple/AppleTerminalView.swift:1390-1412 | Sources/SwiftTerm/Apple/AppleTerminalView.swift:1414-1440 | Sources/SwiftTerm/Apple/AppleTerminalView.swift:1442-1470 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, 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 out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 4+ corresponding lines) · ×1
Edited copies of one member (3 members, 4+ corresponding lines) Sources/SwiftTerm/LocalProcess.swift:602— Sources/SwiftTerm/LocalProcess.swift:602-605 | Sources/SwiftTerm/LocalProcess.swift:610-613 | Sources/SwiftTerm/Mac/MacLocalTerminalView.swift:479-486 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, 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 out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 7+ corresponding lines) · ×1
Edited copies of one member (6 members, 7+ corresponding lines) Sources/SwiftTermWebWasm/Exports.swift:203— Sources/SwiftTermWebWasm/Exports.swift:203-209 | Sources/SwiftTermWebWasm/Exports.swift:229-235 | Sources/SwiftTermWebWasm/Exports.swift:270-276 | Sources/SwiftTermWebWasm/GraphicsExports.swift:192-198 | Sources/SwiftTermWebWasm/SelectionExports.swift:66-72 | Sources/SwiftTermWebWasm/SelectionExports.swift:88-94 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 7 lines, 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 out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
Duplicated block (25–26 lines × 2) Sources/SwiftTerm/Mac/MacCaretView.swift:61— Sources/SwiftTerm/Mac/MacCaretView.swift:61-86 | Sources/SwiftTerm/iOS/iOSCaretView.swift:94-118 — 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 (21–25 lines × 2) Sources/SwiftTerm/CircularList.swift:172— Sources/SwiftTerm/CircularList.swift:172-196 | Sources/SwiftTerm/CircularList.swift:543-563 — 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.
Duplicated block (22 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3881— Sources/SwiftTerm/Apple/AppleTerminalView.swift:3881-3902 | 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:3881` 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 (16–19 lines × 2) Sources/SwiftTerm/Apple/TerminalSnapshot.swift:535— Sources/SwiftTerm/Apple/TerminalSnapshot.swift:535-553 | Sources/SwiftTerm/Apple/TerminalSnapshot.swift:781-796 — 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 (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.
Duplicated block (17–18 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3160— Sources/SwiftTerm/Apple/AppleTerminalView.swift:3160-3177 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4577-4593 — 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.
Duplicated block (18 lines × 2) Sources/SwiftTerm/iOS/iOSTerminalView.swift:3295— Sources/SwiftTerm/iOS/iOSTerminalView.swift:3295-3312 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3341-3358 — 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:3295` 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 (4–17 lines × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2544— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2544-2547 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4442-4458 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4596-4612 — 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:4442` 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:4458` calls `transformPoint`, `CGPoint`, `min` and `Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2547` 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 (15–16 lines × 2) Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:310— Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:310-325 | Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:852-866 — 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 (16 lines × 2) Sources/SwiftTerm/Buffer.swift:1891— Sources/SwiftTerm/Buffer.swift:1891-1906 | Sources/SwiftTerm/Buffer.swift:1937-1952 — 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/Buffer.swift:1891` 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 (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.
Duplicated block (11–14 lines × 2) Sources/SwiftTerm/Mac/MacTerminalView.swift:4021— Sources/SwiftTerm/Mac/MacTerminalView.swift:4021-4034 | Sources/SwiftTerm/iOS/iOSTerminalView.swift:3723-3733 — 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–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.
Duplicated block (12–13 lines × 3) Sources/SwiftTerm/BufferLine.swift:402— Sources/SwiftTerm/BufferLine.swift:402-413 | Sources/SwiftTerm/BufferLine.swift:435-446 | Sources/SwiftTerm/BufferLine.swift:473-485 — 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/BufferLine.swift:473` 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 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/BufferLine.swift:472` calls `precondition` and `Sources/SwiftTerm/BufferLine.swift:401` 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–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.
Duplicated block (8–13 lines × 2) Sources/SwiftTerm/Terminal.swift:10494— Sources/SwiftTerm/Terminal.swift:10494-10506 | Sources/SwiftTerm/Terminal.swift:10530-10537 — 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:10530` 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:10529` calls `translateBufferLineToString` and `Sources/SwiftTerm/Terminal.swift:10492` 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 (10–11 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:2770— Sources/SwiftTerm/Apple/AppleTerminalView.swift:2770-2780 | Sources/SwiftTerm/Apple/SnapshotTextBuilder.swift:375-384 — 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:2770` 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–11 lines × 2) Sources/SwiftTerm/Apple/AppleTerminalView.swift:3581— Sources/SwiftTerm/Apple/AppleTerminalView.swift:3581-3589 | Sources/SwiftTerm/Apple/AppleTerminalView.swift:3594-3604 — 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 × 3) Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2532— Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:2532-2541 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4447-4456 | Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4601-4610 — 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:2543` calls `transformRect` and `Sources/SwiftTerm/Apple/Metal/MetalTerminalRenderer.swift:4457` 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 (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.
Duplicated block (5 lines × 4) Sources/SwiftTerm/Colors.swift:466— Sources/SwiftTerm/Colors.swift:466-470 | Sources/SwiftTerm/Colors.swift:471-475 | Sources/SwiftTerm/Colors.swift:476-480 | Sources/SwiftTerm/Colors.swift:481-485 — 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:466` 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· Edited copies of one member (3 members, 26+ corresponding lines) · ×1
Edited copies of one member (3 members, 26+ corresponding lines) scripts/regen_unicode_width_data.py:118— scripts/regen_unicode_width_data.py:118-143 | scripts/regen_unicode_width_data.py:147-173 | scripts/regen_unicode_width_data.py:177-205 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 26 lines, 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 out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (9–10 lines × 2) scripts/regen_unicode_width_data.py:365— scripts/regen_unicode_width_data.py:365-374 | scripts/regen_unicode_width_data.py:410-418 — 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:365` 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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:4207— `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/MacCaretView.swift:67— `data.cellAttribute.style.contains(.invisible) || (!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/Apple/AppleTerminalView.swift:3323— `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/Mac/MacTerminalRenderView.swift:360— `grid.columns != lastGrid.columns || grid.rows != lastGrid.rows` appears character-identically in 2 files — Sources/SwiftTerm/Mac/MacTerminalRenderView.swift, Sources/SwiftTerm/iOS/iOSTerminalRenderView.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:2318— `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:3929— `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:3953— `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:2932— `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:3932— `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/MacKeyboardRouter.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:3173— `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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 40 significant file(s) lose their only recent owner: Sources/SwiftTerm/KittyClipboardProtocol.swift, TerminalApp/MacTerminal/ViewController.swift, Tools/BidiHarness/BidiHarness/HarnessViewController.swift, Sources/SwiftTerm/KittyKeyboardEncoder.swift, TerminalApp/MacTerminal/IOBaselineHarness.swift, Sources/SwiftTerm/CircularList.swift, scripts/regen_unicode_width_data.py, Tools/RenderBench/Sources/RenderBench/main.swift (+32 more). Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 1 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (41 single-owned of 143 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 143 of the 190 production source files in this repository met that bar). They are anonymized user #2 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: Sources/SwiftTerm/Apple/ColorContrast.swift.
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)` (71029 LoC, 586 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.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
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`.
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 3 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.
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`.
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.)
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.
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.
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.
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
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.1 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.105.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.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
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 15 file(s) — `Sources/SwiftTerm/Apple/AppleTerminalView.swift`, `Sources/SwiftTerm/Apple/Metal/MetalShaderSource.swift`, `Sources/SwiftTerm/CharData.swift`, `Sources/SwiftTerm/CircularList.swift`, `Sources/SwiftTerm/CsiParameters.swift`, … (+10 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.
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.
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.
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.
Run 01a1dce1-3f66-7bc2-a504-38e14f6a2caa · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 21 · Warnings: 951 · Recommendations: 26 · Info: 53 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 15-11-2026 @ 01:45 UTC.
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.