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

Emanuele-web04/remodex

Measured 28 October 2026, 22:34 UTC, at code version f67b149

Regression: 1 dimension fell since the last survey Test reliability: not measuredSupply-chain provenance & signing: not measured

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

Test reliability is not measured: No runner for the .swift half of a polyglot repository.

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 score 48out of 100 Weak
CriticalWeakAdequateStrongExemplary
Down 3 since the last survey

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

A large codebase: 106,587 lines of product code in 5 projects, tests not counted · Estimated rebuild effort: about 0.9 person-years · Weakest lens: Code Health, 35

Findings by how serious they are

12 critical 1220 serious 95 minor

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

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
28 October 2026, 22:34 UTC

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

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

67of 67 dimensions measured by tools.
1313of 1327 findings point to an exact file and line, so you can open each one in the code. The other 14 concern the repository as a whole, such as missing documentation.
67dimensions across 7 lenses, read from 106,587 lines of product code in 5 projects.
Chapters

Executive summary

Emanuele-web04/remodex falls short of our standard for production, held back most by its Code Health lens, the quality of the code itself. It scores 48 out of 100 and is rated Weak, and eight of its 12 critical findings are security problems.

Code Health, at 35, is the weakest lens and counts most in the score. The best first steps are adding type checking and splitting the oversized files, each worth about 7 points. Raising Code Health to 70 would lift the score to about 58.

Six pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. One known security hole in a package the code depends on can be used by attackers, and one password or key is open to anyone who can read the repository. Pinning each tool to an exact version, updating the vulnerable packages and replacing the exposed password or key would close these risks. Saving the change and the message together would take care of the place where data is saved and a message sent separately.

The product code is 106,587 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 for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Code Health 35 · counts for 46%Production Readiness 52 · counts for 25%Maturity 56 · counts for 14%Performance 60 · counts for 8%Event-Driven 79 · counts for 4%Security and Compliance 91 · counts for 2%Architecture 93 · counts for 1%

If Code Health rose from 35 to 70, the lowest score rated Strong, the score would rise from 48 to about 58.

Code composition: what the lines of code are
Product code 75%Tests 25%
New since the last survey: 60 findings

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

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

Fixed since the last survey: 62 findings

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

  • Change Coupling · Change coupling: TurnComposerInputTextView.swift ↔ TurnTimelineView.swift CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift
  • Change Coupling · Change coupling: TurnMarkdownTextRendering.swift ↔ TurnTimelineView.swift CodexMobile/CodexMobile/Views/Turn/Messages/TurnMarkdownTextRendering.swift
  • Supply-chain Provenance & Signing REDACTED
  • Code Duplication · Duplicated block (12 lines × 2 locations) phodex-bridge/src/desktop-ipc-conversation-adapter.js
  • Code Duplication · Duplicated block (12 lines × 2 locations) phodex-bridge/src/desktop-ipc-conversation-adapter.js
  • Code Duplication · Duplicated block with local edits (12 matched lines × 2 locations) phodex-bridge/src/pet-handler.js
  • Code Duplication · Duplicated block (12 lines × 2 locations) phodex-bridge/src/project-handler.js
  • Code Duplication · Duplicated block (12 lines × 2 locations) phodex-bridge/src/push-notification-tracker.js
  • Code Duplication · Duplicated block (12 lines × 2 locations) phodex-bridge/src/rollout-live-mirror.js
  • Code Duplication · Duplicated block (12 lines × 2 locations) phodex-bridge/src/session-jsonl-history.js
  • Code Duplication · Duplicated block (12 lines × 2 locations) relay/server.js
  • Code Duplication · Duplicated block (11 lines × 2 locations) phodex-bridge/src/bridge.js
  • Code Duplication · Duplicated block (11 lines × 2 locations) phodex-bridge/src/codex-desktop-refresher.js
  • Code Duplication · Duplicated block (11 lines × 3 locations) phodex-bridge/src/desktop-ipc-conversation-adapter.js
  • Code Duplication · Duplicated block (11 lines × 3 locations) phodex-bridge/src/git-handler.js
  • Code Duplication · Duplicated block with local edits (11 matched lines × 2 locations) phodex-bridge/src/opencode-runtime.js
  • Code Duplication · Duplicated block (11 lines × 2 locations) phodex-bridge/src/rollout-watch.js
  • Code Duplication · Duplicated block (10 lines × 2 locations) phodex-bridge/src/bridge.js
  • Code Duplication · Duplicated block (10 lines × 4 locations) phodex-bridge/src/desktop-ipc-action-follower.js
  • Code Duplication · Duplicated block (10 lines × 2 locations) phodex-bridge/src/git-handler.js
  • Code Duplication · Duplicated block (10 lines × 2 locations) phodex-bridge/src/thread-activity-projector.js
  • Code Duplication · Duplicated block (9 lines × 2 locations) phodex-bridge/src/bridge.js
  • Code Duplication · Duplicated block (9 lines × 7 locations) phodex-bridge/src/desktop-ipc-conversation-adapter.js
  • Code Duplication · Duplicated block (8 lines × 2 locations) phodex-bridge/bin/remodex-jsonl-diagnose.js
  • Code Duplication · Duplicated block (8 lines × 2 locations) phodex-bridge/src/bridge.js
  • Code Duplication · Duplicated block (8 lines × 2 locations) phodex-bridge/src/bridge.js
  • Code Duplication · Duplicated block (8 lines × 2 locations) phodex-bridge/src/rollout-live-mirror.js
  • Code Duplication · Duplicated block (8 lines × 2 locations) phodex-bridge/src/thread-list-provenance.js
  • Code Duplication · Duplicated block (7 lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js
  • Code Duplication · Duplicated block (7 lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js
  • Code Duplication · Duplicated block (7 lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js
  • Code Duplication · Duplicated block (7 lines × 2 locations) phodex-bridge/src/desktop-ipc-conversation-adapter.js
  • Code Duplication · Duplicated block (6 lines × 2 locations) phodex-bridge/src/opencode-runtime.js
  • Code Duplication · Duplicated block (5 lines × 2 locations) phodex-bridge/src/workspace-handler.js
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Services/RemodexDisplayIslandCoordinator.swift
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Services/CodexService+ThreadProjectRouting.swift
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Services/CodexService+Connection.swift
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Views/Sidebar/SidebarActivityListView.swift
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerSecondaryBar.swift
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) REDACTED
  • Exception handling · Swallowed exception (caught, then discarded) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/git-handler.js
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/git-handler.js
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/git-handler.js
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/git-handler.js
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/git-handler.js
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/git-handler.js
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/git-handler.js
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/workspace-handler.js
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/workspace-handler.js
  • Async & latency hygiene · Sync-over-async blocking phodex-bridge/src/workspace-handler.js
Rebuild cost: about €130,000 · Estimate
Cost to rebuild€43,000 to €220,000, for 718 to 2,277 hours of work, about 0.9 person-years for 1 to 2 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 48. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeLarge: 106,587 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
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.
Raises the score by about 7 points · Medium effort · Type Safety
2
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Raises the score by about 7 points · Medium effort · Large Files
3
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.
Raises the score by about 3 points · Low effort · Secret Scanning

Diagnosis: what the measurements show together

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

Where the investment is most exposed · Value at risk
This code would cost about €130,000 to build again, about 0.9 person-years of work. Its weakest lens is Code Health, at 35 (Weak). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
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. Of all the actions in this report, it raises the score most for the work it takes: about 7 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.1 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 5% to 11% on every change. The history of the code shows how much it changes: about 106,307 lines over the last 90 days, which is about 431,134 lines a year. At that pace, the extra work comes to an estimated 52 to 312.1 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

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

arch CodexMobile CodexMobile RemodexMenuBar RemodexMenuBar RemodexWidget RemodexWidget remodex remodex remodex-relay remodex-relay

At a glance — Code Health · 35% · Weak · gated by D2, R1, R3 ·

At a glance — Architecture · 93% · Adequate · gated by D26 ·

At a glance — Maturity · 56% · Adequate · gated by M4 ·

At a glance — Readiness · 52% · Adequate · gated by R6, P3 ·

At a glance — Security · 91% · Exemplary ·

At a glance — Event-Driven · 79% · Strong ·

At a glance — Performance · 60% · Adequate ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection13High / Critical
A07:2025 — Authentication Failures1High / Critical
A03:2025 — Software Supply Chain Failures1High / Critical

Roadmap

Begin by introducing type safety to the frontend through a build-time check and incremental conversion of high-traffic modules. Simultaneously, improve maintainability by splitting large files into smaller, focused modules and resolve the single leaked secret in REDACTED. Finally, establish a baseline for architectural decision records and integrate automated security scanning into the CI pipeline to prevent regressions.

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

Do thisHelpsEffortDimension
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.+6.6 ptsMediumType Safety
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.+6.6 ptsMediumLarge Files
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.+2.9 ptsLowSecret Scanning
Resolve the 1 No ADRs found finding(s) in ADR Quality.+2.7 ptsLowADR Quality
Add a SAST step to CI running what this repository's stack ships: CodeQL's Swift pack (Swift/Xcode) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.+2.4 ptsMediumSecurity & performance tooling
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.+2.0 ptsMediumCyclomatic Complexity
Reconcile the README with reality: phodex-bridge/README.md links to `SELF_HOSTING_MODEL.md`, but `phodex-bridge/SELF_HOSTING_MODEL.md` does not exist; phodex-bridge/README.md links to `CONTRIBUTING.md`, but `phodex-bridge/CONTRIBUTING.md` does not exist; phodex-bridge/README.md links to `Docs/self-hosting.md`, but `phodex-bridge/Docs/self-hosting.md` does not exist; phodex-bridge/README.md links to `relay/`, but `phodex-bridge/relay` does not exist.+1.8 ptsMediumDocumentation accuracy
Add eslint and type checking (adopt TypeScript, or type-check the existing JavaScript with `checkJs`) as package.json scripts and run them in CI.+1.8 ptsMediumTooling

File quality

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

FileScoreBandWorst signal
REDACTED1.1SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.0SlopSecret Scanning: Leaked secret: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
CodexMobile/CodexMobile/Services/CodexService.swift4.8MixedCyclomatic Complexity: CodexService.init (cyclomatic 18)
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
CodexMobile/CodexMobile/Services/CodexService+Messages.swift5.5MixedCyclomatic Complexity: CodexService.upsertStreamingSystemItemMessage (cyclomatic 127)
phodex-bridge/src/desktop-ipc-action-follower.js5.5MixedCyclomatic Complexity: createDesktopIpcActionFollower.observeInbound (cyclomatic 61)
CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift5.5MixedCyclomatic Complexity: NewChatDraftView.body (cyclomatic 19)
CodexMobile/CodexMobile/Services/CodexService+Connection.swift5.5MixedCyclomatic Complexity: CodexService.incompatibleBridgeAppVersionError (cyclomatic 18)
CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift5.5MixedCyclomatic Complexity: TurnComposerInputTextView.updateUIView (cyclomatic 18)
CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift5.5MixedCyclomatic Complexity: CodexService.performSecureHandshake (cyclomatic 19)
CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift5.6MixedCyclomatic Complexity: TurnTimelineView.scheduleProgressiveTailRevealIfNeeded (cyclomatic 19)
CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift5.6MixedCyclomatic Complexity: CodexService.appendCompletedAgentText (cyclomatic 24)
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift5.9MixedGod Classes: TooManyMethods: GhosttyTerminalView
CodexMobile/CodexMobile/Views/Turn/Messages/UserMessageBubble.swift6.0MixedExplicit Debt: TodoComment
CodexMobile/CodexMobile/Models/GitActionModels.swift6.3MixedCode Duplication: Duplicated block (8 lines × 2)
CodexMobile/CodexMobile/Services/CodexService+History.swift7.0MixedCyclomatic Complexity: CodexService.mergeHistoryMessages (cyclomatic 168)
phodex-bridge/src/desktop-ipc-conversation-adapter.js7.0MixedCyclomatic Complexity: desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState (cyclomatic 95)
phodex-bridge/src/session-jsonl-history.js7.0MixedCyclomatic Complexity: parseSessionJsonlTurns (cyclomatic 67)

How the grades work

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

Critical — 12

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

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

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

Could not be resolved — 20

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

Methodology & how to trust this report

Watchdog is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. 67 of 67 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); none rely on LLM judgement. Overall confidence is 0.8 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.

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

What we checked — 67 dimensions across the health lenses
D1D2D3D4D5D6D9D10D12D13D14D15D17D19D20D26D28D29D30D34D35D43AX10AX3AX4AX8AX9ED4M1M2M3M4P1P10P2P3PF2PF3R1R10R2R3R4R5R6R7R8R9X1X12X13X14X15X16X17X18X19X21X22X23X24X25X26X28X29X3X30

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

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

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

Tools & methods

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

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurement—◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a184a6-1b1b-7147-9336-e727e6b0fad9.

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

Run transparency — what happened this run

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

  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: this repository's production source spans .swift, and our analyzer cannot run the .swift test suite(s) — so no coverage was collected for the repository as a whole. The JavaScript/TypeScript half did build and run, and its own line coverage came back at 90.9% — 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 — coverage is excluded from the score rather than counted as a near-zero. In the meantime, produce a coverage report in a standard format (lcov — `swift test --enable-code-coverage` (SwiftPM) or `xcodebuild test -scheme <YourScheme> -enableCodeCoverage YES` (an .xcodeproj/.xcworkspace suite), then `xcrun llvm-cov export -format=lcov`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures and real coverage will be read. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `swift test --enable-code-coverage` (SwiftPM) or `xcodebuild test -scheme <YourScheme> -enableCodeCoverage YES` (an .xcodeproj/.xcworkspace suite), then `xcrun llvm-cov export -format=lcov`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then both halves are read on the next scan.
  • D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 1,283 test(s) behind this row are the ones the code-model census could read, and this repository also carries at least 51 test source file(s) (.js) that it cannot: it reads the test types the .swift frontend declared, so a suite in any other language is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT SCORED: this repository's production source includes .swift, and the built-in reliability runner cannot re-run the .swift test suite(s) — so reliability was not measured for the repository as a whole. The JavaScript/TypeScript (node:test via `npm ci --ignore-scripts` in phodex-bridge/ (875 tests); node:test via `npm ci --ignore-scripts` in relay/ (45 tests)): measured (3 flaky) suite(s) did re-run, and came back with 3 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.
  • D16 Bus Factor — 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. Single-maintainer repository — bus factor is not applicable (12 contributor(s) across 552 commit(s) sampled, automation and bot accounts excluded). One of them holds 92% of the history; the other 11 hold 0.7% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
  • D19 Documentation Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
  • D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `CodexMobile/CodexMobile/ContentView.swift`, `CodexMobile/CodexMobile/Models/CodexCollaboration.swift`, `CodexMobile/CodexMobile/Models/OpenCodeModelOption.swift`, `CodexMobile/CodexMobile/Services/CodexService+History.swift`, `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift`, … (+68 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • D44 Platform End-of-Life — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
  • AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing 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.
  • AXR1 Runtime accessibility — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (start). the dev server did not expose a crawlable HTTP endpoint in time — no runtime evidence.
  • C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P2 Observability — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 34 further occurrence(s) are not listed individually; the score already reflects all 74.
  • 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.
  • R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 31 further occurrence(s) are not listed individually; the score already reflects all 71.
  • S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Go, PHP, Dart, Kotlin, Ruby, Scala, Java, Python and Rust source only, and no C# was loaded, and no named async function in this repository's JavaScript/TypeScript, nor any Go, PHP or Dart function or Kotlin suspend function, makes a request that can be cancelled (fetch, axios, ky, ofetch; net/http, net.Dial; amphp; Dio; Ktor, OkHttp), so there is nothing to judge, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 30 further occurrence(s) are not listed individually; the score already reflects all 70.
  • X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Swift is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • 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.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.

Dimensions

D1 · Cyclomatic Complexity4.2 / 10Weak✓ Tool-verified

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

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

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

346 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was CodexService.mergeHistoryMessages at 168. A further 19 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 GitActionsError.userMessage at 36 — 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: CodexMobile/CodexMobile/Services/GitActionsService.swift (GitActionsError.userMessage at 36), CodexMobile/CodexMobile/Models/AppFont.swift (UserBubbleColor.uiColor at 16). 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.

CodexService.mergeHistoryMessages (cyclomatic 168)CodexMobile/CodexMobile/Services/CodexService+History.swift:931
CodexService.upsertStreamingSystemItemMessage (cyclomatic 127)CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2692
CodexService.loadThreadHistoryIfNeeded (cyclomatic 108)CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1271
desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState (cyclomatic 95)phodex-bridge/src/desktop-ipc-conversation-adapter.js:143
CodexService.reconcileExistingMessage (cyclomatic 87)CodexMobile/CodexMobile/Services/CodexService+History.swift:2008

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

What to do

  1. Bring the 2 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with CodexService.mergeHistoryMessages (cyclomatic 168), CodexService.upsertStreamingSystemItemMessage (cyclomatic 127). — 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 2 together lifts Cyclomatic Complexity from 4.2 to about 4.7/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity2.6 / 10Weak✓ Tool-verified

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

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

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

431 method(s) exceeded the cognitive complexity threshold of 15; the worst was CodexService.mergeHistoryMessages at 229.

CodexService.mergeHistoryMessages (cognitive 229)CodexMobile/CodexMobile/Services/CodexService+History.swift:931
CodexService.upsertStreamingSystemItemMessage (cognitive 193)CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2692
CodexService.loadThreadHistoryIfNeeded (cognitive 181)CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1271
parseSessionJsonlTurns (cognitive 124)phodex-bridge/src/session-jsonl-history.js:400
CodexService.completeAssistantMessage (cognitive 111)CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4013

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

What to do

  1. Bring the 4 bodies over 120 down to 120 or less in Cognitive Complexity — start with CodexService.mergeHistoryMessages (cognitive 229), CodexService.upsertStreamingSystemItemMessage (cognitive 193), CodexService.loadThreadHistoryIfNeeded (cognitive 181). — 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 4 together lifts Cognitive Complexity from 2.6 to about 3.9/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

134 god class(es) detected.

FileTooLong: Services/CodexService+Messages.swift · ×53CodexMobile/CodexMobile/Services/CodexService+Messages.swift
MethodTooLong: TurnView.body · ×33CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:75
FunctionTooLong: desktop-ipc-action-follower.createDesktopIpcActionFollower · ×25phodex-bridge/src/desktop-ipc-action-follower.js:240
ClassTooLong: TurnViewModel · ×13REDACTED:164
TooManyMethods: CodexService · ×10CodexMobile/CodexMobile/Services/CodexService.swift:422

What to do

  1. Resolve the 53 FileTooLong finding(s) in God Classes — start with CodexService+Messages.swift, bridge.js, CodexService+History.swift. — One of this dimension's main actionable groups (53 warning-level).
  2. Resolve the 33 MethodTooLong finding(s) in God Classes — start with CodexService+History.swift (6), CodexService+ThreadsTurns.swift (6), CodexService+Messages.swift (4). — One of this dimension's main actionable groups (33 warning-level).
  3. Resolve the 25 FunctionTooLong finding(s) in God Classes — start with bridge.js (4), rollout-live-mirror.js (4), desktop-ipc-action-follower.js (3). — One of this dimension's main actionable groups (25 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.0 / 10Strong✓ Tool-verified

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

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

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

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

Duplicated block (11 lines × 2) · ×20CodexMobile/CodexMobile/ContentView.swift:1923
Duplicated block (6 lines × 2) · ×19CodexMobile/CodexMobile/Services/CodexService+History.swift:3447
Duplicated block (10 lines × 2) · ×15CodexMobile/CodexMobile/Services/CodexService+Connection.swift:893
Duplicated block (7 lines × 2) · ×14CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:256
Duplicated block (17 lines × 2) · ×10CodexMobile/CodexMobile/ContentView.swift:2210

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

What to do

  1. Resolve the 20 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with CodexService+History.swift (2), ContentView.swift, CodexCollaboration.swift. — One of this dimension's main actionable groups (20 warning-level).
  2. Resolve the 19 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with CodexService+History.swift (4), GitActionsService.swift (3), TurnDiffRenderer.swift (2). — One of this dimension's main actionable groups (19 warning-level).
  3. Resolve the 15 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with CodexService+Connection.swift (2), CodexService+History.swift, CodexService+Incoming.swift. — One of this dimension's main actionable groups (15 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D5 · Coupling10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

5 production modules (npm+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; 0 module(s) off the main sequence, with abstractness counted on 3 of the 5 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

D6 · Cohesion (LCOM4)8.6 / 10Strong✓ Tool-verified

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

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

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

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

6 of 50 classes have LCOM4 above 3.

Low cohesion: CodexService (LCOM4 8) · ×6CodexMobile/CodexMobile/Services/CodexService.swift:422

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality10.0 / 10Stronggated by 3 serious findings✓ Tool-verified

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

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

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

0 skipped, 3 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 1283 tests. Measured on the .swift suite only — at least 51 test source file(s) (.js) went unread, so its test quality is unmeasured and is not in these counts.

No assertions: testFollowBottomDropsDelayedCorrectionRepairedByNativeAnchor · ×3CodexMobile/CodexMobileTests/TurnTimelineReducerTests.swift:7252

What to do

  1. Resolve the 3 No assertions finding(s) in Test Quality — start with TurnTimelineReducerTests.swift (3). — One of this dimension's main actionable groups (3 warning-level).
  2. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

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

Outdated (npm): ws

✓ On the Gold path — maintain.

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

D13 · Secret Scanning5.0 / 10Adequate✓ Tool-verified

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

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

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

1 secret(s) detected.

REDACTED

What to do

  1. Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Enforce Secret Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

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

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

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

0 of 2 shipped npm package(s) use a banned license. Licences were resolved from registry.npmjs.org over the 2 production dependency(ies) this repository's committed lockfile resolves, across 2 product package.json manifest(s). Its 0 `devDependencies` declaration(s) are excluded: a consumer installs none of them. ★ DEPTH: this is the DIRECT production set the lockfile resolves, NOT the transitive closure — only one of the four lock dialects this pass reads states a full graph, so a banned licence pulled in only by a dependency's OWN dependencies is outside this verdict, exactly as the JVM arm's declaration-site verdict is. ★ Each licence is the one the registry publishes for the package's CURRENT release rather than for the pinned version, which is the same caveat the Hex and RubyGems arms carry. This repository publishes itself under Apache-2.0, which is its own choice and is not judged here.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots8.1 / 10Strong✓ Tool-verified

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

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

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

Top hotspots: CodexMobile/CodexMobile/Services/CodexService+Messages.swift (25×127=3175); phodex-bridge/src/desktop-ipc-action-follower.js (51×58=2958); CodexMobile/CodexMobile/Services/CodexService+History.swift (14×168=2352)

Hotspot: CodexMobile/CodexMobile/Services/CodexService+Messages.swift · ×37CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2692

What to do

  1. Resolve the 37 Hotspot finding(s) in Churn × Complexity Hotspots — start with CodexService+Messages.swift, desktop-ipc-action-follower.js, CodexService+History.swift. — One of this dimension's main actionable groups (37 warning-level).

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

D17 · Explicit Debt10.0 / 10Stronggated by 1 serious finding✓ Tool-verified

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

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

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

1 deducted task-comment markers across 106587 LoC (0.0/KLoC) → score 10.0. 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.

TodoCommentCodexMobile/CodexMobile/Views/Turn/Messages/UserMessageBubble.swift:559

What to do

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

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

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

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

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

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

1 of 1 documentation facets pass in full. 11 document(s) read across 1 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

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

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — One of this dimension's main actionable groups (1 recommendation-level).

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

D26 · Project Cohesion3.3 / 10Weak✓ Tool-verified

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

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

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

1 of 3 build units (Xcode, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)7.0 / 10Adequate✓ Tool-verified

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

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

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

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

13 finding(s): 0 critical, 6 high, 7 medium, 0 low. 6 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 5 file(s) — `CodexMobile/CodexMobile/Terminal/Vendor/GhosttyKit.xcframework/ios-arm64-simulator/Headers/ghostty.h` (line 1069, line 1070, line 1072, …), `CodexMobile/CodexMobile/Terminal/Vendor/GhosttyKit.xcframework/ios-arm64/Headers/ghostty.h` (line 1069, line 1070, line 1072, …), `CodexMobile/CodexMobile/Views/Turn/Messages/UserMessageBubble.swift` (line 286, line 636), `phodex-bridge/src/git-handler.js`, `run-local-remodex.sh` (lines 337–351) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

D30 · Dependency Vulnerabilities9.4 / 10Adequategated by 1 critical finding✓ Tool-verified

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

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

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

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

REDACTED

What to do

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

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

D34 · Knowledge Freshness10.0 / 10Exemplary✓ Tool-verified

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

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

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

1 of 266 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is CodexMobile/CodexMobile/RemodexQuickActionCenter.swift. Counted over 266 of the 325 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned files with no living knowledge
Orphaned fileCodexMobile/CodexMobile/RemodexQuickActionCenter.swift:1

✓ On the Gold path — maintain.

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

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

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

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

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

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

Strongest change-coupling: GitActionModels.swift↔git-handler.js 80%; CodexService+IncomingAssistant.swift↔CodexService+Messages.swift 75%; CodexService.swift↔REDACTED 70%

Change coupling: GitActionModels.swift ↔ git-handler.js · ×6CodexMobile/CodexMobile/Models/GitActionModels.swift:1
Change-coupling hub: CodexService+IncomingAssistant.swift → CodexService+History.swift, CodexService+Incoming.swift, CodexService+Messages.swift, bridge.js · ×4CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift

What to do

  1. Resolve the 6 Change coupling finding(s) in Change Coupling — start with GitActionModels.swift, CodexService.swift, desktop-ipc-action-follower.js. — One of this dimension's main actionable groups (6 warning-level).
  2. Resolve the 4 Change-coupling hub finding(s) in Change Coupling — start with CodexService+IncomingAssistant.swift, TurnTimelineView.swift, CodexService+Connection.swift. — One of this dimension's main actionable groups (4 warning-level).

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

Frontend & cross-cutting dimensions

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

AX10 · Code composition10.0 / 10Exemplary✓ Tool-verified

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

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

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

What to do

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

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

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

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

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

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

AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

ED4 · Outbox / dual-write7.9 / 10Strong✓ Tool-verified

Other · Event-Driven — Whether state changes and message publishes are atomic (a transactional outbox) rather than a crash-unsafe dual write.

Method: Roslyn semantic scan (event-driven gated): event-handler methods scanned for DB-save plus bus-publish without a transactional outbox reference. Deterministic, semantic-resolved.

  • `CodexService.saveLocalState` performs two independent DURABLE writes — `messagePersistence` (a persistence store) via `save` and `composerDraftPersistence` (a persistence store) via `save` — in one command path with no shared transaction or outbox. A crash between the two leaves the stores diverged (one write committed, the other lost) or emits a phantom record. Wrap both in one transaction, or record the second write in the same store and dispatch it afterwards (a transactional outbox). — CodexMobile/CodexMobile/Services/CodexService.swift:38

What to do

  • Adopt the transactional outbox pattern so DB writes and message publishes commit atomically — no lost or phantom events on a crash.
M1 · Documentation (README)9.3 / 10Exemplary✓ Tool-verified

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

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

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

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

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

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

What to do

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

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

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

  • Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.

What to do

  • Group production code under src/ (or split deliberately, e.g. backend/ + frontend/) so production and tooling code aren't mixed at the root.
M4 · Documentation accuracy2.0 / 10Critical✓ Tool-verified

Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).

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

  • phodex-bridge/README.md links to `SELF_HOSTING_MODEL.md`, but `phodex-bridge/SELF_HOSTING_MODEL.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — phodex-bridge/README.md:36
  • phodex-bridge/README.md links to `CONTRIBUTING.md`, but `phodex-bridge/CONTRIBUTING.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — phodex-bridge/README.md:40
  • phodex-bridge/README.md links to `Docs/self-hosting.md`, but `phodex-bridge/Docs/self-hosting.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — phodex-bridge/README.md:204
  • phodex-bridge/README.md links to `relay/`, but `phodex-bridge/relay` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — phodex-bridge/README.md:395

What to do

  • Reconcile the README with reality: phodex-bridge/README.md links to `SELF_HOSTING_MODEL.md`, but `phodex-bridge/SELF_HOSTING_MODEL.md` does not exist; phodex-bridge/README.md links to `CONTRIBUTING.md`, but `phodex-bridge/CONTRIBUTING.md` does not exist; phodex-bridge/README.md links to `Docs/self-hosting.md`, but `phodex-bridge/Docs/self-hosting.md` does not exist; phodex-bridge/README.md links to `relay/`, but `phodex-bridge/relay` does not exist.
P1 · CI/CD gates10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

P2 · Observability6.0 / 10Adequate✓ Tool-verified

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

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

  • Only 1/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `CodexMobile`, `relay`.
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 727 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:727
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 728 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:728
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 736 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:736
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 988 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:988
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 990 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:990
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 991 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:991
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 992 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:992
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 994 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:994
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1043 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:1043
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1072 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:1072
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1094 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:1094
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1265 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:1265
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1314 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:1314
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1709 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:1709
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 2261 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:2261
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 2482 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:2482
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 3880 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:3880
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 3917 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/bridge.js:3917
  • `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 581 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/codex-desktop-refresher.js:581
  • `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 586 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/codex-desktop-refresher.js:586
  • `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 617 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/codex-desktop-refresher.js:617
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2335 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-action-follower.js:2335
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2498 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-action-follower.js:2498
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2587 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-action-follower.js:2587
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2684 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-action-follower.js:2684
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2866 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-action-follower.js:2866
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2879 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-action-follower.js:2879
  • `phodex-bridge/src/desktop-ipc-live-owner.js` reports through `console.*` at line 1197 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-live-owner.js:1197
  • `phodex-bridge/src/desktop-ipc-live-owner.js` reports through `console.*` at line 1828 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-live-owner.js:1828
  • `phodex-bridge/src/desktop-ipc-live-owner.js` reports through `console.*` at line 1876 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-live-owner.js:1876
  • `phodex-bridge/src/desktop-ipc-owner-transport.js` reports through `console.*` at line 96 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-owner-transport.js:96
  • `phodex-bridge/src/desktop-ipc-owner-transport.js` reports through `console.*` at line 116 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-owner-transport.js:116
  • `phodex-bridge/src/desktop-ipc-owner-transport.js` reports through `console.*` at line 154 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-owner-transport.js:154
  • `phodex-bridge/src/desktop-ipc-owner-transport.js` reports through `console.*` at line 415 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/desktop-ipc-owner-transport.js:415
  • `phodex-bridge/src/git-handler.js` reports through `console.*` at line 2089 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/git-handler.js:2089
  • `phodex-bridge/src/git-handler.js` reports through `console.*` at line 2095 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/git-handler.js:2095
  • `phodex-bridge/src/macos-launch-agent.js` reports through `console.*` at line 67 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/macos-launch-agent.js:67
  • `phodex-bridge/src/macos-launch-agent.js` reports through `console.*` at line 349 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/macos-launch-agent.js:349
  • `phodex-bridge/src/macos-launch-agent.js` reports through `console.*` at line 350 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — phodex-bridge/src/macos-launch-agent.js:350

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
  • Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
  • Add OpenTelemetry tracing/metrics (swift-otel with swift-distributed-tracing) so requests are traceable across the system, not just health-probable.
P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

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

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

  • No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 3964 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.

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.
PF2 · Allocation hygiene6.1 / 10Adequate✓ Tool-verified

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

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

What to do

  • Raise allocation-aware density on the hot paths — currently 22 use(s) across 119,591 production line(s) (~0.2/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
  • Swift: on hot paths, reserveCapacity before appending, use ContiguousArray for class-element arrays, work in place with withUnsafeBufferPointer/withUnsafeTemporaryAllocation, and make large values ~Copyable with borrowing/consuming parameters.
PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

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

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

  • `run` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — CodexMobile/RemodexMenuBar/BridgeControlService.swift:42
  • `fs.existsSync` in `gitInit` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:255
  • `fs.rmdirSync` in `createWorktreeAtManagedPath` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:721
  • `fs.writeFileSync` in `gitCreatePullRequest` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:1179
  • `fs.rmSync` in `gitCreatePullRequest` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:1202
  • `fs.mkdtempSync` in `runStructuredCodexJson` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:1704
  • `fs.writeFileSync` in `runStructuredCodexJson` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:1709
  • `fs.rmSync` in `runStructuredCodexJson` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:1736
  • `fs.writeFileSync` in `applyCopiedLocalChangesToWorktree` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:1986
  • `fs.rmSync` in `applyCopiedLocalChangesToWorktree` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:1996
  • `fs.existsSync` in `copyWorktreeIncludeFiles` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:2045
  • `fs.rmdirSync` in `removeCleanManagedWorktree` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/git-handler.js:2199
  • `fsImpl.existsSync` in `restartMacOSBridgeService` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/macos-launch-agent.js:159
  • `fs.existsSync` in `createPatchSandbox` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/workspace-handler.js:1082
  • `fs.existsSync` in `createPatchBackup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/workspace-handler.js:1121
  • `fs.unlinkSync` in `runGitApply` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — phodex-bridge/src/workspace-handler.js:1222

What to do

  • Swift: await instead of blocking — `try await Task.sleep(for:)` for Thread.sleep/sleep, a checked continuation instead of a DispatchSemaphore or DispatchGroup wait, the async Process and URLSession APIs; never park a thread waiting on a Task — the cooperative pool cannot guarantee it progress.
  • TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
R1 · Type 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 · 110 plain JS — the untyped files are phodex-bridge/scripts/cleanup-private-defaults.js, phodex-bridge/scripts/prepare-private-defaults.js, phodex-bridge/src/account-status.js, phodex-bridge/src/apply-patch-changes.js, phodex-bridge/src/bootstrap-codex-cli.js, phodex-bridge/src/bridge-status.js (+104 more).

What to do

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

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

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

  • relay/phodex-backend-relay.mjs:19 · relay/relay.js:33 — the two spans are one implementation copied and then locally edited — 965 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — relay/phodex-backend-relay.mjs:19
  • phodex-bridge/src/desktop-ipc-action-follower.js:2843 · phodex-bridge/src/desktop-ipc-owner-transport.js:72 — the two spans are one implementation copied and then locally edited — 617 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — phodex-bridge/src/desktop-ipc-action-follower.js:2843
  • phodex-bridge/src/pet-handler.js:17 · phodex-bridge/src/project-handler.js:24 · phodex-bridge/src/workspace-handler.js:46 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/pet-handler.js:17
  • phodex-bridge/src/desktop-handler.js:26 · phodex-bridge/src/project-handler.js:28 · phodex-bridge/src/workspace-handler.js:48 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete. — phodex-bridge/src/desktop-handler.js:26
  • REDACTED:843 · relay/relay.js:629 — the two spans are one implementation copied and then locally edited — 132 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:843
  • phodex-bridge/src/desktop-ipc-action-follower.js:4192 · phodex-bridge/src/desktop-ipc-state-patches.js:162 — the two spans are one implementation copied and then locally edited — 162 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — phodex-bridge/src/desktop-ipc-action-follower.js:4192
  • phodex-bridge/src/desktop-handler.js:209 · phodex-bridge/src/desktop-handler.js:245 — 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. — phodex-bridge/src/desktop-handler.js:209
  • phodex-bridge/src/desktop-ipc-action-follower.js:1090 · phodex-bridge/src/desktop-ipc-live-owner.js:1355 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/desktop-ipc-action-follower.js:1090
  • REDACTED:434 · REDACTED:593 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:434
  • phodex-bridge/src/session-jsonl-history.js:254 · phodex-bridge/src/session-jsonl-history.js:416 — 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. — phodex-bridge/src/session-jsonl-history.js:254
  • phodex-bridge/src/git-handler.js:2998 · phodex-bridge/src/workspace-handler.js:1323 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/git-handler.js:2998
  • phodex-bridge/bin/remodex.js:103 · phodex-bridge/bin/remodex.js:124 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/bin/remodex.js:103
  • phodex-bridge/src/desktop-ipc-conversation-projector.js:1011 · phodex-bridge/src/desktop-ipc-conversation-projector.js:1234 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/desktop-ipc-conversation-projector.js:1011
  • phodex-bridge/src/bridge.js:4083 · phodex-bridge/src/bridge.js:4106 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/bridge.js:4083
  • phodex-bridge/src/notifications-handler.js:8 · phodex-bridge/src/pet-handler.js:19 · phodex-bridge/src/project-handler.js:28 · phodex-bridge/src/workspace-handler.js:48 — the 4 copies are spread across 4 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/notifications-handler.js:8
  • REDACTED:245 · REDACTED:274 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:245
  • phodex-bridge/src/macos-launch-agent.js:83 · phodex-bridge/src/macos-launch-agent.js:140 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/macos-launch-agent.js:83
  • phodex-bridge/src/rollout-live-mirror.js:1993 · phodex-bridge/src/session-jsonl-history.js:1126 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/rollout-live-mirror.js:1993
  • phodex-bridge/src/session-jsonl-history.js:303 · phodex-bridge/src/session-jsonl-history.js:351 — 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. — phodex-bridge/src/session-jsonl-history.js:303
  • phodex-bridge/src/bridge.js:4891 · phodex-bridge/src/session-jsonl-history.js:1055 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — phodex-bridge/src/bridge.js:4891
  • phodex-bridge/src/codex-desktop-refresher.js:659 · phodex-bridge/src/desktop-ipc-live-owner.js:1136 — the two spans are one implementation copied and then locally edited — 69 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — phodex-bridge/src/codex-desktop-refresher.js:659
  • phodex-bridge/src/desktop-ipc-action-follower.js:1140 · phodex-bridge/src/desktop-ipc-action-follower.js:1175 — 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. — phodex-bridge/src/desktop-ipc-action-follower.js:1140
  • phodex-bridge/src/git-handler.js:2751 · phodex-bridge/src/git-handler.js:2777 — 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. — phodex-bridge/src/git-handler.js:2751
  • phodex-bridge/src/rollout-live-mirror.js:2247 · phodex-bridge/src/rollout-watch.js:772 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — phodex-bridge/src/rollout-live-mirror.js:2247
  • phodex-bridge/src/rollout-watch.js:320 · phodex-bridge/src/rollout-watch.js:389 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/rollout-watch.js:320
  • phodex-bridge/src/codex-transport.js:51 · phodex-bridge/src/codex-transport.js:333 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/codex-transport.js:51
  • phodex-bridge/src/desktop-ipc-conversation-adapter.js:282 · phodex-bridge/src/desktop-ipc-conversation-adapter.js:414 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/desktop-ipc-conversation-adapter.js:282
  • phodex-bridge/src/desktop-ipc-conversation-adapter.js:922 · phodex-bridge/src/desktop-ipc-conversation-projector.js:1016 · phodex-bridge/src/desktop-ipc-conversation-projector.js:1247 — the 3 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/desktop-ipc-conversation-adapter.js:922
  • phodex-bridge/src/desktop-ipc-conversation-projector.js:705 · phodex-bridge/src/desktop-ipc-conversation-projector.js: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. — phodex-bridge/src/desktop-ipc-conversation-projector.js:705
  • REDACTED:682 · REDACTED:708 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — REDACTED:682
  • phodex-bridge/src/account-status.js:135 · REDACTED:498 — the two spans are one implementation copied and then locally edited — 56 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — phodex-bridge/src/account-status.js:135
  • REDACTED:488 · phodex-bridge/src/rollout-live-mirror.js:2264 — the two spans are one implementation copied and then locally edited — 54 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — REDACTED:488
  • phodex-bridge/src/desktop-ipc-action-follower.js:712 · phodex-bridge/src/desktop-ipc-action-follower.js:1018 · phodex-bridge/src/desktop-ipc-live-owner.js:460 — the 3 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/desktop-ipc-action-follower.js:712
  • phodex-bridge/src/desktop-ipc-conversation-adapter.js:117 · phodex-bridge/src/desktop-ipc-live-owner.js:1895 — the two spans are one implementation copied and then locally edited — 79 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — phodex-bridge/src/desktop-ipc-conversation-adapter.js:117
  • phodex-bridge/src/project-handler.js:544 · phodex-bridge/src/project-handler.js:567 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/project-handler.js:544
  • phodex-bridge/src/workspace-handler.js:699 · phodex-bridge/src/workspace-handler.js:781 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/workspace-handler.js:699
  • phodex-bridge/src/workspace-handler.js:727 · phodex-bridge/src/workspace-handler.js:811 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/workspace-handler.js:727
  • relay/apns-client.js:185 · relay/push-service.js:407 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — relay/apns-client.js:185
  • phodex-bridge/src/bridge.js:3775 · phodex-bridge/src/bridge.js:4002 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/bridge.js:3775
  • phodex-bridge/src/desktop-ipc-action-follower.js:2759 · phodex-bridge/src/desktop-ipc-action-follower.js:2785 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — phodex-bridge/src/desktop-ipc-action-follower.js:2759

What to do

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

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

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

  • applyAppServerMessageToConversationState has cyclomatic complexity 95 and cognitive complexity 97; 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. — phodex-bridge/src/desktop-ipc-conversation-adapter.js:143
  • parseSessionJsonlTurns has cyclomatic complexity 67 and cognitive complexity 124; 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. — phodex-bridge/src/session-jsonl-history.js:400
  • synthesizeNotificationsFromRolloutEntry has cyclomatic complexity 56 and cognitive complexity 83; 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. — phodex-bridge/src/rollout-live-mirror.js:938
  • synchronizeDesktopConversationCompatibility has cyclomatic complexity 55 and cognitive complexity 42; 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. — phodex-bridge/src/desktop-ipc-conversation-adapter.js:619
  • handleRequest has cyclomatic complexity 54 and cognitive complexity 73; 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. — phodex-bridge/src/opencode-runtime.js:1228
  • observeInbound has cyclomatic complexity 52 and cognitive complexity 73; 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. — phodex-bridge/src/desktop-ipc-action-follower.js:507
  • onEnvelope has cyclomatic complexity 47 and cognitive complexity 64; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — phodex-bridge/src/desktop-ipc-action-follower.js:762
  • buildConversationStateFromThread has cyclomatic complexity 45 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 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. — phodex-bridge/src/desktop-ipc-conversation-adapter.js:445
  • refreshTouchedNormalizedActiveTurns has cyclomatic complexity 44 and cognitive complexity 73; 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. — phodex-bridge/src/desktop-ipc-action-follower.js:3497
  • diagnoseSessionJsonl has cyclomatic complexity 44 and cognitive complexity 49; 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. — phodex-bridge/bin/remodex-jsonl-diagnose.js:72
  • poll has cyclomatic complexity 43 and cognitive complexity 43; 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. — phodex-bridge/src/opencode-runtime.js:588
  • observeOutbound has cyclomatic complexity 42 and cognitive complexity 50; 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. — phodex-bridge/src/desktop-ipc-live-owner.js:327
  • bootstrapFromExistingRollout has cyclomatic complexity 37 and cognitive complexity 48; 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. — phodex-bridge/src/rollout-live-mirror.js:435
  • projectConversationState has cyclomatic complexity 35 and cognitive complexity 23; 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. — phodex-bridge/src/desktop-ipc-conversation-projector.js:179
  • normalizeRelayBoundJsonRpcMessage has cyclomatic complexity 33 and cognitive complexity 30; 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. — phodex-bridge/src/bridge.js:3474
  • processEvent has cyclomatic complexity 33 and cognitive complexity 28; 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. — phodex-bridge/src/opencode-runtime.js:865
  • inspectBootstrapRunBoundary has cyclomatic complexity 31 and cognitive complexity 43; 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. — phodex-bridge/src/rollout-live-mirror.js:671
  • gitRunStackedAction has cyclomatic complexity 31 and cognitive complexity 31; 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. — phodex-bridge/src/git-handler.js:1036
  • emitItem has cyclomatic complexity 31 and cognitive complexity 30; 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. — phodex-bridge/src/opencode-runtime.js:649
  • createNormalizedLiveIndex has cyclomatic complexity 30 and cognitive complexity 49; 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. — phodex-bridge/src/desktop-ipc-action-follower.js:3372

What to do

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

  • phodex-bridge/src/bridge.js has 5024 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/bridge.js:1
  • phodex-bridge/src/desktop-ipc-action-follower.js has 4011 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/desktop-ipc-action-follower.js:1
  • phodex-bridge/src/git-handler.js has 2714 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/git-handler.js:1
  • phodex-bridge/src/rollout-live-mirror.js has 2081 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/rollout-live-mirror.js:1
  • phodex-bridge/src/desktop-ipc-live-owner.js has 1949 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/desktop-ipc-live-owner.js:1
  • phodex-bridge/src/desktop-ipc-conversation-adapter.js has 1397 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/desktop-ipc-conversation-adapter.js:1
  • phodex-bridge/src/session-jsonl-history.js has 1381 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/session-jsonl-history.js:1
  • phodex-bridge/src/opencode-runtime.js has 1362 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/opencode-runtime.js:1
  • phodex-bridge/src/workspace-handler.js has 1211 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/workspace-handler.js:1
  • phodex-bridge/src/desktop-ipc-conversation-projector.js has 1199 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/desktop-ipc-conversation-projector.js:1
  • phodex-bridge/src/push-notification-tracker.js has 896 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/push-notification-tracker.js:1
  • REDACTED has 890 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • phodex-bridge/src/codex-desktop-refresher.js has 865 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/codex-desktop-refresher.js:1
  • phodex-bridge/src/rollout-watch.js has 847 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/rollout-watch.js:1
  • phodex-bridge/src/desktop-ipc-owner-transport.js has 769 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/desktop-ipc-owner-transport.js:1
  • REDACTED has 677 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • relay/relay.js has 653 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — relay/relay.js:1
  • phodex-bridge/src/macos-launch-agent.js has 644 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/macos-launch-agent.js:1
  • phodex-bridge/src/thread-activity-projector.js has 637 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/thread-activity-projector.js:1
  • phodex-bridge/src/project-handler.js has 559 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/project-handler.js:1
  • phodex-bridge/src/voice-handler.js has 539 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/voice-handler.js:1
  • phodex-bridge/src/desktop-handler.js has 507 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/desktop-handler.js:1
  • phodex-bridge/src/pet-handler.js has 468 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/pet-handler.js:1
  • REDACTED has 460 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • phodex-bridge/src/secure-device-state.js has 433 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — phodex-bridge/src/secure-device-state.js:1

What to do

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

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

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

  • No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×5) — relay/phodex-backend-relay.mjs:1, phodex-bridge/src/bootstrap-codex-cli.js:1, phodex-bridge/scripts/prepare-private-defaults.js:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R5 · Dependency Freshness9.9 / 10Exemplary✓ Tool-verified

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

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

What to do

  • Bump outdated dependencies to current versions to limit upgrade debt.
R6 · Tooling3.4 / 10Weak✓ Tool-verified

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

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

  • test ✓ · lint ✗ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.

What to do

  • Add eslint and type checking (adopt TypeScript, or type-check the existing JavaScript with `checkJs`) as package.json scripts and run them in CI.
R7 · Dead Code9.7 / 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.

  • Unreachable from the 9 application, 6 tooling and 51 test entry point(s) detected in this repo. Nothing this repository declares compiles or type-checks these files, so a wrong deletion here would raise no compile error — gate removals on `npm test`, which loads the modules, and note that it only covers what it exercises. An undetected custom entry would make these reachable.
  • no import path from any entry point (9 application, 6 tooling, 51 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make — relay/phodex-backend-relay.mjs
  • This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. (×2) — phodex-bridge/src/secure-device-state.js:173, phodex-bridge/src/session-jsonl-history.js:1423

What to do

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

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

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

R9 · Circular Imports10.0 / 10Exemplary✓ Tool-verified

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

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

X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

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

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

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

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

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

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

X17 · Uncapped recursion over a caller-supplied document10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

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

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

X3 · Exception handling5.4 / 10Adequate✓ Tool-verified

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

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

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×30) — relay/push-service.js:285, phodex-bridge/src/bootstrap-codex-cli.js:50, phodex-bridge/src/bridge.js:2524, …
  • `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×6) — phodex-bridge/src/bridge.js:1578, phodex-bridge/src/codex-runtime-settings.js:96, phodex-bridge/src/codex-runtime-settings.js:98, …
  • `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. (×4) — phodex-bridge/src/git-handler.js:2140, phodex-bridge/src/project-handler.js:377, phodex-bridge/src/session-jsonl-history.js:372, …

What to do

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

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

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

Reference — by lens

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

LensScoreRatingImpact
Code Health35%Weak — gated by D2, R1, R3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture93%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity56%Adequate — gated by M4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness52%Adequate — gated by R6, P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security91%ExemplaryStrongest area.
Event-Driven79%StrongSolid.
Performance60%AdequateAcceptable, with room to improve.
Unscored — 3 check(s) recorded observations but carry no score

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

  • D36 Supply-chain Provenance & Signing — 1 observation(s) recorded · The CI pipeline builds and tests but publishes no released artifact — no package publish, container push, GitHub release or deployment step. Supply-chain provenance, signing and SBOM attest RELEASED artifacts, so there is nothing to attest here. Add them to the release pipeline when this repo starts shipping artifacts (a published package, a container image, a deployed service or a tagged release). 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.
  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 15 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 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.
  • P4 Deployment & Rollback — not evidenced — no deploy/rollback/approval signal in the repo; absence of evidence is not evidence of a manual release
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
  • P6 Release Hygiene — not evidenced — no changelog, version stamp or semver release tag in the repo
Not included — 59 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's 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.
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads. TypeScript/JavaScript runs each process's requests on one event loop, so no two requests write a shared object at the same instant (interleaving across an await is a different defect).
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — the dev server did not expose a crawlable HTTP endpoint in time — no runtime evidence This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • C1 Data Protection — 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 has no runner
  • D16 Bus Factor — single-maintainer repository — bus factor is not applicable
  • 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.
  • D21 Naming Consistency — Naming consistency is measured on C# only; JavaScript, Swift not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed JavaScript 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+ projects each declaring an entity of their own. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .swift, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.swift), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 73 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
  • DM1 Domain Modelling — not scored — this repository shows none of the 3 signals this lens looks for
  • 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
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P7 Outbound HTTP resilience — no outbound HTTP usage detected — no HTTP client call or construction in the JavaScript/TypeScript, Swift source (service entry point: relay/server.js:44 (http.createServer())
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — coverage data present for 107 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `Benchmark("…")` in a file importing package-benchmark, or package-benchmark in Package.swift, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X27 Collection changed while being enumerated — Not applicable: this check looks for a loop whose body adds to or removes from the very collection the loop is walking, invalidating the enumerator it holds, and in this repository's languages that cannot happen. JavaScript and TypeScript have no iterator that a change can invalidate: an `Array` is walked by index against its live length, and a `Map` or `Set` by the ECMAScript specification's live entry list, so a body that adds to, removes from or empties what it walks raises nothing — every loop form (`for…of`, `for…in`, `forEach`, `map`, `filter`, `reduce`, `entries()`) on every built-in collection (`Array`, `Map`, `Set`, plain objects, `URLSearchParams`, `Headers`, `FormData`) runs to completion. Such a loop can still skip an element or never end, which is a different defect and not the one this check asks about. Swift's `Array`, `Dictionary` and `Set` are values: `for x in items` walks the copy taken when the loop starts, so a body that adds to or removes from `items` changes a different value, nothing is invalidated, and every original element is still visited. This repository's Swift names no Foundation mutable collection (`NSMutableArray` and kin), the one kind a Swift loop can walk by reference. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

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

Critical — 12 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D11 · Test Reliability · Flaky test · ×3
  • Flaky test: phodex-bridge/::capped bootstrap attaches mid-turn growth under a synthetic turn without replaying the tail — Passed 2×, failed 1× across repeated runs.
  • Flaky test: phodex-bridge/::capped bootstrap attaches to an openerless active turn visible inside the window — Passed 2×, failed 1× across repeated runs.
  • Flaky test: phodex-bridge/::live owner dedupes read-state broadcasts for already-clean threads — Passed 2×, failed 1× across repeated runs.
D13 · Secret Scanning · Leaked secret · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×1
  • REDACTED
ED4 · Outbox / dual-write · Dual write (no outbox) · ×1
  • Dual write (no outbox): CodexService.saveLocalState CodexMobile/CodexMobile/Services/CodexService.swift:38 — `CodexService.saveLocalState` performs two independent DURABLE writes — `messagePersistence` (a persistence store) via `save` and `composerDraftPersistence` (a persistence store) via `save` — in one command path with no shared transaction or outbox. A crash between the two leaves the stores diverged (one write committed, the other lost) or emits a phantom record. Wrap both in one transaction, or record the second write in the same store and dispatch it afterwards (a transactional outbox).
Serious — 1220 finding(s)
D3 · God Classes · FileTooLong · ×53
  • FileTooLong: Services/CodexService+Messages.swift CodexMobile/CodexMobile/Services/CodexService+Messages.swift — FileTooLong — 4804 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 4304 over it, 9.61× 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: src/bridge.js phodex-bridge/src/bridge.js — FileTooLong — 3760 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 3260 over it, 7.52× 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: Services/CodexService+History.swift CodexMobile/CodexMobile/Services/CodexService+History.swift — FileTooLong — 3157 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2657 over it, 6.31× 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: src/desktop-ipc-action-follower.js phodex-bridge/src/desktop-ipc-action-follower.js — FileTooLong — 2901 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units), about 60% of them inside a single declaration: createDesktopIpcActionFollower (240-2812). The bar is 500 significant lines; this is 2401 over it, 5.80× 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: Services/CodexService+Incoming.swift CodexMobile/CodexMobile/Services/CodexService+Incoming.swift — FileTooLong — 2635 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2135 over it, 5.27× 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: REDACTED REDACTED — FileTooLong — 2527 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: TurnViewModel (166-3595). The bar is 500 significant lines; this is 2027 over it, 5.05× 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: Services/CodexService+ThreadsTurns.swift CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift — FileTooLong — 2475 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1975 over it, 4.95× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/git-handler.js phodex-bridge/src/git-handler.js — FileTooLong — 2053 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 1553 over it, 4.11× 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: src/rollout-live-mirror.js phodex-bridge/src/rollout-live-mirror.js — FileTooLong — 1530 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 1030 over it, 3.06× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: CodexMobile/ContentView.swift CodexMobile/CodexMobile/ContentView.swift — FileTooLong — 1469 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: ContentView (45-2207). The bar is 500 significant lines; this is 969 over it, 2.94× 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: src/desktop-ipc-live-owner.js phodex-bridge/src/desktop-ipc-live-owner.js — FileTooLong — 1421 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units), about 88% of them inside a single declaration: createDesktopIpcLiveOwner (136-1942). The bar is 500 significant lines; this is 921 over it, 2.84× 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: Core/TurnView.swift CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift — FileTooLong — 1297 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: TurnView (18-1866). The bar is 500 significant lines; this is 797 over it, 2.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: Terminal/GhosttyTerminalView.swift CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift — FileTooLong — 1210 significant lines (blank, comment-only and punctuation-only lines excluded), about 85% of them inside a single declaration: GhosttyTerminalView (288-1756). The bar is 500 significant lines; this is 710 over it, 2.42× 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: src/desktop-ipc-conversation-adapter.js phodex-bridge/src/desktop-ipc-conversation-adapter.js — FileTooLong — 1114 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 614 over it, 2.23× 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: src/opencode-runtime.js phodex-bridge/src/opencode-runtime.js — FileTooLong — 1087 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 587 over it, 2.17× 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: src/session-jsonl-history.js phodex-bridge/src/session-jsonl-history.js — FileTooLong — 1073 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 573 over it, 2.15× 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: Messages/WorkspaceImagePreview.swift CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift — FileTooLong — 1039 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 539 over it, 2.08× 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: Services/CodexService+SecureTransport.swift CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift — FileTooLong — 1035 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 535 over it, 2.07× 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: Timeline/TurnTimelineView.swift CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift — FileTooLong — 958 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: TurnTimelineView (29-1290). The bar is 500 significant lines; this is 458 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: src/workspace-handler.js phodex-bridge/src/workspace-handler.js — FileTooLong — 926 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 426 over it, 1.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Services/CodexService+Connection.swift CodexMobile/CodexMobile/Services/CodexService+Connection.swift — FileTooLong — 914 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 414 over it, 1.83× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Core/NewChatDraftView.swift CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift — FileTooLong — 907 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: NewChatDraftView (59-1310). The bar is 500 significant lines; this is 407 over it, 1.81× 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: Timeline/TurnTimelineReducer.swift CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift — FileTooLong — 892 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: TurnTimelineReducer (13-1457). The bar is 500 significant lines; this is 392 over it, 1.78× 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: src/desktop-ipc-conversation-projector.js phodex-bridge/src/desktop-ipc-conversation-projector.js — FileTooLong — 882 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 382 over it, 1.76× 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: Services/CodexService.swift CodexMobile/CodexMobile/Services/CodexService.swift — FileTooLong — 879 significant lines (blank, comment-only and punctuation-only lines excluded), about 65% of them inside a single declaration: CodexService (424-1266). The bar is 500 significant lines; this is 379 over it, 1.76× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • + 28 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×37
  • Hotspot: CodexMobile/CodexMobile/Services/CodexService+Messages.swift CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2692 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift changed 25 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 127 in CodexService.upsertStreamingSystemItemMessage at line 2692. 1 of those changes was a fix/bug commit, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+Messages.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: phodex-bridge/src/desktop-ipc-action-follower.js phodex-bridge/src/desktop-ipc-action-follower.js:507 — phodex-bridge/src/desktop-ipc-action-follower.js changed 51 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 58 in desktop-ipc-action-follower.createDesktopIpcActionFollower.observeInbound at line 507. 13 of those changes were fix/bug commits, and the other 38 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- phodex-bridge/src/desktop-ipc-action-follower.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: CodexMobile/CodexMobile/Services/CodexService+History.swift CodexMobile/CodexMobile/Services/CodexService+History.swift:931 — CodexMobile/CodexMobile/Services/CodexService+History.swift changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 168 in CodexService.mergeHistoryMessages at line 931. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+History.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: phodex-bridge/src/bridge.js phodex-bridge/src/bridge.js:714 — phodex-bridge/src/bridge.js changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in bridge.startBridge at line 714. 9 of those changes were fix/bug commits, and the other 31 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- phodex-bridge/src/bridge.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: phodex-bridge/src/desktop-ipc-live-owner.js phodex-bridge/src/desktop-ipc-live-owner.js:327 — phodex-bridge/src/desktop-ipc-live-owner.js changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 41 in desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound at line 327. 11 of those changes were fix/bug commits, and the other 30 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- phodex-bridge/src/desktop-ipc-live-owner.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:226 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in TurnTimelineRenderProjection.renderItems at line 226. 3 of those changes were fix/bug commits, and the other 24 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.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: CodexMobile/CodexMobile/Services/CodexService+Incoming.swift CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:177 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in CodexService.handleNotification at line 177. 2 of those changes were fix/bug commits, and the other 22 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+Incoming.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: phodex-bridge/src/desktop-ipc-conversation-adapter.js phodex-bridge/src/desktop-ipc-conversation-adapter.js:143 — phodex-bridge/src/desktop-ipc-conversation-adapter.js changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState at line 143. 3 of those changes were fix/bug commits, and the other 11 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- phodex-bridge/src/desktop-ipc-conversation-adapter.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1369 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in CodexService.ensureThreadResumed at line 1369. 4 of those changes were fix/bug commits, and the other 20 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.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: phodex-bridge/src/rollout-live-mirror.js phodex-bridge/src/rollout-live-mirror.js:938 — phodex-bridge/src/rollout-live-mirror.js changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in rollout-live-mirror.synthesizeNotificationsFromRolloutEntry at line 938. 4 of those changes were fix/bug commits, and the other 12 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- phodex-bridge/src/rollout-live-mirror.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:75 — CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in TurnView.body at line 75. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Views/Turn/Core/TurnView.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: CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift:536 — CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in MessageRow.assistantView at line 536. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.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: phodex-bridge/src/session-jsonl-history.js phodex-bridge/src/session-jsonl-history.js:400 — phodex-bridge/src/session-jsonl-history.js changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in session-jsonl-history.parseSessionJsonlTurns at line 400. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- phodex-bridge/src/session-jsonl-history.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: CodexMobile/CodexMobile/Services/CodexService.swift CodexMobile/CodexMobile/Services/CodexService.swift:899 — CodexMobile/CodexMobile/Services/CodexService.swift changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in CodexService.init at line 899. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService.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: CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerHostView.swift CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerHostView.swift:62 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerHostView.swift changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in TurnComposerHostView.body 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-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerHostView.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: CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift:220 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 25 in TurnComposerView.composerStack at line 220. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.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: phodex-bridge/src/desktop-ipc-conversation-projector.js phodex-bridge/src/desktop-ipc-conversation-projector.js:179 — phodex-bridge/src/desktop-ipc-conversation-projector.js changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in desktop-ipc-conversation-projector.projectConversationState at line 179. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- phodex-bridge/src/desktop-ipc-conversation-projector.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: REDACTED REDACTED:331 — REDACTED changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in desktop-ipc-shared.sanitizeUserRoleItem at line 331. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- REDACTED`: 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: phodex-bridge/src/opencode-runtime.js phodex-bridge/src/opencode-runtime.js:1228 — phodex-bridge/src/opencode-runtime.js changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in opencode-runtime.createOpenCodeRuntime.handleRequest at line 1228. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- phodex-bridge/src/opencode-runtime.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:58 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in TurnTimelineReducer.enforceIntraTurnOrder at line 58. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.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: CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift:104 — CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in CodexService.appendCompletedAgentText at line 104. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.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: CodexMobile/CodexMobile/Services/CodexService+MacContext.swift CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:124 — CodexMobile/CodexMobile/Services/CodexService+MacContext.swift changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in CodexService.loadMacScopedDefaultsState at line 124. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+MacContext.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: CodexMobile/CodexMobile/Services/CodexService+Sync.swift CodexMobile/CodexMobile/Services/CodexService+Sync.swift:222 — CodexMobile/CodexMobile/Services/CodexService+Sync.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in CodexService.reconcileLocalThreadsWithServer at line 222. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+Sync.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: CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:221 — CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in CodexService.loadOlderThreadHistoryPage at line 221. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.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: CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:17 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in TurnTimelineView.assistantBlockInfo at line 17. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 21:01:28 +02:00' --until='2026-09-29 21:01:28 +02:00' --full-history --no-merges -- CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.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.
  • + 12 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×36
  • Swallowed exception (empty catch) relay/push-service.js:285 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/bootstrap-codex-cli.js:50 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/bridge.js:1578 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/bridge.js:2524 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/codex-runtime-settings.js:96 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/codex-runtime-settings.js:98 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/daemon-state.js:106 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/daemon-state.js:126 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/desktop-ipc-action-follower.js:1438 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/desktop-ipc-action-follower.js:4137 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/desktop-ipc-live-owner.js:536 — `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/desktop-ipc-live-owner.js:1489 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/desktop-ipc-owner-transport.js:811 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) REDACTED:644 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:473 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:722 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:949 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:2003 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:2012 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:2018 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:2026 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:2032 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:2128 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:2150 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) phodex-bridge/src/git-handler.js:2600 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • + 11 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×33
  • MethodTooLong: TurnView.body CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:75 — MethodTooLong — body runs 417 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 317 over it, 4.17× 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: CodexService.completeAssistantMessage CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4013 — MethodTooLong — completeAssistantMessage runs 353 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 253 over it, 3.53× 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: CodexService.mergeHistoryMessages CodexMobile/CodexMobile/Services/CodexService+History.swift:931 — MethodTooLong — mergeHistoryMessages runs 336 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 236 over it, 3.36× 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: CodexService.loadThreadHistoryIfNeeded CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1271 — MethodTooLong — loadThreadHistoryIfNeeded runs 330 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 230 over it, 3.30× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TurnComposerHostView.body CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerHostView.swift:62 — MethodTooLong — body runs 278 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 178 over it, 2.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: CodexService.upsertStreamingSystemItemMessage CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2692 — MethodTooLong — upsertStreamingSystemItemMessage runs 269 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 169 over it, 2.69× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CodexService.decodeMessagesFromThreadRead CodexMobile/CodexMobile/Services/CodexService+History.swift:98 — MethodTooLong — decodeMessagesFromThreadRead runs 261 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 161 over it, 2.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CodexService.loadOlderThreadHistoryPage CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:221 — MethodTooLong — loadOlderThreadHistoryPage runs 180 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× 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: MessageRow.assistantView CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift:536 — MethodTooLong — assistantView runs 173 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 73 over it, 1.73× 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: TurnTimelineRenderProjection.renderItems CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:226 — MethodTooLong — renderItems runs 173 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 73 over it, 1.73× 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: CodexService.handleNotification CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:177 — MethodTooLong — handleNotification runs 162 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 62 over it, 1.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CodexService.handleStructuredItemLifecycle CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2409 — MethodTooLong — handleStructuredItemLifecycle runs 159 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 59 over it, 1.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: CodexService.performSecureHandshake CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:13 — MethodTooLong — performSecureHandshake runs 159 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 59 over it, 1.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: CodexService.applyCanonicalHistoryOrder CodexMobile/CodexMobile/Services/CodexService+History.swift:1433 — MethodTooLong — applyCanonicalHistoryOrder runs 146 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CodexService.ensureThreadResumed CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1369 — MethodTooLong — ensureThreadResumed runs 145 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 45 over it, 1.45× 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: CodexService.reconcileExistingMessage CodexMobile/CodexMobile/Services/CodexService+History.swift:2008 — MethodTooLong — reconcileExistingMessage runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.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: CodexService.steerTurn CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2073 — MethodTooLong — steerTurn runs 139 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 39 over it, 1.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CodexService.sendTurnStart CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1745 — MethodTooLong — sendTurnStart runs 136 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 36 over it, 1.36× 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: CodexService.repairCanonicalAssistantSourceIdentityRotations CodexMobile/CodexMobile/Services/CodexService+History.swift:1700 — MethodTooLong — repairCanonicalAssistantSourceIdentityRotations runs 133 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 33 over it, 1.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: NewChatDraftView.body CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:116 — MethodTooLong — body runs 133 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 33 over it, 1.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CodexService.markTurnCompleted CodexMobile/CodexMobile/Services/CodexService+Messages.swift:5308 — MethodTooLong — markTurnCompleted runs 129 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 29 over it, 1.29× 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: CodexService.startTurn CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:359 — MethodTooLong — startTurn runs 126 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TurnComposerView.composerStack CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift:220 — MethodTooLong — composerStack runs 126 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TurnViewModel.triggerGitAction REDACTED:3211 — MethodTooLong — triggerGitAction runs 125 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 25 over it, 1.25× 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: ComposerPreviewContent.body CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift:793 — MethodTooLong — body runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.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.
  • + 8 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×25
  • FunctionTooLong: desktop-ipc-action-follower.createDesktopIpcActionFollower phodex-bridge/src/desktop-ipc-action-follower.js:240 — FunctionTooLong — createDesktopIpcActionFollower runs 1747 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1647 over it, 17.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.
  • FunctionTooLong: desktop-ipc-live-owner.createDesktopIpcLiveOwner phodex-bridge/src/desktop-ipc-live-owner.js:136 — FunctionTooLong — createDesktopIpcLiveOwner runs 1247 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1147 over it, 12.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.
  • FunctionTooLong: bridge.startBridge phodex-bridge/src/bridge.js:714 — FunctionTooLong — startBridge runs 1201 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1101 over it, 12.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.
  • FunctionTooLong: git-handler.tokenizeThreadTitleWords phodex-bridge/src/git-handler.js:1591 — FunctionTooLong — tokenizeThreadTitleWords runs 895 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 795 over it, 8.95× 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: secure-transport.createBridgeSecureTransport REDACTED:36 — FunctionTooLong — createBridgeSecureTransport runs 509 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 409 over it, 5.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.
  • FunctionTooLong: push-notification-tracker.createPushNotificationTracker phodex-bridge/src/push-notification-tracker.js:32 — FunctionTooLong — createPushNotificationTracker runs 348 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 248 over it, 3.48× 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: desktop-ipc-owner-transport.createDesktopIpcRouterServer phodex-bridge/src/desktop-ipc-owner-transport.js:363 — FunctionTooLong — createDesktopIpcRouterServer runs 286 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 186 over it, 2.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: bridge.createThreadTurnsListFastPageCoordinator phodex-bridge/src/bridge.js:178 — FunctionTooLong — createThreadTurnsListFastPageCoordinator runs 253 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 153 over it, 2.53× 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: desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState phodex-bridge/src/desktop-ipc-conversation-adapter.js:143 — FunctionTooLong — applyAppServerMessageToConversationState runs 245 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 145 over it, 2.45× 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: desktop-ipc-owner-transport.createDesktopOwnerIpcClient phodex-bridge/src/desktop-ipc-owner-transport.js:27 — FunctionTooLong — createDesktopOwnerIpcClient runs 241 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 141 over it, 2.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: desktop-ipc-action-follower.createDesktopIpcClient phodex-bridge/src/desktop-ipc-action-follower.js:2815 — FunctionTooLong — createDesktopIpcClient runs 205 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 105 over it, 2.05× 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: thread-activity-store.createThreadActivityStore phodex-bridge/src/thread-activity-store.js:16 — FunctionTooLong — createThreadActivityStore 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: rollout-live-mirror.createThreadRolloutLiveMirror phodex-bridge/src/rollout-live-mirror.js:159 — FunctionTooLong — createThreadRolloutLiveMirror runs 184 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 84 over it, 1.84× 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: push-service.createPushSessionService relay/push-service.js:17 — FunctionTooLong — createPushSessionService runs 163 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 63 over it, 1.63× 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: StructuredUserInputCardView.swift.top-level code CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:503 — FunctionTooLong — top-level code runs 146 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: desktop-ipc-action-follower.createDesktopIpcActionFollower.observeInbound phodex-bridge/src/desktop-ipc-action-follower.js:507 — FunctionTooLong — createDesktopIpcActionFollower.observeInbound runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.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.
  • FunctionTooLong: rollout-live-mirror.synthesizeNotificationsFromRolloutEntry phodex-bridge/src/rollout-live-mirror.js:938 — FunctionTooLong — synthesizeNotificationsFromRolloutEntry runs 135 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 35 over it, 1.35× 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: rollout-watch.createThreadRolloutActivityWatcher phodex-bridge/src/rollout-watch.js:32 — FunctionTooLong — createThreadRolloutActivityWatcher runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.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.
  • FunctionTooLong: rollout-live-mirror.createThreadRolloutLiveMirror.tick phodex-bridge/src/rollout-live-mirror.js:201 — FunctionTooLong — createThreadRolloutLiveMirror.tick runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.17× 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: rollout-live-mirror.bootstrapFromExistingRollout phodex-bridge/src/rollout-live-mirror.js:435 — FunctionTooLong — bootstrapFromExistingRollout runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.17× 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: bridge.mergeRelayHistoryItemsWithJsonlItems phodex-bridge/src/bridge.js:4018 — FunctionTooLong — mergeRelayHistoryItemsWithJsonlItems runs 110 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 10 over it, 1.10× 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: bridge.fetchAdaptiveThreadTurnsListForRelay phodex-bridge/src/bridge.js:2929 — FunctionTooLong — fetchAdaptiveThreadTurnsListForRelay runs 108 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 8 over it, 1.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: desktop-ipc-conversation-adapter.synchronizeDesktopConversationCompatibility phodex-bridge/src/desktop-ipc-conversation-adapter.js:619 — FunctionTooLong — synchronizeDesktopConversationCompatibility runs 107 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 7 over it, 1.07× 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: secure-transport.createBridgeSecureTransport.handleClientHello REDACTED:139 — FunctionTooLong — createBridgeSecureTransport.handleClientHello runs 105 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 5 over it, 1.05× 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: push-notification-service-client.createPushNotificationServiceClient phodex-bridge/src/push-notification-service-client.js:11 — FunctionTooLong — createPushNotificationServiceClient 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.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×20
  • Duplicated block (11 lines × 2) CodexMobile/CodexMobile/ContentView.swift:1923 — CodexMobile/CodexMobile/ContentView.swift:1923-1933 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:202-212 — 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 `CodexMobile/CodexMobile/ContentView.swift:1923` 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, `CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:199` calls `lineLimit`, `minimumScaleFactor` and `CodexMobile/CodexMobile/ContentView.swift:1922` 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) CodexMobile/CodexMobile/Models/CodexCollaboration.swift:367 — CodexMobile/CodexMobile/Models/CodexCollaboration.swift:367-377 | CodexMobile/CodexMobile/Models/CodexThread.swift:736-746 — 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. 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) CodexMobile/CodexMobile/Services/CodexService+History.swift:3329 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3329-3339 | CodexMobile/CodexMobile/Views/Turn/Messages/UserAttachmentViews.swift:108-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 (11 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4370 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4370-4380 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3185-3195 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:4370` 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) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2897 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2897-2907 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2914-2924 — 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 `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2897` 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 (11 lines × 2) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:686 — CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:686-696 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:703-713 — 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 `CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:686` 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) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2529 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2529-2539 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2592-2602 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2529` 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 lines × 2) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:244 — CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:244-254 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1265-1275 — 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 `CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:244` 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) CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift:199 — CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift:199-209 | CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift:212-222 — 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 after the matched lines, `CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift:223` calls `preferredColorScheme` and `CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift:210` 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 (11 lines × 2) CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:94 — CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:94-104 | CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:191-201 — 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 `CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:94` 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) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:547 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:547-557 | CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:575-585 — 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) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:216 — CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:216-226 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:410-420 — 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 `CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:216` 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) REDACTED:3152 — REDACTED:3152-3162 | REDACTED:3194-3204 — 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 `REDACTED:3152` 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 lines × 2) CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:140 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:140-150 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:420-430 — 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. 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) CodexMobile/CodexMobile/Views/Turn/Git/TurnWorktreeHandoffOverlay.swift:140 — CodexMobile/CodexMobile/Views/Turn/Git/TurnWorktreeHandoffOverlay.swift:140-150 | CodexMobile/CodexMobile/Views/Turn/Git/TurnWorktreeHandoffOverlay.swift:167-177 — 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 `CodexMobile/CodexMobile/Views/Turn/Git/TurnWorktreeHandoffOverlay.swift:140` 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, `CodexMobile/CodexMobile/Views/Turn/Git/TurnWorktreeHandoffOverlay.swift:139` calls `focused` and `CodexMobile/CodexMobile/Views/Turn/Git/TurnWorktreeHandoffOverlay.swift:166` 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 (11 lines × 2) CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:114 — CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:114-124 | CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:154-164 — 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 `CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:114` 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 after the matched lines, `CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:125` calls `inlineCodeRanges` and `CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:165` 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 (11 lines × 2) CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:68 — CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:68-78 | CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:98-108 — 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 `CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:68` 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) CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:768 — CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:768-778 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:794-804 — 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 `CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:768` 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) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift:57 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift:57-67 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:353-363 — 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 `CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift:57` 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) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:240 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:240-250 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:1137-1147 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×19
  • Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3447 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3447-3452 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3329-3334 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:3447` 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) CodexMobile/CodexMobile/Services/CodexService+History.swift:3973 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3973-3978 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:763-768 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:3973` 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 (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4291 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4291-4296 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3107-3112 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Notifications.swift:702 — CodexMobile/CodexMobile/Services/CodexService+Notifications.swift:702-707 | CodexMobile/CodexMobile/Services/CodexService+Notifications.swift:717-722 — 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 (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+TurnPaginationCompatibility.swift:58 — CodexMobile/CodexMobile/Services/CodexService+TurnPaginationCompatibility.swift:58-63 | CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:79-84 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `CodexMobile/CodexMobile/Services/CodexService+TurnPaginationCompatibility.swift:55` calls `contains` and `CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:78` 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 (6 lines × 2) CodexMobile/CodexMobile/Services/GitActionsService.swift:48 — CodexMobile/CodexMobile/Services/GitActionsService.swift:48-53 | CodexMobile/CodexMobile/Services/GitActionsService.swift:66-75 — 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 `CodexMobile/CodexMobile/Services/GitActionsService.swift:48` 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 × 2) CodexMobile/CodexMobile/Services/GitActionsService.swift:218 — CodexMobile/CodexMobile/Services/GitActionsService.swift:218-223 | CodexMobile/CodexMobile/Services/GitActionsService.swift:226-231 — 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 (6 lines × 2) CodexMobile/CodexMobile/Services/GitActionsService.swift:268 — CodexMobile/CodexMobile/Services/GitActionsService.swift:268-273 | CodexMobile/CodexMobile/Services/GitActionsService.swift:290-295 — 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) CodexMobile/CodexMobile/Views/Sidebar/SidebarFloatingSettingsButton.swift:17 — CodexMobile/CodexMobile/Views/Sidebar/SidebarFloatingSettingsButton.swift:17-22 | CodexMobile/CodexMobile/Views/Sidebar/SidebarFloatingSettingsButton.swift:62-67 — 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 `CodexMobile/CodexMobile/Views/Sidebar/SidebarFloatingSettingsButton.swift:17` 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) CodexMobile/CodexMobile/Views/Sidebar/SidebarSectionHeader.swift:49 — CodexMobile/CodexMobile/Views/Sidebar/SidebarSectionHeader.swift:49-54 | CodexMobile/CodexMobile/Views/Sidebar/SidebarSectionHeader.swift:122-127 — 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 `CodexMobile/CodexMobile/Views/Sidebar/SidebarSectionHeader.swift:49` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `CodexMobile/CodexMobile/Views/Sidebar/SidebarSectionHeader.swift:56` calls `escaping` and `CodexMobile/CodexMobile/Views/Sidebar/SidebarSectionHeader.swift:129` 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 (6 lines × 2) CodexMobile/CodexMobile/Views/Terminal/TerminalConnectionHelpSheet.swift:183 — CodexMobile/CodexMobile/Views/Terminal/TerminalConnectionHelpSheet.swift:183-188 | CodexMobile/CodexMobile/Views/Terminal/TerminalConnectionHelpSheet.swift:234-239 — 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 `CodexMobile/CodexMobile/Views/Terminal/TerminalConnectionHelpSheet.swift:183` 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 (6 lines × 2) CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffRenderer.swift:42 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffRenderer.swift:42-47 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:205-210 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffRenderer.swift:48 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffRenderer.swift:48-53 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:214-219 — 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 `CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffRenderer.swift:48` 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) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:327 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:327-332 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:288-293 — 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 `CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:327` 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) CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:59 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:59-64 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:266-271 — 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.
  • Duplicated block (6 lines × 2) CodexMobile/CodexMobile/ContentView.swift:1575 — CodexMobile/CodexMobile/ContentView.swift:1575-1580 | CodexMobile/CodexMobile/Views/SidebarView.swift:808-813 — 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) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1105 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1105-1110 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1479-1484 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4472 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4472-4477 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:423-428 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:4472` 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) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3597 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3597-3602 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3629-3634 — 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, `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3594` calls `normalizedIdentifier` and `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3628` 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.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×16
  • Sync-over-async blocking CodexMobile/RemodexMenuBar/BridgeControlService.swift:42 — `run` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:255 — `fs.existsSync` in `gitInit` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:721 — `fs.rmdirSync` in `createWorktreeAtManagedPath` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:1179 — `fs.writeFileSync` in `gitCreatePullRequest` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:1202 — `fs.rmSync` in `gitCreatePullRequest` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:1704 — `fs.mkdtempSync` in `runStructuredCodexJson` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:1709 — `fs.writeFileSync` in `runStructuredCodexJson` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:1736 — `fs.rmSync` in `runStructuredCodexJson` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:1986 — `fs.writeFileSync` in `applyCopiedLocalChangesToWorktree` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:1996 — `fs.rmSync` in `applyCopiedLocalChangesToWorktree` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:2045 — `fs.existsSync` in `copyWorktreeIncludeFiles` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/git-handler.js:2199 — `fs.rmdirSync` in `removeCleanManagedWorktree` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/macos-launch-agent.js:159 — `fsImpl.existsSync` in `restartMacOSBridgeService` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/workspace-handler.js:1082 — `fs.existsSync` in `createPatchSandbox` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/workspace-handler.js:1121 — `fs.existsSync` in `createPatchBackup` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking phodex-bridge/src/workspace-handler.js:1222 — `fs.unlinkSync` in `runGitApply` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×15
  • Duplicated block (10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:893 — CodexMobile/CodexMobile/Services/CodexService+Connection.swift:893-902 | CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:805-814 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `CodexMobile/CodexMobile/Services/CodexService+Connection.swift:903` calls `contains` and `CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:815` 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 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:904 — CodexMobile/CodexMobile/Services/CodexService+Connection.swift:904-913 | CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:599-608 — 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 `CodexMobile/CodexMobile/Services/CodexService+Connection.swift:904` 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 (10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:2836 — CodexMobile/CodexMobile/Services/CodexService+History.swift:2836-2845 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6984-6994 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:2836` 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, `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6983` calls `hasPrefix` and `CodexMobile/CodexMobile/Services/CodexService+History.swift:2835` 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 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1864 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1864-1873 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1944-1953 — 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 `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1864` 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) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6561 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6561-6570 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6610-6619 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6561` 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. 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) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:874 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:874-883 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:933-942 — 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) CodexMobile/CodexMobile/Views/MyMacs/MyDevicesSettingsSheet.swift:199 — CodexMobile/CodexMobile/Views/MyMacs/MyDevicesSettingsSheet.swift:199-208 | CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:830-839 — 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 `CodexMobile/CodexMobile/Views/MyMacs/MyDevicesSettingsSheet.swift:199` 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) CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:121 — CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:121-130 | CodexMobile/CodexMobile/Views/Turn/Composer/SkillAutocompletePanel.swift:76-85 — 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 `CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:121` 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) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:471 — CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:471-480 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:529-538 — 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 `CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:471` 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) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryViews.swift:222 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryViews.swift:222-231 | CodexMobile/CodexMobile/Views/Turn/Support/TurnErrorReportCard.swift:67-76 — 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 `CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryViews.swift:222` 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) CodexMobile/CodexMobile/Views/Turn/Messages/AutoApprovalReviewRow.swift:43 — CodexMobile/CodexMobile/Views/Turn/Messages/AutoApprovalReviewRow.swift:43-52 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift:54-63 — 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 `CodexMobile/CodexMobile/Views/Turn/Messages/AutoApprovalReviewRow.swift:43` 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) CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:696 — CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:696-705 | CodexMobile/CodexMobile/Views/Turn/Git/TurnWorktreeRouting.swift:10-19 — 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) CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:14 — CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:14-23 | CodexMobile/CodexMobile/Services/GitActionsService.swift:14-23 — 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 (10 lines × 2) CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:136 — CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:136-145 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionStatusBadge.swift:86-95 — before extracting anything, compare `CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift` and `CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionStatusBadge.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 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 (10 lines × 2) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:95 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:95-104 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:149-158 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×14
  • Duplicated block (7 lines × 2) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:256 — CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:256-262 | CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:295-301 — 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 `CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:256` 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 (7 lines × 2) CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift:223 — CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift:223-229 | CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift:237-243 — 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 `CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift:223` 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) CodexMobile/CodexMobile/Services/CodexService+History.swift:3764 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3764-3770 | CodexMobile/CodexMobile/Services/CodexService+History.swift:3781-3787 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:3764` 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 (7 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1073 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1073-1079 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1169-1175 — 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 `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1073` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1080` calls `firstStringValue` and `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1176` 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) CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:157 — CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:157-163 | CodexMobile/CodexMobile/Views/Turn/Support/TurnImagePreview.swift:126-132 — 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 `CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:157` 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) CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:120 — CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:120-126 | CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:413-419 — 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 `CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:120` 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) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:517 — CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:517-523 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:131-137 — 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) CodexMobile/CodexMobile/Models/CodexMessage.swift:50 — CodexMobile/CodexMobile/Models/CodexMessage.swift:50-56 | CodexMobile/CodexMobile/Models/CodexMessageOrderCounter.swift:18-24 — 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. 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 (7 lines × 2) CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:91 — CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:91-97 | CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift:114-120 — before extracting anything, compare `CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift` and `CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 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) CodexMobile/CodexMobile/Services/CodexService+TrustedPairPresentation.swift:44 — CodexMobile/CodexMobile/Services/CodexService+TrustedPairPresentation.swift:44-51 | CodexMobile/CodexMobile/Views/MyMacs/MyDevicesPresentation.swift:208-214 — 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) CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:707 — CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:707-713 | CodexMobile/CodexMobile/Views/Turn/Git/TurnWorktreeRouting.swift:21-27 — 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) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:548 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:548-554 | CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:303-309 — 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) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:490 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:490-496 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:1253-1259 — 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) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:865 — CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:865-871 | CodexMobile/CodexMobile/Services/CodexService+Status.swift:98-105 — 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.
D3 · God Classes · ClassTooLong · ×13
  • ClassTooLong: TurnViewModel REDACTED:164 — ClassTooLong — 2328 significant lines (blank, comment-only and punctuation-only lines excluded), 159 methods. The bar is 400 significant lines; this is 1928 over it, 5.82× 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: ContentView CodexMobile/CodexMobile/ContentView.swift:45 — ClassTooLong — 1408 significant lines (blank, comment-only and punctuation-only lines excluded), 79 methods. The bar is 400 significant lines; this is 1008 over it, 3.52× 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: TurnView CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:18 — ClassTooLong — 1285 significant lines (blank, comment-only and punctuation-only lines excluded), 47 methods. The bar is 400 significant lines; this is 885 over it, 3.21× 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: GhosttyTerminalView CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift:288 — ClassTooLong — 1023 significant lines (blank, comment-only and punctuation-only lines excluded), 89 methods. The bar is 400 significant lines; this is 623 over it, 2.56× 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: TurnTimelineReducer CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:13 — ClassTooLong — 877 significant lines (blank, comment-only and punctuation-only lines excluded), 58 methods. The bar is 400 significant lines; this is 477 over it, 2.19× 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: NewChatDraftView CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:59 — ClassTooLong — 845 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 445 over it, 2.11× 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: TurnTimelineView CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:29 — ClassTooLong — 835 significant lines (blank, comment-only and punctuation-only lines excluded), 65 methods. The bar is 400 significant lines; this is 435 over it, 2.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: TurnTimelineRenderProjection CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:151 — ClassTooLong — 732 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods. The bar is 400 significant lines; this is 332 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MacSwitchInterruptTimeout CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:326 — ClassTooLong — 654 significant lines (blank, comment-only and punctuation-only lines excluded), 0 methods. The bar is 400 significant lines; this is 254 over it, 1.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CodexService CodexMobile/CodexMobile/Services/CodexService.swift:422 — ClassTooLong — 567 significant lines (blank, comment-only and punctuation-only lines excluded), 1344 methods. The bar is 400 significant lines; this is 167 over it, 1.42× 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: SidebarView CodexMobile/CodexMobile/Views/SidebarView.swift:29 — ClassTooLong — 515 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 115 over it, 1.29× 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: TerminalScreen CodexMobile/CodexMobile/Views/Terminal/TerminalScreen.swift:11 — ClassTooLong — 495 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 95 over it, 1.24× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CodexDesktopRefresher phodex-bridge/src/codex-desktop-refresher.js:26 — ClassTooLong — 467 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods. The bar is 400 significant lines; this is 67 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.
D3 · God Classes · TooManyMethods · ×10
  • TooManyMethods: CodexService CodexMobile/CodexMobile/Services/CodexService.swift:422 — TooManyMethods — 1344 methods, declared across 38 files: Services/CodexService+Messages.swift (204), Services/CodexService+History.swift (133), Services/CodexService+ThreadsTurns.swift (129), Services/CodexService+Incoming.swift (124), +34 more file(s). The bar is 30 methods; this is 1314 over it, 44.80× 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: TurnViewModel REDACTED:164 — 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: GhosttyTerminalView CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift:288 — TooManyMethods — 89 methods. The bar is 30 methods; this is 59 over it, 2.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.
  • TooManyMethods: ContentView CodexMobile/CodexMobile/ContentView.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: TurnTimelineView CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:29 — TooManyMethods — 65 methods, declared across 2 files: Timeline/TurnTimelineView.swift (49), Timeline/TurnTimelineBlockAccessories.swift (16). The bar is 30 methods; this is 35 over it, 2.17× 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: TurnView CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:18 — TooManyMethods — 47 methods. The bar is 30 methods; this is 17 over it, 1.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: ContentViewModel CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:11 — 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: TerminalScreen CodexMobile/CodexMobile/Views/Terminal/TerminalScreen.swift:11 — 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: BridgeControlService CodexMobile/RemodexMenuBar/BridgeControlService.swift:96 — 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: CodexDesktopRefresher phodex-bridge/src/codex-desktop-refresher.js:26 — 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.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×10
  • Duplicated block (17 lines × 2) CodexMobile/CodexMobile/ContentView.swift:2210 — CodexMobile/CodexMobile/ContentView.swift:2210-2226 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewSupportViews.swift:11-27 — 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 `CodexMobile/CodexMobile/ContentView.swift:2210` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `CodexMobile/CodexMobile/ContentView.swift:2227` calls `navigationTitle`, `navigationBarTitleDisplayMode` and `CodexMobile/CodexMobile/Views/Turn/Core/TurnViewSupportViews.swift:28` 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 (17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4252 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4252-4268 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3068-3084 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:4252` 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 (17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2304 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2304-2320 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2384-2400 — 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 `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2304` 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. 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 (17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:242 — CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:242-258 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:259-275 — 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 `CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:242` 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 (17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3805 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3805-3821 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6686-6702 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3805` 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. 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 (17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4220 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4220-4236 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4322-4338 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4220` 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 (17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4303 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4303-4319 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4397-4413 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4303` 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 (17 lines × 2) CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:147 — CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:147-163 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionStatusBadge.swift:97-113 — before extracting anything, compare `CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift` and `CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionStatusBadge.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 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 (17 lines × 2) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1251 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1251-1267 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1765-1781 — 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 (17 lines × 2) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:432 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:432-448 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:507-523 — 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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×10
  • Duplicated block (12 lines × 2) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:142 — CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:142-153 | CodexMobile/CodexMobile/Views/Sidebar/SidebarActionPill.swift:72-83 — 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 `CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:142` 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) CodexMobile/CodexMobile/Services/CodexService+History.swift:3548 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3548-3559 | CodexMobile/CodexMobile/Services/CodexService+History.swift:3566-3577 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:3548` 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 (12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3818 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3818-3829 | CodexMobile/CodexMobile/Services/CodexService+History.swift:3838-3849 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:3818` 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) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4883 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4883-4894 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4932-4943 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4883` 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 (12 lines × 2) CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:715 — CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:715-726 | CodexMobile/CodexMobile/Views/Turn/Git/TurnWorktreeRouting.swift:30-41 — 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) CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:330 — CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:330-341 | CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:540-551 — 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 `CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:330` 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) CodexMobile/CodexMobile/Views/Turn/Composer/ComposerRuntimeSliderOverlay.swift:436 — CodexMobile/CodexMobile/Views/Turn/Composer/ComposerRuntimeSliderOverlay.swift:436-447 | CodexMobile/CodexMobile/Views/Turn/Composer/ComposerRuntimeSliderOverlay.swift:449-460 — 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 (12 lines × 2) CodexMobile/CodexMobile/Views/Turn/Composer/TurnMentionChips.swift:674 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnMentionChips.swift:674-685 | CodexMobile/CodexMobile/Views/Turn/Messages/UserMessageBubble.swift:581-592 — 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 `CodexMobile/CodexMobile/Views/Turn/Composer/TurnMentionChips.swift:674` 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) CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:652 — CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:652-663 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:932-943 — 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 `CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:652` 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 (12 lines × 2) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:709 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:709-720 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:896-907 — 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.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×10
  • Duplicated block (9 lines × 2) CodexMobile/CodexMobile/Models/AppFont.swift:87 — CodexMobile/CodexMobile/Models/AppFont.swift:87-95 | CodexMobile/CodexMobile/Models/AppFont.swift:198-206 — 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 `CodexMobile/CodexMobile/Models/AppFont.swift:87` 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 (9 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:2146 — CodexMobile/CodexMobile/Services/CodexService+History.swift:2146-2154 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:837-845 — 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 (9 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:2388 — CodexMobile/CodexMobile/Services/CodexService+History.swift:2388-2396 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2570-2578 — 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. 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 (9 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2581 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2581-2589 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2599-2607 — 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) CodexMobile/CodexMobile/Views/Shared/CodexWorktreeIcon.swift:39 — CodexMobile/CodexMobile/Views/Shared/CodexWorktreeIcon.swift:39-47 | CodexMobile/CodexMobile/Views/Shared/RemodexIcon.swift:195-203 — 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 `CodexMobile/CodexMobile/Views/Shared/CodexWorktreeIcon.swift:39` 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 (9 lines × 2) REDACTED:3314 — REDACTED:3314-3322 | REDACTED:3330-3338 — 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 `REDACTED:3314` 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) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:414 — CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:414-422 | CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:429-437 — 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 `CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:414` 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 (9 lines × 2) CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:589 — CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:589-597 | CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:638-646 — 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 `CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:589` 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) CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:747 — CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:747-755 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1306-1314 — 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 (9 lines × 2) CodexMobile/CodexMobile/Models/GitActionModels.swift:177 — CodexMobile/CodexMobile/Models/GitActionModels.swift:177-185 | CodexMobile/CodexMobile/Models/GitActionModels.swift:357-365 — 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 `CodexMobile/CodexMobile/Models/GitActionModels.swift:177` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×10
  • Duplicated block (8 lines × 2) CodexMobile/CodexMobile/Models/GitActionModels.swift:263 — CodexMobile/CodexMobile/Models/GitActionModels.swift:263-270 | CodexMobile/CodexMobile/Models/GitActionModels.swift:277-284 — 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) CodexMobile/CodexMobile/Services/CodexService+History.swift:4138 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4138-4145 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:158-165 — 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) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2205 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2205-2212 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2215-2222 — 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 `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2205` 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. 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 `forKey` to `"file_path"` in one and `"pattern"` 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 (8 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:360 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:360-367 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2075-2082 — 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) CodexMobile/CodexMobile/Views/AboutRemodexView.swift:361 — CodexMobile/CodexMobile/Views/AboutRemodexView.swift:361-368 | CodexMobile/CodexMobile/Views/Onboarding/OnboardingFeaturesPage.swift:70-77 — 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) CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:89 — CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:89-96 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:139-146 — 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 `CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:89` 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 × 2) CodexMobile/CodexMobile/Views/Turn/Core/TurnToolbarContent.swift:367 — CodexMobile/CodexMobile/Views/Turn/Core/TurnToolbarContent.swift:367-374 | CodexMobile/CodexMobile/Views/Turn/Git/TurnGitActionsToolbar.swift:194-201 — 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 `CodexMobile/CodexMobile/Views/Turn/Core/TurnToolbarContent.swift:367` 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 (8 lines × 2) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:333 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:333-342 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:294-301 — 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 `CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:333` 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 (8 lines × 2) CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:188 — CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:188-195 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:268-275 — 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) CodexMobile/CodexMobile/Services/CodexService+History.swift:4422 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4422-4433 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:365-372 — 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.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×8
  • Duplicated block (16 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3987 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3987-4002 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2821-2836 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:3987` 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 (16 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4317 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4317-4332 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3133-3148 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:4317` 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 (16 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4336 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4336-4351 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3152-3167 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:4336` 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 (16 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:379 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:379-394 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:462-477 — 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.
  • Duplicated block (16 lines × 2) CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:479 — CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:479-494 | CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:558-573 — 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 `CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:479` 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 lines × 2) CodexMobile/CodexMobile/Views/Terminal/TerminalConnectionHelpSheet.swift:353 — CodexMobile/CodexMobile/Views/Terminal/TerminalConnectionHelpSheet.swift:353-368 | CodexMobile/CodexMobile/Views/Terminal/TerminalConnectionHelpSheet.swift:370-385 — 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 `CodexMobile/CodexMobile/Views/Terminal/TerminalConnectionHelpSheet.swift:353` 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 lines × 2) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:503 — CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:503-518 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:555-570 — 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 `CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:503` 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 before the matched lines, `CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:500` calls `Array`, `Set`, `sorted` and `CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:553` 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 (16 lines × 2) CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:398 — CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:398-413 | CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:1295-1310 — 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 `CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:398` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×8
  • Duplicated block (5 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3516 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3516-3520 | CodexMobile/CodexMobile/Services/CodexService+History.swift:3523-3527 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:3516` 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 (5 lines × 2) CodexMobile/CodexMobile/Services/GitActionsService.swift:133 — CodexMobile/CodexMobile/Services/GitActionsService.swift:133-137 | CodexMobile/CodexMobile/Services/GitActionsService.swift:142-146 — 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) CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:387 — CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:387-391 | CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:405-409 — 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 `CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:387` 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 `spacing` to `3` in one and `2` 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 (5 lines × 2) CodexMobile/CodexMobile/Models/CodexCollaboration.swift:246 — CodexMobile/CodexMobile/Models/CodexCollaboration.swift:246-250 | REDACTED:3602-3606 — 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) CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:85 — CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:85-89 | CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift:107-111 — before extracting anything, compare `CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift` and `CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 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 (5 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:506 — CodexMobile/CodexMobile/Services/CodexService+History.swift:506-510 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3797-3801 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:506` 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) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2691 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2691-2695 | CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift:266-270 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `paramsObject` to `IncomingParamsObject?` in one and `IncomingParamsObject` 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 (5 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3609 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3609-3613 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3637-3641 — 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 · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×7
  • Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:51 — CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:51-77 | CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:57-78 | CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift:68-88 | CodexMobile/CodexMobile/Services/CodexThreadListPersistence.swift:54-74 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. 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. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+History.swift:4073 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4073-4157 | CodexMobile/CodexMobile/Services/CodexService+History.swift:4241-4268 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3057-3084 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:149-182 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. 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. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1734 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1734-1781 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1855-1899 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1925-1985 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1987-2123 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. 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. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:359 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:359-515 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:519-563 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1745-1920 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2073-2256 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. 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. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:44 — CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:44-74 | CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:110-133 | CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:135-156 | CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:159-177 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. 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. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:45 — CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:45-139 | CodexMobile/CodexMobile/Views/Turn/Composer/SkillAutocompletePanel.swift:24-94 | CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:55-111 | CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:173-201 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. 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. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:22 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:22-39 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:41-58 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:60-77 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:79-96 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. 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. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×7
  • Duplicated block (13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:899 — CodexMobile/CodexMobile/Services/CodexService+Connection.swift:899-911 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3151-3163 — 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 `CodexMobile/CodexMobile/Services/CodexService+Connection.swift:899` 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 (13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:533 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:533-545 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:569-581 — 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 `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:533` 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 (13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2768 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2768-2780 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2790-2803 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2768` 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 (13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3372 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3372-3384 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3581-3593 — 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 (13 lines × 2) CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:79 — CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:79-91 | CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:115-127 — 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 `CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:79` 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 (13 lines × 2) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift:92 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift:92-104 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:296-308 — 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 `CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift:92` 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 (13 lines × 2) CodexMobile/CodexMobile/Views/Payments/RevenueCatPaywallView.swift:493 — CodexMobile/CodexMobile/Views/Payments/RevenueCatPaywallView.swift:493-505 | CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:453-465 — 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.
D35 · Change Coupling · Change coupling · ×6
  • Change coupling: GitActionModels.swift ↔ git-handler.js CodexMobile/CodexMobile/Models/GitActionModels.swift:1 — `CodexMobile/CodexMobile/Models/GitActionModels.swift` and `phodex-bridge/src/git-handler.js` change together 80% of the time (8 of the 10 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `b00dc3d6` Keep Git actions visible for repo-bound root chats; `9ea2c2b4` Add live progress and success to git actions; `38f2fa6a` Add stacked git publish actions and progress toast — run `git show` on any of them.
  • Change coupling: CodexService.swift ↔ REDACTED CodexMobile/CodexMobile/Services/CodexService.swift:1 — `CodexMobile/CodexMobile/Services/CodexService.swift` and `REDACTED` change together 70% of the time (7 of the 10 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `14a82574` Stabilize replayed activity and widget state; `06601968` perf: improve bridge memory and low-network efficiency; `afb8a2d5` Pairing and bridge service fixes — run `git show` on any of them.
  • Change coupling: desktop-ipc-action-follower.js ↔ desktop-ipc-live-owner.js phodex-bridge/src/desktop-ipc-action-follower.js:1 — `phodex-bridge/src/desktop-ipc-action-follower.js` and `phodex-bridge/src/desktop-ipc-live-owner.js` change together 64% of the time (25 of the 39 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) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 25 shared commits counted here, the most recent 3 are `2e612b44` Align mobile continuation routing with v3.2 desktop IPC; `c85e65c9` Improve local runtime and timeline handling; `fb4ee01a` Improve local relay recovery and thread state reconciliation — run `git show` on any of them.
  • Change coupling: CodexService+Messages.swift ↔ rollout-live-mirror.js CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1 — `CodexMobile/CodexMobile/Services/CodexService+Messages.swift` and `phodex-bridge/src/rollout-live-mirror.js` change together 50% of the time (9 of the 18 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `c85e65c9` Improve local runtime and timeline handling; `7692ebff` Improve thread loading, timeline grouping, and relay recovery; `fb4ee01a` Improve local relay recovery and thread state reconciliation — run `git show` on any of them.
  • Change coupling: REDACTED ↔ git-handler.js REDACTED:1 — `REDACTED` and `phodex-bridge/src/git-handler.js` change together 50% of the time (8 of the 16 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) and are written in DIFFERENT LANGUAGES, so no import can join them and they cannot be co-located into one unit — they compile and ship as separate artifacts. What binds them is a CONTRACT across that boundary — an event or message name, a route, a serialised shape — that each side currently spells out on its own, which is exactly why a change to one drags the other. Declare that contract once where both sides read it (a shared schema, a generated constants file, an interface-definition file) so a change on one side fails the other's build instead of drifting silently; where the surface is too small to be worth that, name the counterpart in a comment on both sides so the next reader finds it. There is nothing here to merge. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `b00dc3d6` Keep Git actions visible for repo-bound root chats; `9ea2c2b4` Add live progress and success to git actions (at that commit the file was still `CodexMobile/CodexMobile/Views/Turn/TurnViewModel.swift`); `38f2fa6a` Add stacked git publish actions and progress toast (at that commit the file was still `CodexMobile/CodexMobile/Views/Turn/TurnViewModel.swift`) — run `git show` on any of them.
  • Change coupling: NewChatDraftView.swift ↔ TurnView.swift CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1 — `CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift` and `CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift` change together 50% of the time (5 of the 10 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 the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `1a5b0eb5` Harden bridge and mobile runtime error handling (#162); `c987076f` Add native Codex thread goal support (/goal); `b00dc3d6` Keep Git actions visible for repo-bound root chats — run `git show` on any of them.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×6
  • Duplicated block (14 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3373 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3373-3386 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2783-2796 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:3373` 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 (14 lines × 2) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:450 — CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:450-463 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:670-683 — 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 `CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:450` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `paramsObject` to `IncomingParamsObject` in one and `IncomingParamsObject?` 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 (14 lines × 2) CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:94 — CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:94-107 | CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:487-500 — 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 `CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:94` 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 (14 lines × 2) REDACTED:2260 — REDACTED:2260-2273 | REDACTED:2548-2561 — 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.
  • Duplicated block (14 lines × 2) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelinePlaceholderViews.swift:10 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelinePlaceholderViews.swift:10-23 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelinePlaceholderViews.swift:28-41 — 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 `CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelinePlaceholderViews.swift:10` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelinePlaceholderViews.swift:42` calls `frame`, `background`, `Color` and `CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelinePlaceholderViews.swift:24` 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 (14 lines × 2) CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:165 — CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:165-178 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:245-258 — 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×6
  • Low cohesion: CodexService (LCOM4 8) CodexMobile/CodexMobile/Services/CodexService.swift:422 — CodexService'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: TurnViewModel (LCOM4 5) phodex-bridge/test/fixtures/stream-recovery-harness.swift:11 — TurnViewModel'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: GhosttyTerminalView (LCOM4 4) CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift:288 — GhosttyTerminalView'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: Coordinator (LCOM4 4) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift:162 — Coordinator'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: TurnComposerPasteInterceptingTextView (LCOM4 4) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift:565 — TurnComposerPasteInterceptingTextView'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: TurnViewModel (LCOM4 4) REDACTED:164 — TurnViewModel's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×5
  • Duplicated block (18 lines × 2) CodexMobile/CodexMobile/ContentView.swift:772 — CodexMobile/CodexMobile/ContentView.swift:772-789 | CodexMobile/CodexMobile/ContentView.swift:843-860 — 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 `CodexMobile/CodexMobile/ContentView.swift:772` 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 (18 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4271 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4271-4288 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3087-3104 — 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. 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 (18 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1399 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1399-1416 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1458-1475 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1399` 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 (18 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:274 — CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:274-291 | CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:313-330 — 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 `CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.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. 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) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:427 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:427-444 | CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:203-220 — 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 `CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:427` 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.
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×5
  • Duplicated block (15 lines × 2 locations) phodex-bridge/src/bridge.js:4891 — phodex-bridge/src/bridge.js:4891 · phodex-bridge/src/session-jsonl-history.js:1055 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (15 lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js:1140 — phodex-bridge/src/desktop-ipc-action-follower.js:1140 · phodex-bridge/src/desktop-ipc-action-follower.js:1175 — 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 (15 lines × 2 locations) phodex-bridge/src/git-handler.js:2751 — phodex-bridge/src/git-handler.js:2751 · phodex-bridge/src/git-handler.js:2777 — 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 (15 lines × 2 locations) phodex-bridge/src/rollout-live-mirror.js:2247 — phodex-bridge/src/rollout-live-mirror.js:2247 · phodex-bridge/src/rollout-watch.js:772 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
  • Duplicated block (15 lines × 2 locations) phodex-bridge/src/rollout-watch.js:320 — phodex-bridge/src/rollout-watch.js:320 · phodex-bridge/src/rollout-watch.js:389 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R4 · Test Coverage · No test reaches this file · ×5
  • No test reaches this file relay/phodex-backend-relay.mjs:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file phodex-bridge/src/bootstrap-codex-cli.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file phodex-bridge/scripts/prepare-private-defaults.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file phodex-bridge/scripts/cleanup-private-defaults.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file phodex-bridge/bin/phodex.js:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D35 · Change Coupling · Change-coupling hub · ×4
  • Change-coupling hub: CodexService+IncomingAssistant.swift → CodexService+History.swift, CodexService+Incoming.swift, CodexService+Messages.swift, bridge.js CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift — `CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift` changes together with 4 other files — `CodexMobile/CodexMobile/Services/CodexService+History.swift`, `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift`, `CodexMobile/CodexMobile/Services/CodexService+Messages.swift`, `phodex-bridge/src/bridge.js` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: TurnTimelineView.swift → TurnComposerInputTextView.swift, TurnMarkdownTextRendering.swift, TurnMessageComponents.swift CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift — `CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift` changes together with 3 other files — `CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift`, `CodexMobile/CodexMobile/Views/Turn/Messages/TurnMarkdownTextRendering.swift`, `CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
  • Change-coupling hub: CodexService+Connection.swift → CodexService+SecureTransport.swift, CodexService+Transport.swift, ContentViewModel.swift, REDACTED CodexMobile/CodexMobile/Services/CodexService+Connection.swift — `CodexMobile/CodexMobile/Services/CodexService+Connection.swift` changes together with 4 other files — `CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift`, `CodexMobile/CodexMobile/Services/CodexService+Transport.swift`, `CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift`, `REDACTED` — none of which declares a dependency on it: one file is the hub of 4 separate couplings, not 4 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 4.
  • Change-coupling hub: CodexService+SecureTransport.swift → ContentViewModel.swift, bridge.js, REDACTED CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift — `CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift` changes together with 3 other files — `CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift`, `phodex-bridge/src/bridge.js`, `REDACTED` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×4
  • Duplicated block (15 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:746 — CodexMobile/CodexMobile/Services/CodexService+History.swift:746-760 | CodexMobile/CodexMobile/Services/CodexService+History.swift:905-919 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:746` 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4208 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4208-4222 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3025-3039 — 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 (15 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4354 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4354-4368 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3170-3184 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:4354` 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 (15 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3095 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3095-3109 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3116-3130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×4
  • Duplicated block (14 lines × 3) CodexMobile/CodexMobile/Services/CodexService+Account.swift:826 — CodexMobile/CodexMobile/Services/CodexService+Account.swift:826-839 | CodexMobile/CodexMobile/Services/CodexService+ThreadForkCompatibility.swift:21-34 | CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:65-78 — 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 all 3 call sites, so a change lands once.
  • Duplicated block (14 lines × 3) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1407 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1407-1420 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1430-1443 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1466-1479 — 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.
  • Duplicated block (14 lines × 3) CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:651 — CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:651-665 | CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:671-685 | CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:700-713 — 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 `CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:651` 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 after the matched lines, `CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:688` calls `preferredColorScheme` and `CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:668` 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 (14 lines × 3) CodexMobile/CodexMobile/Views/Turn/Composer/QueuedDraftsPanel.swift:66 — CodexMobile/CodexMobile/Views/Turn/Composer/QueuedDraftsPanel.swift:66-79 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:401-414 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:532-545 — 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 `CodexMobile/CodexMobile/Views/Turn/Composer/QueuedDraftsPanel.swift:66` 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.
R10 · Code Duplication · Duplicated block (14 lines × 2 locations) · ×4
  • Duplicated block (14 lines × 2 locations) phodex-bridge/src/codex-transport.js:51 — phodex-bridge/src/codex-transport.js:51 · phodex-bridge/src/codex-transport.js:333 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (14 lines × 2 locations) phodex-bridge/src/desktop-ipc-conversation-adapter.js:282 — phodex-bridge/src/desktop-ipc-conversation-adapter.js:282 · phodex-bridge/src/desktop-ipc-conversation-adapter.js:414 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (14 lines × 2 locations) phodex-bridge/src/desktop-ipc-conversation-projector.js:705 — phodex-bridge/src/desktop-ipc-conversation-projector.js:705 · phodex-bridge/src/desktop-ipc-conversation-projector.js: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 (14 lines × 2 locations) REDACTED:682 — REDACTED:682 · REDACTED:708 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×4
  • Duplicated block (13 lines × 2 locations) phodex-bridge/src/project-handler.js:544 — phodex-bridge/src/project-handler.js:544 · phodex-bridge/src/project-handler.js:567 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (13 lines × 2 locations) phodex-bridge/src/workspace-handler.js:699 — phodex-bridge/src/workspace-handler.js:699 · phodex-bridge/src/workspace-handler.js:781 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (13 lines × 2 locations) phodex-bridge/src/workspace-handler.js:727 — phodex-bridge/src/workspace-handler.js:727 · phodex-bridge/src/workspace-handler.js:811 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (13 lines × 2 locations) relay/apns-client.js:185 — relay/apns-client.js:185 · relay/push-service.js:407 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×4
  • Swallowed exception (caught, then discarded) phodex-bridge/src/git-handler.js:2140 — `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) phodex-bridge/src/project-handler.js:377 — `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) phodex-bridge/src/session-jsonl-history.js:372 — `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) phodex-bridge/src/session-jsonl-history.js:445 — `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.
D10 · Test Quality · No assertions · ×3
  • No assertions: testFollowBottomDropsDelayedCorrectionRepairedByNativeAnchor CodexMobile/CodexMobileTests/TurnTimelineReducerTests.swift:7252 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testFollowBottomDropsQueuedRetryAfterReachingBottom CodexMobile/CodexMobileTests/TurnTimelineReducerTests.swift:7297 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testCancellingFollowBottomClearsQueuedRetry CodexMobile/CodexMobileTests/TurnTimelineReducerTests.swift:7320 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×3
  • Duplicated block (11–12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1302 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1302-1313 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1350-1360 — 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, `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1348` calls `extractIncomingItemObject` and `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1300` 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–12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1580 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1580-1590 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1610-1621 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1580` 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–12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4198 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4198-4209 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4394-4404 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4198` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×3
  • Duplicated block (8–9 lines × 2) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:824 — CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:824-832 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3264-3271 — 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 `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3264` 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 (8–9 lines × 2) CodexMobile/CodexMobile/Views/Onboarding/OnboardingWelcomePage.swift:34 — CodexMobile/CodexMobile/Views/Onboarding/OnboardingWelcomePage.swift:34-42 | CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:85-92 — 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 `CodexMobile/CodexMobile/Views/Onboarding/OnboardingWelcomePage.swift:34` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `24` in one and `20` 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 (8–9 lines × 2) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:273 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:273-281 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:149-156 — 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 `CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:273` 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.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×3
  • Duplicated block (6 lines × 3) CodexMobile/CodexMobile/Services/CodexService+History.swift:4242 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4242-4247 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3058-3063 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:153-158 — 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 all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `CodexMobile/CodexMobile/Services/CodexService+History.swift:4242` 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 × 3) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1859 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1859-1866 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1934-1939 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1998-2003 — 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 `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1859` 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.
  • Duplicated block (6 lines × 3) CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:134 — CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:134-139 | CodexMobile/CodexMobile/Views/Turn/Composer/SkillAutocompletePanel.swift:89-94 | CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:48-53 — 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 all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:134` 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.
R10 · Code Duplication · Duplicated block (16 lines × 2 locations) · ×3
  • Duplicated block (16 lines × 2 locations) phodex-bridge/src/macos-launch-agent.js:83 — phodex-bridge/src/macos-launch-agent.js:83 · phodex-bridge/src/macos-launch-agent.js:140 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (16 lines × 2 locations) phodex-bridge/src/rollout-live-mirror.js:1993 — phodex-bridge/src/rollout-live-mirror.js:1993 · phodex-bridge/src/session-jsonl-history.js:1126 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (16 lines × 2 locations) phodex-bridge/src/session-jsonl-history.js:303 — phodex-bridge/src/session-jsonl-history.js:303 · phodex-bridge/src/session-jsonl-history.js:351 — 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.
R10 · Code Duplication · Duplicated block with local edits (13 matched lines × 2 locations) · ×3
  • Duplicated block with local edits (13 matched lines × 2 locations) phodex-bridge/src/account-status.js:135 — phodex-bridge/src/account-status.js:135 · REDACTED:498 — the two spans are one implementation copied and then locally edited — 56 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (13 matched lines × 2 locations) REDACTED:488 — REDACTED:488 · phodex-bridge/src/rollout-live-mirror.js:2264 — the two spans are one implementation copied and then locally edited — 54 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
  • Duplicated block with local edits (13 matched lines × 2 locations) phodex-bridge/src/desktop-ipc-conversation-adapter.js:117 — phodex-bridge/src/desktop-ipc-conversation-adapter.js:117 · phodex-bridge/src/desktop-ipc-live-owner.js:1895 — the two spans are one implementation copied and then locally edited — 79 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×2
  • Duplicated block (28 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3929 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3929-3956 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:550-577 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:3929` 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 (28 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1316 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1316-1343 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1398-1425 — 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 `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1316` 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 · Duplicated block (26 lines × 2) · ×2
  • Duplicated block (26 lines × 2) CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:525 — CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:525-550 | CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:625-650 — 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 `CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:525` 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 (26 lines × 2) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:675 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:675-700 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:752-777 — 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 `CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:675` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×2
  • Duplicated block (20 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4370 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4370-4389 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4425-4444 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4370` 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 (20 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1075 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1075-1094 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2805-2824 — 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 `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1075` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:34 — CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:34-52 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionStatusBadge.swift:41-59 — before extracting anything, compare `CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift` and `CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionStatusBadge.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 54 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 (19 lines × 2) CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:666 — CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:666-684 | CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:695-713 — 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 `CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:666` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×2
  • Duplicated block (17–18 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3785 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3785-3802 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6639-6655 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3785` 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. 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 (17–18 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadFork.swift:47 — CodexMobile/CodexMobile/Services/CodexService+ThreadFork.swift:47-63 | CodexMobile/CodexMobile/Services/CodexService+ThreadFork.swift:69-86 — 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 `CodexMobile/CodexMobile/Services/CodexService+ThreadFork.swift:47` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×2
  • Duplicated block (12–13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:165 — CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:165-176 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1266-1278 — 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 `CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:165` 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 × 2) CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift:84 — CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift:84-95 | CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift:108-120 — 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 `CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift:84` 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.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×2
  • Duplicated block (9–12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3910 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3910-3918 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:523-534 — 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. 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 (9–12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3133 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3133-3144 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:73-81 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×2
  • Duplicated block (10 lines × 4) CodexMobile/CodexMobile/Services/CodexService+RuntimeCompatibility.swift:26 — CodexMobile/CodexMobile/Services/CodexService+RuntimeCompatibility.swift:26-35 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3258-3267 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3372-3381 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3581-3590 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (10 lines × 4) CodexMobile/CodexMobile/ContentView.swift:904 — CodexMobile/CodexMobile/ContentView.swift:904-913 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewAlertModifier.swift:106-115 | CodexMobile/CodexMobile/Views/Turn/Messages/TurnMermaidRenderer.swift:249-258 | CodexMobile/CodexMobile/Views/Turn/Support/TurnImagePreview.swift:135-144 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×2
  • Duplicated block (10 lines × 3) CodexMobile/CodexMobile/Views/Turn/Composer/SkillAutocompletePanel.swift:72 — CodexMobile/CodexMobile/Views/Turn/Composer/SkillAutocompletePanel.swift:72-81 | CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:93-102 | CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:190-199 — 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 `CodexMobile/CodexMobile/Views/Turn/Composer/SkillAutocompletePanel.swift:72` 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 after the matched lines, `CodexMobile/CodexMobile/Views/Turn/Composer/SlashCommandAutocompletePanel.swift:103` calls `disabled` and `CodexMobile/CodexMobile/Views/Turn/Composer/SkillAutocompletePanel.swift:82` 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 (10 lines × 3) REDACTED:2260 — REDACTED:2260-2269 | REDACTED:2493-2502 | REDACTED:2548-2557 — 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.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×2
  • Duplicated block (9 lines × 4) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:904 — CodexMobile/CodexMobile/Services/CodexService+Connection.swift:904-912 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3102-3110 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3123-3131 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3156-3164 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `CodexMobile/CodexMobile/Services/CodexService+Connection.swift:904` 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 (9 lines × 4) CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:174 — CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:174-182 | CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:192-200 | CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:201-209 | CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:210-218 — 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 `CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:174` 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.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×2
  • Duplicated block (7–9 lines × 3) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3284 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3284-3291 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:396-402 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:466-474 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 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 3 times. 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 (7–9 lines × 3) CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:118 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:118-126 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:382-390 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:454-460 — 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 all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×2
  • Duplicated block (9 lines × 3) CodexMobile/CodexMobile/Views/MyMacs/MyDevicesSettingsSheet.swift:199 — CodexMobile/CodexMobile/Views/MyMacs/MyDevicesSettingsSheet.swift:199-207 | CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:830-838 | CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:904-912 — 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 `CodexMobile/CodexMobile/Views/MyMacs/MyDevicesSettingsSheet.swift:199` 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 × 3) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:326 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:326-334 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:345-353 | CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageRegexCache.swift:45-53 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:335` calls `fromInlineVerb` and `CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageRegexCache.swift:54` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×2
  • Duplicated block (8 lines × 4) CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:175 — CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:175-182 | CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:184-191 | CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:193-200 | CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:202-209 — 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. 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 lines × 4) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:503 — CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:503-510 | CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:512-519 | CodexMobile/RemodexMenuBar/BridgeControlService.swift:550-557 | CodexMobile/RemodexMenuBar/BridgeControlService.swift:638-645 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2369 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2369-2375 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3106-3112 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3127-3133 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3161-3167 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:852-858 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2369` 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 before the matched lines, `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3160` calls `contains` and `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3105` 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 × 5) CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:84 — CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:84-90 | CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:99-105 | CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift:150-156 | CodexMobile/CodexMobile/Services/CodexThreadListPersistence.swift:105-111 | CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:1009-1015 — before extracting anything, compare `CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift` and `CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 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.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×2
  • Duplicated block (5 lines × 3) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:331 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:331-335 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:131-135 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:292-296 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:138 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:138-142 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:914-918 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:1122-1126 — 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 all 3 call sites, so a change lands once.
R10 · Code Duplication · Duplicated block (24 lines × 2 locations) · ×2
  • Duplicated block (24 lines × 2 locations) REDACTED:434 — REDACTED:434 · REDACTED:593 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (24 lines × 2 locations) phodex-bridge/src/session-jsonl-history.js:254 — phodex-bridge/src/session-jsonl-history.js:254 · phodex-bridge/src/session-jsonl-history.js:416 — 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.
R10 · Code Duplication · Duplicated block (12 lines × 2 locations) · ×2
  • Duplicated block (12 lines × 2 locations) phodex-bridge/src/bridge.js:3775 — phodex-bridge/src/bridge.js:3775 · phodex-bridge/src/bridge.js:4002 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
  • Duplicated block (12 lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js:2759 — phodex-bridge/src/desktop-ipc-action-follower.js:2759 · phodex-bridge/src/desktop-ipc-action-follower.js:2785 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
D1 · Cyclomatic Complexity · CodexService.mergeHistoryMessages (cyclomatic 168) · ×1
  • CodexService.mergeHistoryMessages (cyclomatic 168) CodexMobile/CodexMobile/Services/CodexService+History.swift:931 — CodexService.mergeHistoryMessages has cyclomatic complexity 168 (threshold 15). Of this number, 166 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.upsertStreamingSystemItemMessage (cyclomatic 127) · ×1
  • CodexService.upsertStreamingSystemItemMessage (cyclomatic 127) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2692 — CodexService.upsertStreamingSystemItemMessage has cyclomatic complexity 127 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.loadThreadHistoryIfNeeded (cyclomatic 108) · ×1
  • CodexService.loadThreadHistoryIfNeeded (cyclomatic 108) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1271 — CodexService.loadThreadHistoryIfNeeded has cyclomatic complexity 108 (threshold 15). Of this number, 107 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState (cyclomatic 95) · ×1
  • desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState (cyclomatic 95) phodex-bridge/src/desktop-ipc-conversation-adapter.js:143 — desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState has cyclomatic complexity 95 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.reconcileExistingMessage (cyclomatic 87) · ×1
  • CodexService.reconcileExistingMessage (cyclomatic 87) CodexMobile/CodexMobile/Services/CodexService+History.swift:2008 — CodexService.reconcileExistingMessage has cyclomatic complexity 87 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.completeAssistantMessage (cyclomatic 79) · ×1
  • CodexService.completeAssistantMessage (cyclomatic 79) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4013 — CodexService.completeAssistantMessage has cyclomatic complexity 79 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · parseSessionJsonlTurns (cyclomatic 67) · ×1
  • parseSessionJsonlTurns (cyclomatic 67) phodex-bridge/src/session-jsonl-history.js:400 — parseSessionJsonlTurns has cyclomatic complexity 67 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.handleNotification (cyclomatic 66) · ×1
  • CodexService.handleNotification (cyclomatic 66) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:177 — CodexService.handleNotification has cyclomatic complexity 66 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MessageRow.assistantView (cyclomatic 62) · ×1
  • MessageRow.assistantView (cyclomatic 62) CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift:536 — MessageRow.assistantView has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnTimelineRenderProjection.renderItems (cyclomatic 62) · ×1
  • TurnTimelineRenderProjection.renderItems (cyclomatic 62) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:226 — TurnTimelineRenderProjection.renderItems has cyclomatic complexity 62 (threshold 15). Of this number, 34 points are the body's own statements and 28 belong to 7 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.observeInbound (cyclomatic 61) · ×1
  • createDesktopIpcActionFollower.observeInbound (cyclomatic 61) phodex-bridge/src/desktop-ipc-action-follower.js:507 — createDesktopIpcActionFollower.observeInbound has cyclomatic complexity 61 (threshold 15). Of this number, 52 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.markTurnCompleted (cyclomatic 60) · ×1
  • CodexService.markTurnCompleted (cyclomatic 60) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:5308 — CodexService.markTurnCompleted has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.observeInbound (cyclomatic 58) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.observeInbound (cyclomatic 58) phodex-bridge/src/desktop-ipc-action-follower.js:507 — desktop-ipc-action-follower.createDesktopIpcActionFollower.observeInbound has cyclomatic complexity 58 (threshold 15). Of this number, 49 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rollout-live-mirror.synthesizeNotificationsFromRolloutEntry (cyclomatic 56) · ×1
  • rollout-live-mirror.synthesizeNotificationsFromRolloutEntry (cyclomatic 56) phodex-bridge/src/rollout-live-mirror.js:938 — rollout-live-mirror.synthesizeNotificationsFromRolloutEntry has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · synchronizeDesktopConversationCompatibility (cyclomatic 56) · ×1
  • synchronizeDesktopConversationCompatibility (cyclomatic 56) phodex-bridge/src/desktop-ipc-conversation-adapter.js:619 — synchronizeDesktopConversationCompatibility has cyclomatic complexity 56 (threshold 15). Of this number, 55 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · opencode-runtime.createOpenCodeRuntime.handleRequest (cyclomatic 54) · ×1
  • opencode-runtime.createOpenCodeRuntime.handleRequest (cyclomatic 54) phodex-bridge/src/opencode-runtime.js:1228 — opencode-runtime.createOpenCodeRuntime.handleRequest has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createOpenCodeRuntime.handleRequest (cyclomatic 54) · ×1
  • createOpenCodeRuntime.handleRequest (cyclomatic 54) phodex-bridge/src/opencode-runtime.js:1228 — createOpenCodeRuntime.handleRequest has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.handleTurnStarted (cyclomatic 51) · ×1
  • CodexService.handleTurnStarted (cyclomatic 51) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:710 — CodexService.handleTurnStarted has cyclomatic complexity 51 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.handleStructuredItemLifecycle (cyclomatic 49) · ×1
  • CodexService.handleStructuredItemLifecycle (cyclomatic 49) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2409 — CodexService.handleStructuredItemLifecycle 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.
D1 · Cyclomatic Complexity · TurnView.body (cyclomatic 48) · ×1
  • TurnView.body (cyclomatic 48) CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:75 — TurnView.body has cyclomatic complexity 48 (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 · desktop-ipc-action-follower.createDesktopIpcActionFollower.onEnvelope (cyclomatic 47) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.onEnvelope (cyclomatic 47) phodex-bridge/src/desktop-ipc-action-follower.js:762 — desktop-ipc-action-follower.createDesktopIpcActionFollower.onEnvelope has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.onEnvelope (cyclomatic 47) · ×1
  • createDesktopIpcActionFollower.onEnvelope (cyclomatic 47) phodex-bridge/src/desktop-ipc-action-follower.js:762 — createDesktopIpcActionFollower.onEnvelope has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.ensureThreadResumed (cyclomatic 46) · ×1
  • CodexService.ensureThreadResumed (cyclomatic 46) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1369 — CodexService.ensureThreadResumed has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · buildConversationStateFromThread (cyclomatic 45) · ×1
  • buildConversationStateFromThread (cyclomatic 45) phodex-bridge/src/desktop-ipc-conversation-adapter.js:445 — buildConversationStateFromThread has cyclomatic complexity 45 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.refreshInFlightTurnState (cyclomatic 44) · ×1
  • CodexService.refreshInFlightTurnState (cyclomatic 44) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1583 — CodexService.refreshInFlightTurnState has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnComposerHostView.body (cyclomatic 44) · ×1
  • TurnComposerHostView.body (cyclomatic 44) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerHostView.swift:62 — TurnComposerHostView.body has cyclomatic complexity 44 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.refreshTouchedNormalizedActiveTurns (cyclomatic 44) · ×1
  • desktop-ipc-action-follower.refreshTouchedNormalizedActiveTurns (cyclomatic 44) phodex-bridge/src/desktop-ipc-action-follower.js:3497 — desktop-ipc-action-follower.refreshTouchedNormalizedActiveTurns has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · remodex-jsonl-diagnose.diagnoseSessionJsonl (cyclomatic 44) · ×1
  • remodex-jsonl-diagnose.diagnoseSessionJsonl (cyclomatic 44) phodex-bridge/bin/remodex-jsonl-diagnose.js:72 — remodex-jsonl-diagnose.diagnoseSessionJsonl has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · opencode-runtime.createOpenCodeRuntime.watchTurn · ×1
  • opencode-runtime.createOpenCodeRuntime.watchTurn::poll (cyclomatic 43) phodex-bridge/src/opencode-runtime.js:588 — opencode-runtime.createOpenCodeRuntime.watchTurn::poll has cyclomatic complexity 43 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · bridge.startBridge (cyclomatic 43) · ×1
  • bridge.startBridge (cyclomatic 43) phodex-bridge/src/bridge.js:714 — bridge.startBridge has cyclomatic complexity 43 (threshold 15). Of this number, 24 points are the body's own statements and 19 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · createOpenCodeRuntime.watchTurn · ×1
  • createOpenCodeRuntime.watchTurn::poll (cyclomatic 43) phodex-bridge/src/opencode-runtime.js:588 — createOpenCodeRuntime.watchTurn::poll has cyclomatic complexity 43 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.applyCanonicalHistoryOrder (cyclomatic 42) · ×1
  • CodexService.applyCanonicalHistoryOrder (cyclomatic 42) CodexMobile/CodexMobile/Services/CodexService+History.swift:1433 — CodexService.applyCanonicalHistoryOrder has cyclomatic complexity 42 (threshold 15). Of this number, 39 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnFileChangeSummaryParser.parse (cyclomatic 42) · ×1
  • TurnFileChangeSummaryParser.parse (cyclomatic 42) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:73 — TurnFileChangeSummaryParser.parse has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopIpcLiveOwner.observeOutbound (cyclomatic 42) · ×1
  • createDesktopIpcLiveOwner.observeOutbound (cyclomatic 42) phodex-bridge/src/desktop-ipc-live-owner.js:327 — createDesktopIpcLiveOwner.observeOutbound has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.decodeMessagesFromThreadRead (cyclomatic 41) · ×1
  • CodexService.decodeMessagesFromThreadRead (cyclomatic 41) CodexMobile/CodexMobile/Services/CodexService+History.swift:98 — CodexService.decodeMessagesFromThreadRead has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.repairCanonicalAssistantSourceIdentityRotations (cyclomatic 41) · ×1
  • CodexService.repairCanonicalAssistantSourceIdentityRotations (cyclomatic 41) CodexMobile/CodexMobile/Services/CodexService+History.swift:1700 — CodexService.repairCanonicalAssistantSourceIdentityRotations has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound (cyclomatic 41) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound (cyclomatic 41) phodex-bridge/src/desktop-ipc-live-owner.js:327 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.loadOlderThreadHistoryPage (cyclomatic 38) · ×1
  • CodexService.loadOlderThreadHistoryPage (cyclomatic 38) CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:221 — CodexService.loadOlderThreadHistoryPage has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bridge.mergeRelayHistoryItemsWithJsonlItems (cyclomatic 38) · ×1
  • bridge.mergeRelayHistoryItemsWithJsonlItems (cyclomatic 38) phodex-bridge/src/bridge.js:4018 — bridge.mergeRelayHistoryItemsWithJsonlItems has cyclomatic complexity 38 (threshold 15). Of this number, 28 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · backgroundHistoryTurns (cyclomatic 38) · ×1
  • backgroundHistoryTurns (cyclomatic 38) phodex-bridge/src/desktop-ipc-action-follower.js:3899 — backgroundHistoryTurns has cyclomatic complexity 38 (threshold 15). Of this number, 24 points are the body's own statements and 14 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.scheduleCanonicalHistoryReconcileIfNeeded (cyclomatic 37) · ×1
  • CodexService.scheduleCanonicalHistoryReconcileIfNeeded (cyclomatic 37) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:640 — CodexService.scheduleCanonicalHistoryReconcileIfNeeded has cyclomatic complexity 37 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.startThreadImpl (cyclomatic 37) · ×1
  • CodexService.startThreadImpl (cyclomatic 37) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:162 — CodexService.startThreadImpl has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rollout-live-mirror.bootstrapFromExistingRollout (cyclomatic 37) · ×1
  • rollout-live-mirror.bootstrapFromExistingRollout (cyclomatic 37) phodex-bridge/src/rollout-live-mirror.js:435 — rollout-live-mirror.bootstrapFromExistingRollout has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SubagentActionCard.readableStatus (cyclomatic 36) · ×1
  • SubagentActionCard.readableStatus (cyclomatic 36) CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:172 — SubagentActionCard.readableStatus has cyclomatic complexity 36 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · CodexService.interruptTurn (cyclomatic 35) · ×1
  • CodexService.interruptTurn (cyclomatic 35) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:660 — CodexService.interruptTurn has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.steerTurn (cyclomatic 35) · ×1
  • CodexService.steerTurn (cyclomatic 35) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2073 — CodexService.steerTurn has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · phodex-backend-relay.setupRelay (cyclomatic 35) · ×1
  • phodex-backend-relay.setupRelay (cyclomatic 35) relay/phodex-backend-relay.mjs:41 — phodex-backend-relay.setupRelay has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 55, 141, 159, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · projectConversationState (cyclomatic 35) · ×1
  • projectConversationState (cyclomatic 35) phodex-bridge/src/desktop-ipc-conversation-projector.js:179 — projectConversationState has cyclomatic complexity 35 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · createNormalizedLiveIndex (cyclomatic 34) · ×1
  • createNormalizedLiveIndex (cyclomatic 34) phodex-bridge/src/desktop-ipc-action-follower.js:3372 — createNormalizedLiveIndex has cyclomatic complexity 34 (threshold 15). Of this number, 30 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · opencode-runtime.createOpenCodeRuntime.processEvent (cyclomatic 33) · ×1
  • opencode-runtime.createOpenCodeRuntime.processEvent (cyclomatic 33) phodex-bridge/src/opencode-runtime.js:865 — opencode-runtime.createOpenCodeRuntime.processEvent has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · git-handler.gitRunStackedAction (cyclomatic 33) · ×1
  • git-handler.gitRunStackedAction (cyclomatic 33) phodex-bridge/src/git-handler.js:1036 — git-handler.gitRunStackedAction has cyclomatic complexity 33 (threshold 15). Of this number, 31 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · normalizeRelayBoundJsonRpcMessage (cyclomatic 33) · ×1
  • normalizeRelayBoundJsonRpcMessage (cyclomatic 33) phodex-bridge/src/bridge.js:3474 — normalizeRelayBoundJsonRpcMessage has cyclomatic complexity 33 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · createOpenCodeRuntime.processEvent (cyclomatic 33) · ×1
  • createOpenCodeRuntime.processEvent (cyclomatic 33) phodex-bridge/src/opencode-runtime.js:865 — createOpenCodeRuntime.processEvent has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AIUnifiedPatchParser.analyzeChunk (cyclomatic 32) · ×1
  • AIUnifiedPatchParser.analyzeChunk (cyclomatic 32) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:422 — AIUnifiedPatchParser.analyzeChunk has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.sendTurnStart (cyclomatic 32) · ×1
  • CodexService.sendTurnStart (cyclomatic 32) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1745 — CodexService.sendTurnStart has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · relay.setupRelay (cyclomatic 32) · ×1
  • relay.setupRelay (cyclomatic 32) relay/relay.js:63 — relay.setupRelay has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 1 of the 32 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 90, 175, 71, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · backgroundRawTurn (cyclomatic 32) · ×1
  • backgroundRawTurn (cyclomatic 32) phodex-bridge/src/desktop-ipc-action-follower.js:3971 — backgroundRawTurn has cyclomatic complexity 32 (threshold 15). Of this number, 25 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.handleTurnCompleted (cyclomatic 31) · ×1
  • CodexService.handleTurnCompleted (cyclomatic 31) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:837 — CodexService.handleTurnCompleted has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.startRuntimeSettingsUpdate (cyclomatic 31) · ×1
  • CodexService.startRuntimeSettingsUpdate (cyclomatic 31) CodexMobile/CodexMobile/Services/CodexService+RuntimeSettingsSync.swift:146 — CodexService.startRuntimeSettingsUpdate has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AssistantMemoryCitationParser.visibleText (cyclomatic 31) · ×1
  • AssistantMemoryCitationParser.visibleText (cyclomatic 31) CodexMobile/CodexMobile/Views/Turn/Messages/AssistantMemoryCitationParser.swift:9 — AssistantMemoryCitationParser.visibleText has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · opencode-runtime.createOpenCodeRuntime.emitItem (cyclomatic 31) · ×1
  • opencode-runtime.createOpenCodeRuntime.emitItem (cyclomatic 31) phodex-bridge/src/opencode-runtime.js:649 — opencode-runtime.createOpenCodeRuntime.emitItem has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · rollout-live-mirror.inspectBootstrapRunBoundary (cyclomatic 31) · ×1
  • rollout-live-mirror.inspectBootstrapRunBoundary (cyclomatic 31) phodex-bridge/src/rollout-live-mirror.js:671 — rollout-live-mirror.inspectBootstrapRunBoundary has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mergeOpenCodeThreadsIntoListResponse (cyclomatic 31) · ×1
  • mergeOpenCodeThreadsIntoListResponse (cyclomatic 31) phodex-bridge/src/bridge.js:5395 — mergeOpenCodeThreadsIntoListResponse has cyclomatic complexity 31 (threshold 15). Of this number, 21 points are the body's own statements and 10 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · createOpenCodeRuntime.emitItem (cyclomatic 31) · ×1
  • createOpenCodeRuntime.emitItem (cyclomatic 31) phodex-bridge/src/opencode-runtime.js:649 — createOpenCodeRuntime.emitItem has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.appendConfirmedMirroredUserMessage (cyclomatic 30) · ×1
  • CodexService.appendConfirmedMirroredUserMessage (cyclomatic 30) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1754 — CodexService.appendConfirmedMirroredUserMessage has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnViewModel.confirmGitSyncAlertAction (cyclomatic 30) · ×1
  • TurnViewModel.confirmGitSyncAlertAction (cyclomatic 30) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:663 — TurnViewModel.confirmGitSyncAlertAction has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · opencode-runtime.createOpenCodeRuntime.readDescendingTurnPage (cyclomatic 30) · ×1
  • opencode-runtime.createOpenCodeRuntime.readDescendingTurnPage (cyclomatic 30) phodex-bridge/src/opencode-runtime.js:1177 — opencode-runtime.createOpenCodeRuntime.readDescendingTurnPage has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rollout-live-mirror.createThreadRolloutLiveMirror.tick (cyclomatic 30) · ×1
  • rollout-live-mirror.createThreadRolloutLiveMirror.tick (cyclomatic 30) phodex-bridge/src/rollout-live-mirror.js:201 — rollout-live-mirror.createThreadRolloutLiveMirror.tick has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · remodex.main (cyclomatic 30) · ×1
  • remodex.main (cyclomatic 30) phodex-bridge/bin/remodex.js:67 — remodex.main has cyclomatic complexity 30 (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 · startBridge.handleApplicationMessage (cyclomatic 30) · ×1
  • startBridge.handleApplicationMessage (cyclomatic 30) phodex-bridge/src/bridge.js:1281 — startBridge.handleApplicationMessage has cyclomatic complexity 30 (threshold 15). Of this number, 27 points are the body's own statements and 3 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · trimThreadPayloadForRelay (cyclomatic 30) · ×1
  • trimThreadPayloadForRelay (cyclomatic 30) phodex-bridge/src/bridge.js:4915 — trimThreadPayloadForRelay has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · projectTurn (cyclomatic 30) · ×1
  • projectTurn (cyclomatic 30) phodex-bridge/src/desktop-ipc-conversation-projector.js:262 — projectTurn has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopIpcLiveOwner.runNextQueuedFollowUp (cyclomatic 30) · ×1
  • createDesktopIpcLiveOwner.runNextQueuedFollowUp (cyclomatic 30) phodex-bridge/src/desktop-ipc-live-owner.js:1776 — createDesktopIpcLiveOwner.runNextQueuedFollowUp has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 1783, a function literal at line 1821, (anonymous)::canRun, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · createOpenCodeRuntime.readDescendingTurnPage (cyclomatic 30) · ×1
  • createOpenCodeRuntime.readDescendingTurnPage (cyclomatic 30) phodex-bridge/src/opencode-runtime.js:1177 — createOpenCodeRuntime.readDescendingTurnPage has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createThreadRolloutLiveMirror.tick (cyclomatic 30) · ×1
  • createThreadRolloutLiveMirror.tick (cyclomatic 30) phodex-bridge/src/rollout-live-mirror.js:201 — createThreadRolloutLiveMirror.tick has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.extractItemID (cyclomatic 29) · ×1
  • CodexService.extractItemID (cyclomatic 29) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2714 — CodexService.extractItemID has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexDesktopRefresher.runPendingRefresh (cyclomatic 29) · ×1
  • CodexDesktopRefresher.runPendingRefresh (cyclomatic 29) phodex-bridge/src/codex-desktop-refresher.js:300 — CodexDesktopRefresher.runPendingRefresh has cyclomatic complexity 29 (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 · push-notification-tracker.createPushNotificationTracker.handleOutbound (cyclomatic 29) · ×1
  • push-notification-tracker.createPushNotificationTracker.handleOutbound (cyclomatic 29) phodex-bridge/src/push-notification-tracker.js:59 — push-notification-tracker.createPushNotificationTracker.handleOutbound has cyclomatic complexity 29 (threshold 15). Of this number, 21 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createPushNotificationTracker.handleOutbound (cyclomatic 29) · ×1
  • createPushNotificationTracker.handleOutbound (cyclomatic 29) phodex-bridge/src/push-notification-tracker.js:59 — createPushNotificationTracker.handleOutbound has cyclomatic complexity 29 (threshold 15). Of this number, 21 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.extractThreadID (cyclomatic 28) · ×1
  • CodexService.extractThreadID (cyclomatic 28) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3587 — CodexService.extractThreadID has cyclomatic complexity 28 (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 · CodexService.shouldDisableTurnPagination (cyclomatic 28) · ×1
  • CodexService.shouldDisableTurnPagination (cyclomatic 28) CodexMobile/CodexMobile/Services/CodexService+TurnPaginationCompatibility.swift:28 — CodexService.shouldDisableTurnPagination has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.tryServeDesktopOwnedRead (cyclomatic 28) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.tryServeDesktopOwnedRead (cyclomatic 28) phodex-bridge/src/desktop-ipc-action-follower.js:1654 — desktop-ipc-action-follower.createDesktopIpcActionFollower.tryServeDesktopOwnedRead has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bridge.startBridge.handleApplicationMessage (cyclomatic 28) · ×1
  • bridge.startBridge.handleApplicationMessage (cyclomatic 28) phodex-bridge/src/bridge.js:1281 — bridge.startBridge.handleApplicationMessage has cyclomatic complexity 28 (threshold 15). Of this number, 25 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.tryServeDesktopOwnedRead (cyclomatic 28) · ×1
  • createDesktopIpcActionFollower.tryServeDesktopOwnedRead (cyclomatic 28) phodex-bridge/src/desktop-ipc-action-follower.js:1654 — createDesktopIpcActionFollower.tryServeDesktopOwnedRead has cyclomatic complexity 28 (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 · createDesktopIpcActionFollower.submitDesktopFollowerRequest (cyclomatic 28) · ×1
  • createDesktopIpcActionFollower.submitDesktopFollowerRequest (cyclomatic 28) phodex-bridge/src/desktop-ipc-action-follower.js:2430 — createDesktopIpcActionFollower.submitDesktopFollowerRequest has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 2 of the 28 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2494, 2468, 2438). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · CodexAutoApprovalReview.coreActionValue (cyclomatic 27) · ×1
  • CodexAutoApprovalReview.coreActionValue (cyclomatic 27) CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift:213 — CodexAutoApprovalReview.coreActionValue has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · CodexService.handleLegacyCommandExecutionEvent (cyclomatic 27) · ×1
  • CodexService.handleLegacyCommandExecutionEvent (cyclomatic 27) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1987 — CodexService.handleLegacyCommandExecutionEvent has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest (cyclomatic 27) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest (cyclomatic 27) phodex-bridge/src/desktop-ipc-action-follower.js:2430 — desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 1 of the 27 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 2494, 2468, 2438). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.applyImmerPatchCopyOnWrite (cyclomatic 27) · ×1
  • desktop-ipc-action-follower.applyImmerPatchCopyOnWrite (cyclomatic 27) phodex-bridge/src/desktop-ipc-action-follower.js:4166 — desktop-ipc-action-follower.applyImmerPatchCopyOnWrite has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.runNextQueuedFollowUp (cyclomatic 27) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.runNextQueuedFollowUp (cyclomatic 27) phodex-bridge/src/desktop-ipc-live-owner.js:1776 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.runNextQueuedFollowUp has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1783, 1788, 1827, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · bridge.areEquivalentRelayHistoryItems (cyclomatic 27) · ×1
  • bridge.areEquivalentRelayHistoryItems (cyclomatic 27) phodex-bridge/src/bridge.js:4292 — bridge.areEquivalentRelayHistoryItems has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.resolvedSubagentPresentation (cyclomatic 26) · ×1
  • CodexService.resolvedSubagentPresentation (cyclomatic 26) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:813 — CodexService.resolvedSubagentPresentation has cyclomatic complexity 26 (threshold 15). Of this number, 17 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexMessage.== (cyclomatic 25) · ×1
  • CodexMessage.== (cyclomatic 25) CodexMobile/CodexMobile/Models/CodexMessage.swift:301 — CodexMessage.== has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.extractTextDelta (cyclomatic 25) · ×1
  • CodexService.extractTextDelta (cyclomatic 25) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2736 — CodexService.extractTextDelta has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · TurnComposerView.composerStack (cyclomatic 25) · ×1
  • TurnComposerView.composerStack (cyclomatic 25) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift:220 — TurnComposerView.composerStack has cyclomatic complexity 25 (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 · TurnViewModel.triggerGitAction (cyclomatic 25) · ×1
  • TurnViewModel.triggerGitAction (cyclomatic 25) REDACTED:3211 — TurnViewModel.triggerGitAction has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandHumanizer.extractSearchPatternAndPath (cyclomatic 25) · ×1
  • CommandHumanizer.extractSearchPatternAndPath (cyclomatic 25) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:864 — CommandHumanizer.extractSearchPatternAndPath has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · codex-transport.createSpawnTransport (cyclomatic 25) · ×1
  • codex-transport.createSpawnTransport (cyclomatic 25) phodex-bridge/src/codex-transport.js:27 — codex-transport.createSpawnTransport has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 109, a function literal at line 128, a function literal at line 96, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.observeThreadListResponse (cyclomatic 25) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.observeThreadListResponse (cyclomatic 25) phodex-bridge/src/desktop-ipc-action-follower.js:366 — desktop-ipc-action-follower.createDesktopIpcActionFollower.observeThreadListResponse has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.observeThreadListResponse (cyclomatic 25) · ×1
  • createDesktopIpcActionFollower.observeThreadListResponse (cyclomatic 25) phodex-bridge/src/desktop-ipc-action-follower.js:366 — createDesktopIpcActionFollower.observeThreadListResponse has cyclomatic complexity 25 (threshold 15). Of this number, 23 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.appendCompletedAgentText (cyclomatic 24) · ×1
  • CodexService.appendCompletedAgentText (cyclomatic 24) CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift:104 — CodexService.appendCompletedAgentText has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.loadMacScopedDefaultsState (cyclomatic 24) · ×1
  • CodexService.loadMacScopedDefaultsState (cyclomatic 24) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:124 — CodexService.loadMacScopedDefaultsState has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.appendSystemMessage (cyclomatic 24) · ×1
  • CodexService.appendSystemMessage (cyclomatic 24) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1939 — CodexService.appendSystemMessage has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnDiffLineKind.detectVerifiedPatch (cyclomatic 24) · ×1
  • TurnDiffLineKind.detectVerifiedPatch (cyclomatic 24) CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffRenderer.swift:27 — TurnDiffLineKind.detectVerifiedPatch has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · TurnTimelineReducer.enforceIntraTurnOrder (cyclomatic 24) · ×1
  • TurnTimelineReducer.enforceIntraTurnOrder (cyclomatic 24) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:58 — TurnTimelineReducer.enforceIntraTurnOrder has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnTimelineReducer.anchorLateFileChangesToOwningTurn (cyclomatic 24) · ×1
  • TurnTimelineReducer.anchorLateFileChangesToOwningTurn (cyclomatic 24) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:257 — TurnTimelineReducer.anchorLateFileChangesToOwningTurn has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnTimelineReducer.shouldMergeUserMessages (cyclomatic 24) · ×1
  • TurnTimelineReducer.shouldMergeUserMessages (cyclomatic 24) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:772 — TurnTimelineReducer.shouldMergeUserMessages has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · workspace-handler.analyzePatchChunk (cyclomatic 24) · ×1
  • workspace-handler.analyzePatchChunk (cyclomatic 24) phodex-bridge/src/workspace-handler.js:930 — workspace-handler.analyzePatchChunk has cyclomatic complexity 24 (threshold 15). Of this number, 15 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · desktop-ipc-state-patches.applyPatchToBaselineNode (cyclomatic 24) · ×1
  • desktop-ipc-state-patches.applyPatchToBaselineNode (cyclomatic 24) phodex-bridge/src/desktop-ipc-state-patches.js:146 — desktop-ipc-state-patches.applyPatchToBaselineNode has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bridge.fetchAdaptiveThreadTurnsListForRelay (cyclomatic 24) · ×1
  • bridge.fetchAdaptiveThreadTurnsListForRelay (cyclomatic 24) phodex-bridge/src/bridge.js:2929 — bridge.fetchAdaptiveThreadTurnsListForRelay has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · reasoningVariants (cyclomatic 24) · ×1
  • reasoningVariants (cyclomatic 24) phodex-bridge/src/opencode-runtime.js:200 — reasoningVariants has cyclomatic complexity 24 (threshold 15). Of this number, 16 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createPushNotificationTracker.handleGoalUpdated (cyclomatic 24) · ×1
  • createPushNotificationTracker.handleGoalUpdated (cyclomatic 24) phodex-bridge/src/push-notification-tracker.js:170 — createPushNotificationTracker.handleGoalUpdated has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexAsyncUserInputProjection.nativeReply (cyclomatic 23) · ×1
  • CodexAsyncUserInputProjection.nativeReply (cyclomatic 23) CodexMobile/CodexMobile/Models/CodexAsyncUserInputProjection.swift:165 — CodexAsyncUserInputProjection.nativeReply 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.
D1 · Cyclomatic Complexity · CodexService.extractIncomingMessageText (cyclomatic 23) · ×1
  • CodexService.extractIncomingMessageText (cyclomatic 23) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3785 — CodexService.extractIncomingMessageText has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SidebarActivityDiffStore.refresh (cyclomatic 23) · ×1
  • SidebarActivityDiffStore.refresh (cyclomatic 23) CodexMobile/CodexMobile/Services/SidebarActivityDiffStore.swift:18 — SidebarActivityDiffStore.refresh 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.
D1 · Cyclomatic Complexity · WorkspaceRunestoneTheme.textColor (cyclomatic 23) · ×1
  • WorkspaceRunestoneTheme.textColor (cyclomatic 23) CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:1185 — WorkspaceRunestoneTheme.textColor has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnTimelineView.assistantBlockInfo (cyclomatic 23) · ×1
  • TurnTimelineView.assistantBlockInfo (cyclomatic 23) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:17 — TurnTimelineView.assistantBlockInfo has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · opencode-runtime.normalizePart (cyclomatic 23) · ×1
  • opencode-runtime.normalizePart (cyclomatic 23) phodex-bridge/src/opencode-runtime.js:117 — opencode-runtime.normalizePart 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.
D1 · Cyclomatic Complexity · workspace-handler.workspaceReadImage (cyclomatic 23) · ×1
  • workspace-handler.workspaceReadImage (cyclomatic 23) phodex-bridge/src/workspace-handler.js:176 — workspace-handler.workspaceReadImage has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · desktop-ipc-conversation-adapter.applyDeltaNotification (cyclomatic 23) · ×1
  • desktop-ipc-conversation-adapter.applyDeltaNotification (cyclomatic 23) phodex-bridge/src/desktop-ipc-conversation-adapter.js:1245 — desktop-ipc-conversation-adapter.applyDeltaNotification has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.mergedThread (cyclomatic 22) · ×1
  • CodexService.mergedThread (cyclomatic 22) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:95 — CodexService.mergedThread has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.decodeItemText (cyclomatic 22) · ×1
  • CodexService.decodeItemText (cyclomatic 22) CodexMobile/CodexMobile/Services/CodexService+History.swift:490 — CodexService.decodeItemText has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.noteDesktopMirroredActivityIfNeeded (cyclomatic 22) · ×1
  • CodexService.noteDesktopMirroredActivityIfNeeded (cyclomatic 22) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:441 — CodexService.noteDesktopMirroredActivityIfNeeded has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.handleThreadStatusChanged (cyclomatic 22) · ×1
  • CodexService.handleThreadStatusChanged (cyclomatic 22) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1068 — CodexService.handleThreadStatusChanged has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.isFileChangeSnapshotPayload (cyclomatic 22) · ×1
  • CodexService.isFileChangeSnapshotPayload (cyclomatic 22) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3259 — CodexService.isFileChangeSnapshotPayload has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.pruneDuplicateSystemRows (cyclomatic 22) · ×1
  • CodexService.pruneDuplicateSystemRows (cyclomatic 22) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3399 — CodexService.pruneDuplicateSystemRows has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.ensureStreamingAssistantMessage (cyclomatic 22) · ×1
  • CodexService.ensureStreamingAssistantMessage (cyclomatic 22) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6631 — CodexService.ensureStreamingAssistantMessage has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.continueAfterStreamFailure (cyclomatic 22) · ×1
  • CodexService.continueAfterStreamFailure (cyclomatic 22) CodexMobile/CodexMobile/Services/CodexService+StreamRecovery.swift:51 — CodexService.continueAfterStreamFailure has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnViewModel.onInputChangedForSkillAutocomplete (cyclomatic 22) · ×1
  • TurnViewModel.onInputChangedForSkillAutocomplete (cyclomatic 22) REDACTED:926 — TurnViewModel.onInputChangedForSkillAutocomplete has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · opencode-runtime.createOpenCodeRuntime.refreshSessionStatuses (cyclomatic 22) · ×1
  • opencode-runtime.createOpenCodeRuntime.refreshSessionStatuses (cyclomatic 22) phodex-bridge/src/opencode-runtime.js:776 — opencode-runtime.createOpenCodeRuntime.refreshSessionStatuses has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 802, 778, 787, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · git-handler.assertWorktreeHasNoBoundChats (cyclomatic 22) · ×1
  • git-handler.assertWorktreeHasNoBoundChats (cyclomatic 22) phodex-bridge/src/git-handler.js:2270 — git-handler.assertWorktreeHasNoBoundChats has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: git-handler.handleGitMethod (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · apply-patch-changes.parseApplyPatchChanges (cyclomatic 22) · ×1
  • apply-patch-changes.parseApplyPatchChanges (cyclomatic 22) phodex-bridge/src/apply-patch-changes.js:31 — apply-patch-changes.parseApplyPatchChanges has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · session-jsonl-history.shouldSkipResponseItemForHistory (cyclomatic 22) · ×1
  • session-jsonl-history.shouldSkipResponseItemForHistory (cyclomatic 22) phodex-bridge/src/session-jsonl-history.js:1338 — session-jsonl-history.shouldSkipResponseItemForHistory has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: session-jsonl-history.readableToolActivityMessage (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.
D1 · Cyclomatic Complexity · handleDesktopMethod (cyclomatic 22) · ×1
  • handleDesktopMethod (cyclomatic 22) phodex-bridge/src/desktop-handler.js:62 — handleDesktopMethod has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cyclomatic 22) · ×1
  • createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cyclomatic 22) phodex-bridge/src/desktop-ipc-action-follower.js:2102 — createDesktopIpcActionFollower.emitNormalizedReviewOverlays has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopIpcLiveOwner.observeInbound (cyclomatic 22) · ×1
  • createDesktopIpcLiveOwner.observeInbound (cyclomatic 22) phodex-bridge/src/desktop-ipc-live-owner.js:243 — createDesktopIpcLiveOwner.observeInbound has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createOpenCodeRuntime.refreshSessionStatuses (cyclomatic 22) · ×1
  • createOpenCodeRuntime.refreshSessionStatuses (cyclomatic 22) phodex-bridge/src/opencode-runtime.js:776 — createOpenCodeRuntime.refreshSessionStatuses has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 802, a function literal at line 778, a function literal at line 787, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · createOpenCodeRuntime.handleClientResponse (cyclomatic 22) · ×1
  • createOpenCodeRuntime.handleClientResponse (cyclomatic 22) phodex-bridge/src/opencode-runtime.js:1357 — createOpenCodeRuntime.handleClientResponse has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.existingMessagesForCanonicalSourceReplacement (cyclomatic 21) · ×1
  • CodexService.existingMessagesForCanonicalSourceReplacement (cyclomatic 21) CodexMobile/CodexMobile/Services/CodexService+History.swift:730 — CodexService.existingMessagesForCanonicalSourceReplacement 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. This shape REPEATS in the file: one other method here (CodexService.existingMessagesForCanonicalSourceReplacement::hasCanonicalCounterpart) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · CodexService.fallbackUserHistoryMergeIndices (cyclomatic 21) · ×1
  • CodexService.fallbackUserHistoryMergeIndices (cyclomatic 21) CodexMobile/CodexMobile/Services/CodexService+History.swift:3063 — CodexService.fallbackUserHistoryMergeIndices has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.isLikelyIncomingItemPayload (cyclomatic 21) · ×1
  • CodexService.isLikelyIncomingItemPayload (cyclomatic 21) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2654 — CodexService.isLikelyIncomingItemPayload has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.handleItemStarted (cyclomatic 21) · ×1
  • CodexService.handleItemStarted (cyclomatic 21) CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift:295 — CodexService.handleItemStarted has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.mergeLateReasoningDeltaIfPossible (cyclomatic 21) · ×1
  • CodexService.mergeLateReasoningDeltaIfPossible (cyclomatic 21) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3616 — CodexService.mergeLateReasoningDeltaIfPossible has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.classifyVoiceFailureMessage (cyclomatic 21) · ×1
  • CodexService.classifyVoiceFailureMessage (cyclomatic 21) CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:171 — CodexService.classifyVoiceFailureMessage has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · GPTVoiceTranscriptionManager.startRecording (cyclomatic 21) · ×1
  • GPTVoiceTranscriptionManager.startRecording (cyclomatic 21) CodexMobile/CodexMobile/Services/GPTVoiceTranscriptionManager.swift:106 — GPTVoiceTranscriptionManager.startRecording has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StreamingInlineMarkupAutoCloser.scanInlineMarkers (cyclomatic 21) · ×1
  • StreamingInlineMarkupAutoCloser.scanInlineMarkers (cyclomatic 21) CodexMobile/CodexMobile/Views/Turn/Messages/StreamingInlineMarkupAutoCloser.swift:91 — StreamingInlineMarkupAutoCloser.scanInlineMarkers has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnTimelineReducer.fileChangeMessage (cyclomatic 21) · ×1
  • TurnTimelineReducer.fileChangeMessage (cyclomatic 21) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:1380 — TurnTimelineReducer.fileChangeMessage has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · push-notification-tracker.createPushNotificationTracker.handleGoalUpdated (cyclomatic 21) · ×1
  • push-notification-tracker.createPushNotificationTracker.handleGoalUpdated (cyclomatic 21) phodex-bridge/src/push-notification-tracker.js:170 — push-notification-tracker.createPushNotificationTracker.handleGoalUpdated has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.normalizedLiveIndexNeedsRebuild (cyclomatic 21) · ×1
  • desktop-ipc-action-follower.normalizedLiveIndexNeedsRebuild (cyclomatic 21) phodex-bridge/src/desktop-ipc-action-follower.js:3466 — desktop-ipc-action-follower.normalizedLiveIndexNeedsRebuild has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeInbound (cyclomatic 21) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeInbound (cyclomatic 21) phodex-bridge/src/desktop-ipc-live-owner.js:243 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeInbound has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · buildConversationTurn (cyclomatic 21) · ×1
  • buildConversationTurn (cyclomatic 21) phodex-bridge/src/desktop-ipc-conversation-adapter.js:793 — buildConversationTurn has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · createPushNotificationServiceClient.postJSON (cyclomatic 21) · ×1
  • createPushNotificationServiceClient.postJSON (cyclomatic 21) phodex-bridge/src/push-notification-service-client.js:63 — createPushNotificationServiceClient.postJSON has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexAutoApprovalReview.coreFileSystemPermissions (cyclomatic 20) · ×1
  • CodexAutoApprovalReview.coreFileSystemPermissions (cyclomatic 20) CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift:318 — CodexAutoApprovalReview.coreFileSystemPermissions has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.deliverAsyncUserInput (cyclomatic 20) · ×1
  • CodexService.deliverAsyncUserInput (cyclomatic 20) CodexMobile/CodexMobile/Services/CodexService+AsyncUserInput.swift:71 — CodexService.deliverAsyncUserInput has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.reconcileLocalThreadsWithServer (cyclomatic 20) · ×1
  • CodexService.reconcileLocalThreadsWithServer (cyclomatic 20) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:222 — CodexService.reconcileLocalThreadsWithServer has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.catchUpRunningThreadIfNeeded (cyclomatic 20) · ×1
  • CodexService.catchUpRunningThreadIfNeeded (cyclomatic 20) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:762 — CodexService.catchUpRunningThreadIfNeeded has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ContentViewModel.connectWithAutoRecovery (cyclomatic 20) · ×1
  • ContentViewModel.connectWithAutoRecovery (cyclomatic 20) CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:356 — ContentViewModel.connectWithAutoRecovery has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnViewModel.onInputChangedForPluginAutocomplete (cyclomatic 20) · ×1
  • TurnViewModel.onInputChangedForPluginAutocomplete (cyclomatic 20) REDACTED:1059 — TurnViewModel.onInputChangedForPluginAutocomplete has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandHumanizer.gitInfo (cyclomatic 20) · ×1
  • CommandHumanizer.gitInfo (cyclomatic 20) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:919 — CommandHumanizer.gitInfo has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnTimelineReducer.hasInterleavedAssistantActivityFlow (cyclomatic 20) · ×1
  • TurnTimelineReducer.hasInterleavedAssistantActivityFlow (cyclomatic 20) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:171 — TurnTimelineReducer.hasInterleavedAssistantActivityFlow has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnTimelineReducer.mergedUserMessage (cyclomatic 20) · ×1
  • TurnTimelineReducer.mergedUserMessage (cyclomatic 20) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:821 — TurnTimelineReducer.mergedUserMessage has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TurnTimelineReducer.removeDuplicateAssistantMessages (cyclomatic 20) · ×1
  • TurnTimelineReducer.removeDuplicateAssistantMessages (cyclomatic 20) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:967 — TurnTimelineReducer.removeDuplicateAssistantMessages has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · push-notification-service-client.createPushNotificationServiceClient.postJSON (cyclomatic 20) · ×1
  • push-notification-service-client.createPushNotificationServiceClient.postJSON (cyclomatic 20) phodex-bridge/src/push-notification-service-client.js:63 — push-notification-service-client.createPushNotificationServiceClient.postJSON has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState (cyclomatic 20) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState (cyclomatic 20) phodex-bridge/src/desktop-ipc-action-follower.js:1978 — desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cyclomatic 20) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cyclomatic 20) phodex-bridge/src/desktop-ipc-action-follower.js:2102 — desktop-ipc-action-follower.createDesktopIpcActionFollower.emitNormalizedReviewOverlays has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.applyConversationStateChange (cyclomatic 20) · ×1
  • desktop-ipc-action-follower.applyConversationStateChange (cyclomatic 20) phodex-bridge/src/desktop-ipc-action-follower.js:3294 — desktop-ipc-action-follower.applyConversationStateChange has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bridge.sanitizeRelayHistoryTurn (cyclomatic 20) · ×1
  • bridge.sanitizeRelayHistoryTurn (cyclomatic 20) phodex-bridge/src/bridge.js:4471 — bridge.sanitizeRelayHistoryTurn has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 7 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 4480, 4506). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · sanitizeThreadHistoryImagesForRelay (cyclomatic 20) · ×1
  • sanitizeThreadHistoryImagesForRelay (cyclomatic 20) phodex-bridge/src/bridge.js:3579 — sanitizeThreadHistoryImagesForRelay has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.tryBootstrapDesktopResume (cyclomatic 20) · ×1
  • createDesktopIpcActionFollower.tryBootstrapDesktopResume (cyclomatic 20) phodex-bridge/src/desktop-ipc-action-follower.js:1409 — createDesktopIpcActionFollower.tryBootstrapDesktopResume has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to 6 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.syncProjectedConversationState (cyclomatic 20) · ×1
  • createDesktopIpcActionFollower.syncProjectedConversationState (cyclomatic 20) phodex-bridge/src/desktop-ipc-action-follower.js:1978 — createDesktopIpcActionFollower.syncProjectedConversationState has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · reduceItemLifecycle (cyclomatic 20) · ×1
  • reduceItemLifecycle (cyclomatic 20) phodex-bridge/src/thread-activity-projector.js:279 — reduceItemLifecycle has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ContentView.scheduleSidebarPrewarmIfNeeded (cyclomatic 19) · ×1
  • ContentView.scheduleSidebarPrewarmIfNeeded (cyclomatic 19) CodexMobile/CodexMobile/ContentView.swift:1497 — ContentView.scheduleSidebarPrewarmIfNeeded has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexAsyncUserInputProjection.reopenRepliesMissingFromCanonicalHistory (cyclomatic 19) · ×1
  • CodexAsyncUserInputProjection.reopenRepliesMissingFromCanonicalHistory (cyclomatic 19) CodexMobile/CodexMobile/Models/CodexAsyncUserInputProjection.swift:84 — CodexAsyncUserInputProjection.reopenRepliesMissingFromCanonicalHistory has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.decodeHistoryBaseDate (cyclomatic 19) · ×1
  • CodexService.decodeHistoryBaseDate (cyclomatic 19) CodexMobile/CodexMobile/Services/CodexService+History.swift:429 — CodexService.decodeHistoryBaseDate has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.applyLateTerminalAssistantDelta (cyclomatic 19) · ×1
  • CodexService.applyLateTerminalAssistantDelta (cyclomatic 19) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3950 — CodexService.applyLateTerminalAssistantDelta has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.syncManagedPushRegistrationIfNeeded (cyclomatic 19) · ×1
  • CodexService.syncManagedPushRegistrationIfNeeded (cyclomatic 19) CodexMobile/CodexMobile/Services/CodexService+Notifications.swift:195 — CodexService.syncManagedPushRegistrationIfNeeded has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.performSecureHandshake (cyclomatic 19) · ×1
  • CodexService.performSecureHandshake (cyclomatic 19) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:13 — CodexService.performSecureHandshake has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.startTurn (cyclomatic 19) · ×1
  • CodexService.startTurn (cyclomatic 19) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:359 — CodexService.startTurn has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod (cyclomatic 19) · ×1
  • CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod (cyclomatic 19) CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:64 — CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · ContentViewModel.attemptAutoReconnectOnForegroundIfNeeded (cyclomatic 19) · ×1
  • ContentViewModel.attemptAutoReconnectOnForegroundIfNeeded (cyclomatic 19) CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:203 — ContentViewModel.attemptAutoReconnectOnForegroundIfNeeded has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NewChatDraftView.body (cyclomatic 19) · ×1
  • NewChatDraftView.body (cyclomatic 19) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:116 — NewChatDraftView.body has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TurnViewModel.canRestoreSavedLocalDraft (cyclomatic 19) · ×1
  • TurnViewModel.canRestoreSavedLocalDraft (cyclomatic 19) REDACTED:694 — TurnViewModel.canRestoreSavedLocalDraft has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CommandHumanizer.humanize (cyclomatic 19) · ×1
  • CommandHumanizer.humanize (cyclomatic 19) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:676 — CommandHumanizer.humanize has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnTimelineView.scheduleProgressiveTailRevealIfNeeded (cyclomatic 19) · ×1
  • TurnTimelineView.scheduleProgressiveTailRevealIfNeeded (cyclomatic 19) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:965 — TurnTimelineView.scheduleProgressiveTailRevealIfNeeded has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · opencode-runtime.partsFromInput (cyclomatic 19) · ×1
  • opencode-runtime.partsFromInput (cyclomatic 19) phodex-bridge/src/opencode-runtime.js:93 — opencode-runtime.partsFromInput has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · account-status.composeAccountStatus (cyclomatic 19) · ×1
  • account-status.composeAccountStatus (cyclomatic 19) phodex-bridge/src/account-status.js:11 — account-status.composeAccountStatus has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · normalizeThreadGoal (cyclomatic 19) · ×1
  • normalizeThreadGoal (cyclomatic 19) phodex-bridge/src/desktop-ipc-conversation-adapter.js:1415 — normalizeThreadGoal has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · normalizeProjectedThreadGoal (cyclomatic 19) · ×1
  • normalizeProjectedThreadGoal (cyclomatic 19) phodex-bridge/src/desktop-ipc-conversation-projector.js:1285 — normalizeProjectedThreadGoal 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. This is NOT this file's highest cyclomatic complexity: isSupportedItemType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · gitCreatePullRequest (cyclomatic 19) · ×1
  • gitCreatePullRequest (cyclomatic 19) phodex-bridge/src/git-handler.js:1144 — gitCreatePullRequest 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. This is NOT this file's highest cyclomatic complexity: handleGitMethod (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · searchDirectoryEntries (cyclomatic 19) · ×1
  • searchDirectoryEntries (cyclomatic 19) phodex-bridge/src/project-handler.js:356 — searchDirectoryEntries has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexAsyncUserInputProjection.reconcile (cyclomatic 18) · ×1
  • CodexAsyncUserInputProjection.reconcile (cyclomatic 18) CodexMobile/CodexMobile/Models/CodexAsyncUserInputProjection.swift:17 — CodexAsyncUserInputProjection.reconcile has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.init (cyclomatic 18) · ×1
  • CodexService.init (cyclomatic 18) CodexMobile/CodexMobile/Services/CodexService.swift:899 — CodexService.init has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.incompatibleBridgeAppVersionError (cyclomatic 18) · ×1
  • CodexService.incompatibleBridgeAppVersionError (cyclomatic 18) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:435 — CodexService.incompatibleBridgeAppVersionError has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.migrateMacScopedState (cyclomatic 18) · ×1
  • CodexService.migrateMacScopedState (cyclomatic 18) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:339 — CodexService.migrateMacScopedState has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.preparePlanItemIdentityForUpsert (cyclomatic 18) · ×1
  • CodexService.preparePlanItemIdentityForUpsert (cyclomatic 18) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2117 — CodexService.preparePlanItemIdentityForUpsert has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · RemodexTerminalSnapshot.applyTerminalEvent (cyclomatic 18) · ×1
  • RemodexTerminalSnapshot.applyTerminalEvent (cyclomatic 18) CodexMobile/CodexMobile/Services/Terminal/RemodexTerminalModels.swift:225 — RemodexTerminalSnapshot.applyTerminalEvent has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TurnComposerInputTextView.updateUIView (cyclomatic 18) · ×1
  • TurnComposerInputTextView.updateUIView (cyclomatic 18) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift:63 — TurnComposerInputTextView.updateUIView has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · TurnView.composerWithSubagentAccessory (cyclomatic 18) · ×1
  • TurnView.composerWithSubagentAccessory (cyclomatic 18) CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1561 — TurnView.composerWithSubagentAccessory has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · opencode-runtime.createOpenCodeRuntime.rememberMessageInfo (cyclomatic 18) · ×1
  • opencode-runtime.createOpenCodeRuntime.rememberMessageInfo (cyclomatic 18) phodex-bridge/src/opencode-runtime.js:690 — opencode-runtime.createOpenCodeRuntime.rememberMessageInfo has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · git-handler.createWorktreeAtManagedPath (cyclomatic 18) · ×1
  • git-handler.createWorktreeAtManagedPath (cyclomatic 18) phodex-bridge/src/git-handler.js:689 — git-handler.createWorktreeAtManagedPath 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: git-handler.handleGitMethod (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute (cyclomatic 18) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute (cyclomatic 18) phodex-bridge/src/desktop-ipc-action-follower.js:2346 — desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cyclomatic 18) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cyclomatic 18) phodex-bridge/src/desktop-ipc-live-owner.js:1838 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: desktop-ipc-live-owner.createDesktopIpcLiveOwner.handleFollowerRequest (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · session-jsonl-history.readRecentSessionJsonlTurns (cyclomatic 18) · ×1
  • session-jsonl-history.readRecentSessionJsonlTurns (cyclomatic 18) phodex-bridge/src/session-jsonl-history.js:73 — session-jsonl-history.readRecentSessionJsonlTurns has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: session-jsonl-history.readableToolActivityMessage (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.
D1 · Cyclomatic Complexity · bridge.createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cyclomatic 18) · ×1
  • bridge.createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cyclomatic 18) phodex-bridge/src/bridge.js:371 — bridge.createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cyclomatic 18) · ×1
  • createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cyclomatic 18) phodex-bridge/src/bridge.js:371 — createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.buildDesktopFollowerRoute (cyclomatic 18) · ×1
  • createDesktopIpcActionFollower.buildDesktopFollowerRoute (cyclomatic 18) phodex-bridge/src/desktop-ipc-action-follower.js:2346 — createDesktopIpcActionFollower.buildDesktopFollowerRoute has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cyclomatic 18) · ×1
  • createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cyclomatic 18) phodex-bridge/src/desktop-ipc-live-owner.js:1838 — createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: createDesktopIpcLiveOwner.handleFollowerRequest (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · gitTransferManagedHandoff (cyclomatic 18) · ×1
  • gitTransferManagedHandoff (cyclomatic 18) phodex-bridge/src/git-handler.js:821 — gitTransferManagedHandoff 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 is NOT this file's highest cyclomatic complexity: handleGitMethod (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · createOpenCodeRuntime.rememberMessageInfo (cyclomatic 18) · ×1
  • createOpenCodeRuntime.rememberMessageInfo (cyclomatic 18) phodex-bridge/src/opencode-runtime.js:690 — createOpenCodeRuntime.rememberMessageInfo has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · reduceTurnStarted (cyclomatic 18) · ×1
  • reduceTurnStarted (cyclomatic 18) phodex-bridge/src/thread-activity-projector.js:164 — reduceTurnStarted has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.receiveErrorDisposition (cyclomatic 17) · ×1
  • CodexService.receiveErrorDisposition (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:842 — CodexService.receiveErrorDisposition has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.existingMessagesForCanonicalSourceReplacement · ×1
  • CodexService.existingMessagesForCanonicalSourceReplacement::hasCanonicalCounterpart (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+History.swift:783 — CodexService.existingMessagesForCanonicalSourceReplacement::hasCanonicalCounterpart has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (CodexService.existingMessagesForCanonicalSourceReplacement) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · CodexService.uniqueAssistantHistoryTextMergeIndex (cyclomatic 17) · ×1
  • CodexService.uniqueAssistantHistoryTextMergeIndex (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+History.swift:2703 — CodexService.uniqueAssistantHistoryTextMergeIndex has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.unwrapHistoryShellCommandIfPresent (cyclomatic 17) · ×1
  • CodexService.unwrapHistoryShellCommandIfPresent (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+History.swift:3928 — CodexService.unwrapHistoryShellCommandIfPresent has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.appendReasoningDelta (cyclomatic 17) · ×1
  • CodexService.appendReasoningDelta (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1211 — CodexService.appendReasoningDelta has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.performPrepareThreadForDisplay (cyclomatic 17) · ×1
  • CodexService.performPrepareThreadForDisplay (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:978 — CodexService.performPrepareThreadForDisplay has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · CodexService.makeTurnInputPayload (cyclomatic 17) · ×1
  • CodexService.makeTurnInputPayload (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2445 — CodexService.makeTurnInputPayload has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.startWebSocketKeepAliveLoop (cyclomatic 17) · ×1
  • CodexService.startWebSocketKeepAliveLoop (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+Transport.swift:384 — CodexService.startWebSocketKeepAliveLoop has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.validateVoiceWAVData (cyclomatic 17) · ×1
  • CodexService.validateVoiceWAVData (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+Voice.swift:285 — CodexService.validateVoiceWAVData has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RemodexNativeSSHTerminal.open (cyclomatic 17) · ×1
  • RemodexNativeSSHTerminal.open (cyclomatic 17) CodexMobile/CodexMobile/Services/Terminal/RemodexNativeSSHTerminal.swift:143 — RemodexNativeSSHTerminal.open has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContentViewModel.switchToTrustedMac (cyclomatic 17) · ×1
  • ContentViewModel.switchToTrustedMac (cyclomatic 17) CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:759 — ContentViewModel.switchToTrustedMac has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnifiedDiffParser.parse (cyclomatic 17) · ×1
  • UnifiedDiffParser.parse (cyclomatic 17) CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:73 — UnifiedDiffParser.parse has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TurnGitBranchPickerSheet.body (cyclomatic 17) · ×1
  • TurnGitBranchPickerSheet.body (cyclomatic 17) CodexMobile/CodexMobile/Views/Turn/Git/TurnGitBranchSelector.swift:315 — TurnGitBranchPickerSheet.body has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StreamingInlineMarkupAutoCloser.autoClosed (cyclomatic 17) · ×1
  • StreamingInlineMarkupAutoCloser.autoClosed (cyclomatic 17) CodexMobile/CodexMobile/Views/Turn/Messages/StreamingInlineMarkupAutoCloser.swift:16 — StreamingInlineMarkupAutoCloser.autoClosed has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageRowRenderModelCache.buildModel (cyclomatic 17) · ×1
  • MessageRowRenderModelCache.buildModel (cyclomatic 17) CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageCaches.swift:133 — MessageRowRenderModelCache.buildModel has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService+IncomingSupport.swift.unwrapShellCommandIfPresent (cyclomatic 17) · ×1
  • CodexService+IncomingSupport.swift.unwrapShellCommandIfPresent (cyclomatic 17) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:549 — CodexService+IncomingSupport.swift.unwrapShellCommandIfPresent has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rollout-watch.findRecentRolloutFileForContextRead (cyclomatic 17) · ×1
  • rollout-watch.findRecentRolloutFileForContextRead (cyclomatic 17) phodex-bridge/src/rollout-watch.js:347 — rollout-watch.findRecentRolloutFileForContextRead has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · secure-transport.createBridgeSecureTransport.handleClientHello (cyclomatic 17) · ×1
  • secure-transport.createBridgeSecureTransport.handleClientHello (cyclomatic 17) REDACTED:139 — secure-transport.createBridgeSecureTransport.handleClientHello has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · rollout-live-mirror.toolOutputNotifications (cyclomatic 17) · ×1
  • rollout-live-mirror.toolOutputNotifications (cyclomatic 17) phodex-bridge/src/rollout-live-mirror.js:1608 — rollout-live-mirror.toolOutputNotifications has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: 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 · desktop-ipc-conversation-projector.diffItem (cyclomatic 17) · ×1
  • desktop-ipc-conversation-projector.diffItem (cyclomatic 17) phodex-bridge/src/desktop-ipc-conversation-projector.js:528 — desktop-ipc-conversation-projector.diffItem has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: desktop-ipc-conversation-projector.isSupportedItemType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.negotiateResumeOwnership (cyclomatic 17) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.negotiateResumeOwnership (cyclomatic 17) phodex-bridge/src/desktop-ipc-action-follower.js:1366 — desktop-ipc-action-follower.createDesktopIpcActionFollower.negotiateResumeOwnership has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.tryBootstrapDesktopResume (cyclomatic 17) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.tryBootstrapDesktopResume (cyclomatic 17) phodex-bridge/src/desktop-ipc-action-follower.js:1409 — desktop-ipc-action-follower.createDesktopIpcActionFollower.tryBootstrapDesktopResume has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · bridge.normalizeTurnStartForCodex (cyclomatic 17) · ×1
  • bridge.normalizeTurnStartForCodex (cyclomatic 17) phodex-bridge/src/bridge.js:2736 — bridge.normalizeTurnStartForCodex has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bridge.augmentRelayHistoryTurnsWithJsonlArtifacts (cyclomatic 17) · ×1
  • bridge.augmentRelayHistoryTurnsWithJsonlArtifacts (cyclomatic 17) phodex-bridge/src/bridge.js:3788 — bridge.augmentRelayHistoryTurnsWithJsonlArtifacts has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 3810, 3796). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · relay.resolveTrustedMacSession (cyclomatic 17) · ×1
  • relay.resolveTrustedMacSession (cyclomatic 17) relay/relay.js:339 — relay.resolveTrustedMacSession has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · server.handleHTTPRequest (cyclomatic 17) · ×1
  • server.handleHTTPRequest (cyclomatic 17) relay/server.js:97 — server.handleHTTPRequest has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.negotiateResumeOwnership (cyclomatic 17) · ×1
  • createDesktopIpcActionFollower.negotiateResumeOwnership (cyclomatic 17) phodex-bridge/src/desktop-ipc-action-follower.js:1366 — createDesktopIpcActionFollower.negotiateResumeOwnership has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · createBridgeSecureTransport.handleClientHello (cyclomatic 17) · ×1
  • createBridgeSecureTransport.handleClientHello (cyclomatic 17) REDACTED:139 — createBridgeSecureTransport.handleClientHello has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · reduceTurnCompleted (cyclomatic 17) · ×1
  • reduceTurnCompleted (cyclomatic 17) phodex-bridge/src/thread-activity-projector.js:209 — reduceTurnCompleted has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · requestTranscription (cyclomatic 17) · ×1
  • requestTranscription (cyclomatic 17) phodex-bridge/src/voice-handler.js:260 — requestTranscription has cyclomatic complexity 17 (threshold 15). Of this number, 9 points are the body's own statements and 8 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ContentView.mainContent (cyclomatic 16) · ×1
  • ContentView.mainContent (cyclomatic 16) CodexMobile/CodexMobile/ContentView.swift:799 — ContentView.mainContent has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.decodeBridgeGPTAccountSnapshot (cyclomatic 16) · ×1
  • CodexService.decodeBridgeGPTAccountSnapshot (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+Account.swift:962 — CodexService.decodeBridgeGPTAccountSnapshot has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.flushPendingRuntimeOptionRefreshIfPossible (cyclomatic 16) · ×1
  • CodexService.flushPendingRuntimeOptionRefreshIfPossible (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:626 — CodexService.flushPendingRuntimeOptionRefreshIfPossible 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 · CodexService.upsertSubagentIdentity (cyclomatic 16) · ×1
  • CodexService.upsertSubagentIdentity (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:757 — CodexService.upsertSubagentIdentity 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 · CodexService.canonicalizeUniqueProvisionalTurnMappings (cyclomatic 16) · ×1
  • CodexService.canonicalizeUniqueProvisionalTurnMappings (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+History.swift:879 — CodexService.canonicalizeUniqueProvisionalTurnMappings has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.mergeStreamingSnapshotText (cyclomatic 16) · ×1
  • CodexService.mergeStreamingSnapshotText (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+History.swift:2813 — CodexService.mergeStreamingSnapshotText has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.handleErrorNotification (cyclomatic 16) · ×1
  • CodexService.handleErrorNotification (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:974 — CodexService.handleErrorNotification has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.extractTurnID (cyclomatic 16) · ×1
  • CodexService.extractTurnID (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3623 — CodexService.extractTurnID 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 · CodexService.generatedImageMergeTarget (cyclomatic 16) · ×1
  • CodexService.generatedImageMergeTarget (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4681 — CodexService.generatedImageMergeTarget has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.absorbAssistantBlockReplayCompletion (cyclomatic 16) · ×1
  • CodexService.absorbAssistantBlockReplayCompletion (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4864 — CodexService.absorbAssistantBlockReplayCompletion has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.imagePreviewAssistantCompletionIndex (cyclomatic 16) · ×1
  • CodexService.imagePreviewAssistantCompletionIndex (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:5014 — CodexService.imagePreviewAssistantCompletionIndex has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · CodexService.sendRequestWithApprovalPolicyFallback (cyclomatic 16) · ×1
  • CodexService.sendRequestWithApprovalPolicyFallback (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:158 — CodexService.sendRequestWithApprovalPolicyFallback has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.normalizeRuntimeSelectionsAfterModelsUpdate (cyclomatic 16) · ×1
  • CodexService.normalizeRuntimeSelectionsAfterModelsUpdate (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:1036 — CodexService.normalizeRuntimeSelectionsAfterModelsUpdate has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.startSyncLoop (cyclomatic 16) · ×1
  • CodexService.startSyncLoop (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:21 — CodexService.startSyncLoop has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexService.handleThreadForkResponse (cyclomatic 16) · ×1
  • CodexService.handleThreadForkResponse (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+ThreadFork.swift:118 — CodexService.handleThreadForkResponse 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 · TurnViewModel.trailingFileToken (cyclomatic 16) · ×1
  • TurnViewModel.trailingFileToken (cyclomatic 16) REDACTED:2492 — TurnViewModel.trailingFileToken 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 · UnifiedDiffParser.isMetadataLine (cyclomatic 16) · ×1
  • UnifiedDiffParser.isMetadataLine (cyclomatic 16) CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:204 — UnifiedDiffParser.isMetadataLine has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · opencode-runtime.createOpenCodeRuntime.handleClientResponse (cyclomatic 16) · ×1
  • opencode-runtime.createOpenCodeRuntime.handleClientResponse (cyclomatic 16) phodex-bridge/src/opencode-runtime.js:1357 — opencode-runtime.createOpenCodeRuntime.handleClientResponse has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktop-ipc-shared.sanitizeUserRoleItem (cyclomatic 16) · ×1
  • desktop-ipc-shared.sanitizeUserRoleItem (cyclomatic 16) REDACTED:331 — desktop-ipc-shared.sanitizeUserRoleItem has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rollout-live-mirror.toolStartNotifications (cyclomatic 16) · ×1
  • rollout-live-mirror.toolStartNotifications (cyclomatic 16) phodex-bridge/src/rollout-live-mirror.js:1392 — rollout-live-mirror.toolStartNotifications has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · desktop-ipc-conversation-projector.createDesktopConversationProjector.project (cyclomatic 16) · ×1
  • desktop-ipc-conversation-projector.createDesktopConversationProjector.project (cyclomatic 16) phodex-bridge/src/desktop-ipc-conversation-projector.js:47 — desktop-ipc-conversation-projector.createDesktopConversationProjector.project has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: desktop-ipc-conversation-projector.isSupportedItemType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · desktop-ipc-conversation-projector.diffTurnLifecycle (cyclomatic 16) · ×1
  • desktop-ipc-conversation-projector.diffTurnLifecycle (cyclomatic 16) phodex-bridge/src/desktop-ipc-conversation-projector.js:447 — desktop-ipc-conversation-projector.diffTurnLifecycle 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: desktop-ipc-conversation-projector.isSupportedItemType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · desktop-ipc-conversation-projector.diffTurnItems (cyclomatic 16) · ×1
  • desktop-ipc-conversation-projector.diffTurnItems (cyclomatic 16) phodex-bridge/src/desktop-ipc-conversation-projector.js:480 — desktop-ipc-conversation-projector.diffTurnItems 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: desktop-ipc-conversation-projector.isSupportedItemType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · desktop-ipc-conversation-projector.matchDesktopTurnIdentityContinuities (cyclomatic 16) · ×1
  • desktop-ipc-conversation-projector.matchDesktopTurnIdentityContinuities (cyclomatic 16) phodex-bridge/src/desktop-ipc-conversation-projector.js:901 — desktop-ipc-conversation-projector.matchDesktopTurnIdentityContinuities has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 4 function items inside it that branch (applyMaximumMatchesForScore::tryAssign, applyMaximumMatchesForScore, a function literal at line 906, …). 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. This is NOT this file's highest cyclomatic complexity: desktop-ipc-conversation-projector.isSupportedItemType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.handlePeerBroadcast (cyclomatic 16) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.handlePeerBroadcast (cyclomatic 16) phodex-bridge/src/desktop-ipc-live-owner.js:1288 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.handlePeerBroadcast has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: desktop-ipc-live-owner.createDesktopIpcLiveOwner.handleFollowerRequest (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · thread-row-enrichment.forEachThreadRowInResponse (cyclomatic 16) · ×1
  • thread-row-enrichment.forEachThreadRowInResponse (cyclomatic 16) phodex-bridge/src/thread-row-enrichment.js:11 — thread-row-enrichment.forEachThreadRowInResponse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · session-jsonl-history.normalizeReadableToolItemForHistory (cyclomatic 16) · ×1
  • session-jsonl-history.normalizeReadableToolItemForHistory (cyclomatic 16) phodex-bridge/src/session-jsonl-history.js:951 — session-jsonl-history.normalizeReadableToolItemForHistory has cyclomatic complexity 16 (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: session-jsonl-history.readableToolActivityMessage (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.
D1 · Cyclomatic Complexity · bridge.startBridge.maybeBuildJsonlThreadTurnsListFallback (cyclomatic 16) · ×1
  • bridge.startBridge.maybeBuildJsonlThreadTurnsListFallback (cyclomatic 16) phodex-bridge/src/bridge.js:1654 — bridge.startBridge.maybeBuildJsonlThreadTurnsListFallback has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: bridge.liveGeneratedImageThreadId (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · startBridge.maybeBuildJsonlThreadTurnsListFallback (cyclomatic 16) · ×1
  • startBridge.maybeBuildJsonlThreadTurnsListFallback (cyclomatic 16) phodex-bridge/src/bridge.js:1654 — startBridge.maybeBuildJsonlThreadTurnsListFallback has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: liveGeneratedImageThreadId (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · startBridge.rememberForwardedRequestMethod (cyclomatic 16) · ×1
  • startBridge.rememberForwardedRequestMethod (cyclomatic 16) phodex-bridge/src/bridge.js:1888 — startBridge.rememberForwardedRequestMethod 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: liveGeneratedImageThreadId (cyclomatic 17) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · createDesktopIpcActionFollower.routeExpiredHeldRequestThroughBus (cyclomatic 16) · ×1
  • createDesktopIpcActionFollower.routeExpiredHeldRequestThroughBus (cyclomatic 16) phodex-bridge/src/desktop-ipc-action-follower.js:1520 — createDesktopIpcActionFollower.routeExpiredHeldRequestThroughBus has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · desktopFollowerPayloadForResponse (cyclomatic 16) · ×1
  • desktopFollowerPayloadForResponse (cyclomatic 16) phodex-bridge/src/desktop-ipc-action-follower.js:3111 — desktopFollowerPayloadForResponse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · createDesktopConversationProjector.project (cyclomatic 16) · ×1
  • createDesktopConversationProjector.project (cyclomatic 16) phodex-bridge/src/desktop-ipc-conversation-projector.js:47 — createDesktopConversationProjector.project has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to 3 function literals 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. This is NOT this file's highest cyclomatic complexity: isSupportedItemType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · projectAutoApprovalReviewItem (cyclomatic 16) · ×1
  • projectAutoApprovalReviewItem (cyclomatic 16) phodex-bridge/src/desktop-ipc-conversation-projector.js:1105 — projectAutoApprovalReviewItem has cyclomatic complexity 16 (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: isSupportedItemType (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · createDesktopIpcLiveOwner.markThreadReadByPhone (cyclomatic 16) · ×1
  • createDesktopIpcLiveOwner.markThreadReadByPhone (cyclomatic 16) phodex-bridge/src/desktop-ipc-live-owner.js:493 — createDesktopIpcLiveOwner.markThreadReadByPhone has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: createDesktopIpcLiveOwner.handleFollowerRequest (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · createDesktopIpcLiveOwner.broadcastConversationState (cyclomatic 16) · ×1
  • createDesktopIpcLiveOwner.broadcastConversationState (cyclomatic 16) phodex-bridge/src/desktop-ipc-live-owner.js:1223 — createDesktopIpcLiveOwner.broadcastConversationState 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: createDesktopIpcLiveOwner.handleFollowerRequest (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · createDesktopIpcLiveOwner.handlePeerBroadcast (cyclomatic 16) · ×1
  • createDesktopIpcLiveOwner.handlePeerBroadcast (cyclomatic 16) phodex-bridge/src/desktop-ipc-live-owner.js:1288 — createDesktopIpcLiveOwner.handlePeerBroadcast has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: createDesktopIpcLiveOwner.handleFollowerRequest (cyclomatic 21) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · gitBranches (cyclomatic 16) · ×1
  • gitBranches (cyclomatic 16) phodex-bridge/src/git-handler.js:483 — gitBranches 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: handleGitMethod (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · gitRemoveWorktree (cyclomatic 16) · ×1
  • gitRemoveWorktree (cyclomatic 16) phodex-bridge/src/git-handler.js:912 — gitRemoveWorktree has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: handleGitMethod (cyclomatic 28) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · createOpenCodeRuntime.emitPartDelta (cyclomatic 16) · ×1
  • createOpenCodeRuntime.emitPartDelta (cyclomatic 16) phodex-bridge/src/opencode-runtime.js:753 — createOpenCodeRuntime.emitPartDelta has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · contextUsageFromTokenCountPayload (cyclomatic 16) · ×1
  • contextUsageFromTokenCountPayload (cyclomatic 16) phodex-bridge/src/rollout-watch.js:813 — contextUsageFromTokenCountPayload has cyclomatic complexity 16 (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.
D17 · Explicit Debt · TodoComment · ×1
  • TodoComment CodexMobile/CodexMobile/Views/Turn/Messages/UserMessageBubble.swift:559 — // TODO: guard against nil — 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.
D2 · Cognitive Complexity · CodexService.mergeHistoryMessages (cognitive 229) · ×1
  • CodexService.mergeHistoryMessages (cognitive 229) CodexMobile/CodexMobile/Services/CodexService+History.swift:931 — CodexService.mergeHistoryMessages has cognitive complexity 229 (threshold 15). Drivers by points: boolean chains 119, if/else 46 (107 pts), loops 2 (3 pts) (nesting depth added 62). Of this number, 227 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.upsertStreamingSystemItemMessage (cognitive 193) · ×1
  • CodexService.upsertStreamingSystemItemMessage (cognitive 193) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2692 — CodexService.upsertStreamingSystemItemMessage has cognitive complexity 193 (threshold 15). Drivers by points: if/else 56 (112 pts), boolean chains 73, loops 1 (5 pts), ternaries 3 (nesting depth added 60). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.loadThreadHistoryIfNeeded (cognitive 181) · ×1
  • CodexService.loadThreadHistoryIfNeeded (cognitive 181) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1271 — CodexService.loadThreadHistoryIfNeeded has cognitive complexity 181 (threshold 15). Drivers by points: if/else 61 (125 pts), boolean chains 44, error handling 3 (8 pts), ternaries 3 (4 pts) (nesting depth added 70). Of this number, 179 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · parseSessionJsonlTurns (cognitive 124) · ×1
  • parseSessionJsonlTurns (cognitive 124) phodex-bridge/src/session-jsonl-history.js:400 — parseSessionJsonlTurns has cognitive complexity 124 (threshold 15). Drivers by points: if/else 27 (86 pts), boolean chains 19, ternaries 3 (12 pts), loops 2 (4 pts), error handling 1 (2 pts), other 1 (nesting depth added 71). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CodexService.completeAssistantMessage (cognitive 111) · ×1
  • CodexService.completeAssistantMessage (cognitive 111) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4013 — CodexService.completeAssistantMessage has cognitive complexity 111 (threshold 15). Drivers by points: if/else 39 (70 pts), boolean chains 40, ternaries 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.reconcileExistingMessage (cognitive 106) · ×1
  • CodexService.reconcileExistingMessage (cognitive 106) CodexMobile/CodexMobile/Services/CodexService+History.swift:2008 — CodexService.reconcileExistingMessage has cognitive complexity 106 (threshold 15). Drivers by points: boolean chains 52, if/else 33 (47 pts), ternaries 3 (7 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState (cognitive 97) · ×1
  • desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState (cognitive 97) phodex-bridge/src/desktop-ipc-conversation-adapter.js:143 — desktop-ipc-conversation-adapter.applyAppServerMessageToConversationState has cognitive complexity 97 (threshold 15). Drivers by points: if/else 30 (59 pts), boolean chains 35, ternaries 1 (2 pts), match/switch 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.observeInbound (cognitive 95) · ×1
  • createDesktopIpcActionFollower.observeInbound (cognitive 95) phodex-bridge/src/desktop-ipc-action-follower.js:507 — createDesktopIpcActionFollower.observeInbound has cognitive complexity 95 (threshold 15). Drivers by points: if/else 32 (60 pts), boolean chains 17, ternaries 1 (7 pts), error handling 2 (5 pts), loops 1 (5 pts), other 1 (nesting depth added 41). Of this number, 73 points are the body's own statements and 22 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CodexService.markTurnCompleted (cognitive 91) · ×1
  • CodexService.markTurnCompleted (cognitive 91) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:5308 — CodexService.markTurnCompleted has cognitive complexity 91 (threshold 15). Drivers by points: if/else 27 (50 pts), boolean chains 27, loops 3 (7 pts), ternaries 1 (4 pts), match/switch 1 (3 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.refreshInFlightTurnState (cognitive 91) · ×1
  • CodexService.refreshInFlightTurnState (cognitive 91) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1583 — CodexService.refreshInFlightTurnState has cognitive complexity 91 (threshold 15). Drivers by points: if/else 26 (67 pts), boolean chains 18, ternaries 1 (5 pts), error handling 1 (nesting depth added 45). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.observeInbound (cognitive 87) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.observeInbound (cognitive 87) phodex-bridge/src/desktop-ipc-action-follower.js:507 — desktop-ipc-action-follower.createDesktopIpcActionFollower.observeInbound has cognitive complexity 87 (threshold 15). Drivers by points: if/else 32 (58 pts), boolean chains 17, ternaries 1 (7 pts), loops 1 (5 pts) (nesting depth added 36). Of this number, 67 points are the body's own statements and 20 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnTimelineRenderProjection.renderItems (cognitive 86) · ×1
  • TurnTimelineRenderProjection.renderItems (cognitive 86) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:226 — TurnTimelineRenderProjection.renderItems has cognitive complexity 86 (threshold 15). Drivers by points: if/else 34 (56 pts), boolean chains 29, loops 1 (nesting depth added 22). Of this number, 55 points are the body's own statements and 31 belong to 7 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rollout-live-mirror.synthesizeNotificationsFromRolloutEntry (cognitive 83) · ×1
  • rollout-live-mirror.synthesizeNotificationsFromRolloutEntry (cognitive 83) phodex-bridge/src/rollout-live-mirror.js:938 — rollout-live-mirror.synthesizeNotificationsFromRolloutEntry has cognitive complexity 83 (threshold 15). Drivers by points: if/else 33 (60 pts), boolean chains 14, ternaries 3 (9 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnFileChangeSummaryParser.parse (cognitive 82) · ×1
  • TurnFileChangeSummaryParser.parse (cognitive 82) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:73 — TurnFileChangeSummaryParser.parse has cognitive complexity 82 (threshold 15). Drivers by points: if/else 24 (62 pts), boolean chains 15, loops 2 (4 pts), ternaries 1 (nesting depth added 40). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MessageRow.assistantView (cognitive 82) · ×1
  • MessageRow.assistantView (cognitive 82) CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift:536 — MessageRow.assistantView has cognitive complexity 82 (threshold 15). Drivers by points: if/else 21 (37 pts), boolean chains 26, ternaries 13 (16 pts), match/switch 1 (3 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.decodeMessagesFromThreadRead (cognitive 81) · ×1
  • CodexService.decodeMessagesFromThreadRead (cognitive 81) CodexMobile/CodexMobile/Services/CodexService+History.swift:98 — CodexService.decodeMessagesFromThreadRead has cognitive complexity 81 (threshold 15). Drivers by points: if/else 12 (39 pts), ternaries 8 (32 pts), boolean chains 4, loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.createOpenCodeRuntime.handleRequest (cognitive 73) · ×1
  • opencode-runtime.createOpenCodeRuntime.handleRequest (cognitive 73) phodex-bridge/src/opencode-runtime.js:1228 — opencode-runtime.createOpenCodeRuntime.handleRequest has cognitive complexity 73 (threshold 15). Drivers by points: if/else 22 (37 pts), boolean chains 19, ternaries 8 (15 pts), error handling 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · refreshTouchedNormalizedActiveTurns (cognitive 73) · ×1
  • refreshTouchedNormalizedActiveTurns (cognitive 73) phodex-bridge/src/desktop-ipc-action-follower.js:3497 — refreshTouchedNormalizedActiveTurns has cognitive complexity 73 (threshold 15). Drivers by points: ternaries 12 (30 pts), if/else 10 (23 pts), boolean chains 15, loops 4 (5 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createOpenCodeRuntime.handleRequest (cognitive 73) · ×1
  • createOpenCodeRuntime.handleRequest (cognitive 73) phodex-bridge/src/opencode-runtime.js:1228 — createOpenCodeRuntime.handleRequest has cognitive complexity 73 (threshold 15). Drivers by points: if/else 22 (37 pts), boolean chains 19, ternaries 8 (15 pts), error handling 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.loadOlderThreadHistoryPage (cognitive 70) · ×1
  • CodexService.loadOlderThreadHistoryPage (cognitive 70) CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:221 — CodexService.loadOlderThreadHistoryPage has cognitive complexity 70 (threshold 15). Drivers by points: if/else 15 (46 pts), boolean chains 20, error handling 2, loops 1 (2 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.ensureThreadResumed (cognitive 70) · ×1
  • CodexService.ensureThreadResumed (cognitive 70) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1369 — CodexService.ensureThreadResumed has cognitive complexity 70 (threshold 15). Drivers by points: if/else 27 (50 pts), boolean chains 14, ternaries 3 (5 pts), error handling 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.handleTurnStarted (cognitive 68) · ×1
  • CodexService.handleTurnStarted (cognitive 68) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:710 — CodexService.handleTurnStarted has cognitive complexity 68 (threshold 15). Drivers by points: if/else 22 (40 pts), boolean chains 28 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.interruptTurn (cognitive 68) · ×1
  • CodexService.interruptTurn (cognitive 68) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:660 — CodexService.interruptTurn has cognitive complexity 68 (threshold 15). Drivers by points: if/else 15 (34 pts), error handling 6 (21 pts), boolean chains 13 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.onEnvelope (cognitive 64) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.onEnvelope (cognitive 64) phodex-bridge/src/desktop-ipc-action-follower.js:762 — desktop-ipc-action-follower.createDesktopIpcActionFollower.onEnvelope has cognitive complexity 64 (threshold 15). Drivers by points: if/else 27 (42 pts), boolean chains 19, loops 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.onEnvelope (cognitive 64) · ×1
  • createDesktopIpcActionFollower.onEnvelope (cognitive 64) phodex-bridge/src/desktop-ipc-action-follower.js:762 — createDesktopIpcActionFollower.onEnvelope has cognitive complexity 64 (threshold 15). Drivers by points: if/else 27 (42 pts), boolean chains 19, loops 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.startThreadImpl (cognitive 61) · ×1
  • CodexService.startThreadImpl (cognitive 61) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:162 — CodexService.startThreadImpl has cognitive complexity 61 (threshold 15). Drivers by points: if/else 18 (39 pts), boolean chains 13, ternaries 4 (6 pts), error handling 1 (2 pts), loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.applyCanonicalHistoryOrder (cognitive 60) · ×1
  • CodexService.applyCanonicalHistoryOrder (cognitive 60) CodexMobile/CodexMobile/Services/CodexService+History.swift:1433 — CodexService.applyCanonicalHistoryOrder has cognitive complexity 60 (threshold 15). Drivers by points: if/else 23 (36 pts), loops 12 (16 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 18). Of this number, 57 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssistantMemoryCitationParser.visibleText (cognitive 60) · ×1
  • AssistantMemoryCitationParser.visibleText (cognitive 60) CodexMobile/CodexMobile/Views/Turn/Messages/AssistantMemoryCitationParser.swift:9 — AssistantMemoryCitationParser.visibleText has cognitive complexity 60 (threshold 15). Drivers by points: if/else 19 (48 pts), boolean chains 10, loops 2 (nesting depth added 29). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · CodexService.repairCanonicalAssistantSourceIdentityRotations (cognitive 59) · ×1
  • CodexService.repairCanonicalAssistantSourceIdentityRotations (cognitive 59) CodexMobile/CodexMobile/Services/CodexService+History.swift:1700 — CodexService.repairCanonicalAssistantSourceIdentityRotations has cognitive complexity 59 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 20, loops 6 (9 pts), ternaries 2 (4 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · phodex-backend-relay.setupRelay (cognitive 59) · ×1
  • phodex-backend-relay.setupRelay (cognitive 59) relay/phodex-backend-relay.mjs:41 — phodex-backend-relay.setupRelay has cognitive complexity 59 (threshold 15). Drivers by points: if/else 22 (40 pts), loops 5 (10 pts), boolean chains 8, ternaries 1 (nesting depth added 23). None of this is in the body itself: all 59 points belong to 4 function literals inside it that branch (lines 55, 159, 141, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CodexService.steerTurn (cognitive 58) · ×1
  • CodexService.steerTurn (cognitive 58) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2073 — CodexService.steerTurn has cognitive complexity 58 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 13, error handling 3 (8 pts), ternaries 3 (5 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.resolvedSubagentPresentation (cognitive 56) · ×1
  • CodexService.resolvedSubagentPresentation (cognitive 56) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:813 — CodexService.resolvedSubagentPresentation has cognitive complexity 56 (threshold 15). Drivers by points: if/else 21 (49 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 31). Of this number, 45 points are the body's own statements and 11 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.handleStructuredItemLifecycle (cognitive 55) · ×1
  • CodexService.handleStructuredItemLifecycle (cognitive 55) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2409 — CodexService.handleStructuredItemLifecycle has cognitive complexity 55 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 21, ternaries 3 (6 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.sendTurnStart (cognitive 55) · ×1
  • CodexService.sendTurnStart (cognitive 55) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1745 — CodexService.sendTurnStart has cognitive complexity 55 (threshold 15). Drivers by points: if/else 14 (32 pts), boolean chains 12, ternaries 4 (8 pts), error handling 1 (2 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mergeRelayHistoryItemsWithJsonlItems (cognitive 53) · ×1
  • mergeRelayHistoryItemsWithJsonlItems (cognitive 53) phodex-bridge/src/bridge.js:4018 — mergeRelayHistoryItemsWithJsonlItems has cognitive complexity 53 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 12, ternaries 2 (4 pts), loops 2 (nesting depth added 18). Of this number, 43 points are the body's own statements and 10 belong to 6 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createNormalizedLiveIndex (cognitive 53) · ×1
  • createNormalizedLiveIndex (cognitive 53) phodex-bridge/src/desktop-ipc-action-follower.js:3372 — createNormalizedLiveIndex has cognitive complexity 53 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 8 (12 pts), ternaries 5 (11 pts), boolean chains 7, other 2 (nesting depth added 20). Of this number, 49 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.startRuntimeSettingsUpdate (cognitive 52) · ×1
  • CodexService.startRuntimeSettingsUpdate (cognitive 52) CodexMobile/CodexMobile/Services/CodexService+RuntimeSettingsSync.swift:146 — CodexService.startRuntimeSettingsUpdate has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 15, loops 2 (5 pts), error handling 1 (2 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnView.body (cognitive 50) · ×1
  • TurnView.body (cognitive 50) CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:75 — TurnView.body has cognitive complexity 50 (threshold 15). Drivers by points: if/else 26, boolean chains 13, ternaries 10, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · createDesktopIpcLiveOwner.observeOutbound (cognitive 50) · ×1
  • createDesktopIpcLiveOwner.observeOutbound (cognitive 50) phodex-bridge/src/desktop-ipc-live-owner.js:327 — createDesktopIpcLiveOwner.observeOutbound has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 14, ternaries 2 (3 pts), other 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound (cognitive 49) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound (cognitive 49) phodex-bridge/src/desktop-ipc-live-owner.js:327 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound has cognitive complexity 49 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 14, ternaries 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · remodex-jsonl-diagnose.diagnoseSessionJsonl (cognitive 49) · ×1
  • remodex-jsonl-diagnose.diagnoseSessionJsonl (cognitive 49) phodex-bridge/bin/remodex-jsonl-diagnose.js:72 — remodex-jsonl-diagnose.diagnoseSessionJsonl has cognitive complexity 49 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 12, loops 3 (7 pts), ternaries 4 (5 pts), error handling 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.createOpenCodeRuntime.readDescendingTurnPage (cognitive 48) · ×1
  • opencode-runtime.createOpenCodeRuntime.readDescendingTurnPage (cognitive 48) phodex-bridge/src/opencode-runtime.js:1177 — opencode-runtime.createOpenCodeRuntime.readDescendingTurnPage has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 12, ternaries 2 (6 pts), error handling 1 (2 pts), loops 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · relay.setupRelay (cognitive 48) · ×1
  • relay.setupRelay (cognitive 48) relay/relay.js:63 — relay.setupRelay has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (32 pts), boolean chains 10, loops 3 (5 pts), ternaries 1 (nesting depth added 13). None of this is in the body itself: all 48 points belong to 4 function literals inside it that branch (lines 90, 175, 200, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · createOpenCodeRuntime.readDescendingTurnPage (cognitive 48) · ×1
  • createOpenCodeRuntime.readDescendingTurnPage (cognitive 48) phodex-bridge/src/opencode-runtime.js:1177 — createOpenCodeRuntime.readDescendingTurnPage has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 12, ternaries 2 (6 pts), error handling 1 (2 pts), loops 1 (nesting depth added 22). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · bootstrapFromExistingRollout (cognitive 48) · ×1
  • bootstrapFromExistingRollout (cognitive 48) phodex-bridge/src/rollout-live-mirror.js:435 — bootstrapFromExistingRollout has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (31 pts), boolean chains 11, ternaries 2 (4 pts), loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.handleTurnCompleted (cognitive 47) · ×1
  • CodexService.handleTurnCompleted (cognitive 47) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:837 — CodexService.handleTurnCompleted has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 11, ternaries 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bridge.startBridge (cognitive 46) · ×1
  • bridge.startBridge (cognitive 46) phodex-bridge/src/bridge.js:714 — bridge.startBridge has cognitive complexity 46 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 14, ternaries 7, error handling 1 (nesting depth added 4). Of this number, 25 points are the body's own statements and 21 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CodexService.handleNotification (cognitive 45) · ×1
  • CodexService.handleNotification (cognitive 45) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:177 — CodexService.handleNotification has cognitive complexity 45 (threshold 15). Drivers by points: if/else 23 (34 pts), boolean chains 7, match/switch 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.
D2 · Cognitive Complexity · CommandHumanizer.extractSearchPatternAndPath (cognitive 45) · ×1
  • CommandHumanizer.extractSearchPatternAndPath (cognitive 45) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:864 — CommandHumanizer.extractSearchPatternAndPath has cognitive complexity 45 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 5 (10 pts), boolean chains 9, ternaries 1 (3 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamingInlineMarkupAutoCloser.scanInlineMarkers (cognitive 45) · ×1
  • StreamingInlineMarkupAutoCloser.scanInlineMarkers (cognitive 45) CodexMobile/CodexMobile/Views/Turn/Messages/StreamingInlineMarkupAutoCloser.swift:91 — StreamingInlineMarkupAutoCloser.scanInlineMarkers has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (40 pts), boolean chains 4, loops 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnTimelineReducer.removeDuplicateAssistantMessages (cognitive 44) · ×1
  • TurnTimelineReducer.removeDuplicateAssistantMessages (cognitive 44) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:967 — TurnTimelineReducer.removeDuplicateAssistantMessages has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (38 pts), boolean chains 5, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.scheduleCanonicalHistoryReconcileIfNeeded (cognitive 43) · ×1
  • CodexService.scheduleCanonicalHistoryReconcileIfNeeded (cognitive 43) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:640 — CodexService.scheduleCanonicalHistoryReconcileIfNeeded has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 22, if/else 12 (19 pts), error handling 2 (nesting depth added 7). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · rollout-live-mirror.inspectBootstrapRunBoundary (cognitive 43) · ×1
  • rollout-live-mirror.inspectBootstrapRunBoundary (cognitive 43) phodex-bridge/src/rollout-live-mirror.js:671 — rollout-live-mirror.inspectBootstrapRunBoundary has cognitive complexity 43 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 14, ternaries 2 (4 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-action-follower.applyImmerPatchCopyOnWrite (cognitive 43) · ×1
  • desktop-ipc-action-follower.applyImmerPatchCopyOnWrite (cognitive 43) phodex-bridge/src/desktop-ipc-action-follower.js:4166 — desktop-ipc-action-follower.applyImmerPatchCopyOnWrite has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (31 pts), boolean chains 10, loops 1, ternaries 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · synchronizeDesktopConversationCompatibility (cognitive 43) · ×1
  • synchronizeDesktopConversationCompatibility (cognitive 43) phodex-bridge/src/desktop-ipc-conversation-adapter.js:619 — synchronizeDesktopConversationCompatibility has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 14, ternaries 9 (13 pts), other 11, if/else 3 (4 pts), loops 1 (nesting depth added 5). Of this number, 42 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createOpenCodeRuntime.watchTurn · ×1
  • createOpenCodeRuntime.watchTurn::poll (cognitive 43) phodex-bridge/src/opencode-runtime.js:588 — createOpenCodeRuntime.watchTurn::poll has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 19, if/else 9 (11 pts), ternaries 4 (9 pts), loops 2 (3 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.appendConfirmedMirroredUserMessage (cognitive 41) · ×1
  • CodexService.appendConfirmedMirroredUserMessage (cognitive 41) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1754 — CodexService.appendConfirmedMirroredUserMessage has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 14 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnViewModel.confirmGitSyncAlertAction (cognitive 41) · ×1
  • TurnViewModel.confirmGitSyncAlertAction (cognitive 41) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:663 — TurnViewModel.confirmGitSyncAlertAction has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 11, error handling 3 (6 pts), match/switch 1 (nesting depth added 16). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TurnViewModel.triggerGitAction (cognitive 41) · ×1
  • TurnViewModel.triggerGitAction (cognitive 41) REDACTED:3211 — TurnViewModel.triggerGitAction has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (30 pts), match/switch 2 (4 pts), ternaries 1 (4 pts), error handling 2, boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnTimelineReducer.enforceIntraTurnOrder (cognitive 41) · ×1
  • TurnTimelineReducer.enforceIntraTurnOrder (cognitive 41) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:58 — TurnTimelineReducer.enforceIntraTurnOrder has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 9, loops 3 (4 pts), ternaries 1 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetchAdaptiveThreadTurnsListForRelay (cognitive 41) · ×1
  • fetchAdaptiveThreadTurnsListForRelay (cognitive 41) phodex-bridge/src/bridge.js:2929 — fetchAdaptiveThreadTurnsListForRelay has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 4, error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.createOpenCodeRuntime.watchTurn · ×1
  • opencode-runtime.createOpenCodeRuntime.watchTurn::poll (cognitive 40) phodex-bridge/src/opencode-runtime.js:588 — opencode-runtime.createOpenCodeRuntime.watchTurn::poll has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 18, if/else 9 (11 pts), ternaries 3 (7 pts), loops 2 (3 pts), error handling 1 (nesting depth added 7). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · TurnViewModel.onInputChangedForSkillAutocomplete (cognitive 39) · ×1
  • TurnViewModel.onInputChangedForSkillAutocomplete (cognitive 39) REDACTED:926 — TurnViewModel.onInputChangedForSkillAutocomplete has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 5, error handling 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · push-notification-tracker.createPushNotificationTracker.handleOutbound (cognitive 39) · ×1
  • push-notification-tracker.createPushNotificationTracker.handleOutbound (cognitive 39) phodex-bridge/src/push-notification-tracker.js:59 — push-notification-tracker.createPushNotificationTracker.handleOutbound has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 11, ternaries 1 (nesting depth added 13). Of this number, 22 points are the body's own statements and 17 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backgroundHistoryTurns (cognitive 39) · ×1
  • backgroundHistoryTurns (cognitive 39) phodex-bridge/src/desktop-ipc-action-follower.js:3899 — backgroundHistoryTurns has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 14, if/else 6 (8 pts), ternaries 5 (8 pts), loops 5 (7 pts), other 2 (nesting depth added 7). Of this number, 28 points are the body's own statements and 11 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createPushNotificationTracker.handleOutbound (cognitive 39) · ×1
  • createPushNotificationTracker.handleOutbound (cognitive 39) phodex-bridge/src/push-notification-tracker.js:59 — createPushNotificationTracker.handleOutbound has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (27 pts), boolean chains 11, ternaries 1 (nesting depth added 13). Of this number, 22 points are the body's own statements and 17 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createThreadRolloutLiveMirror.tick (cognitive 39) · ×1
  • createThreadRolloutLiveMirror.tick (cognitive 39) phodex-bridge/src/rollout-live-mirror.js:201 — createThreadRolloutLiveMirror.tick has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (27 pts), loops 2 (4 pts), ternaries 2 (4 pts), boolean chains 3, error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.ensureStreamingAssistantMessage (cognitive 38) · ×1
  • CodexService.ensureStreamingAssistantMessage (cognitive 38) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6631 — CodexService.ensureStreamingAssistantMessage has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (29 pts), boolean chains 9 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TurnComposerHostView.body (cognitive 38) · ×1
  • TurnComposerHostView.body (cognitive 38) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerHostView.swift:62 — TurnComposerHostView.body has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 22, ternaries 8, if/else 6, match/switch 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · rollout-live-mirror.createThreadRolloutLiveMirror.tick (cognitive 37) · ×1
  • rollout-live-mirror.createThreadRolloutLiveMirror.tick (cognitive 37) phodex-bridge/src/rollout-live-mirror.js:201 — rollout-live-mirror.createThreadRolloutLiveMirror.tick has cognitive complexity 37 (threshold 15). Drivers by points: if/else 19 (27 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (2 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · remodex.main (cognitive 37) · ×1
  • remodex.main (cognitive 37) phodex-bridge/bin/remodex.js:67 — remodex.main has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (22 pts), boolean chains 9, error handling 3 (6 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CodexService.handleLegacyCommandExecutionEvent (cognitive 36) · ×1
  • CodexService.handleLegacyCommandExecutionEvent (cognitive 36) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1987 — CodexService.handleLegacyCommandExecutionEvent has cognitive complexity 36 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 10 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContentViewModel.attemptAutoReconnectOnForegroundIfNeeded (cognitive 36) · ×1
  • ContentViewModel.attemptAutoReconnectOnForegroundIfNeeded (cognitive 36) CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:203 — ContentViewModel.attemptAutoReconnectOnForegroundIfNeeded has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 4, error handling 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContentViewModel.connectWithAutoRecovery (cognitive 36) · ×1
  • ContentViewModel.connectWithAutoRecovery (cognitive 36) CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:356 — ContentViewModel.connectWithAutoRecovery has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (28 pts), boolean chains 4, error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnTimelineView.assistantBlockInfo (cognitive 36) · ×1
  • TurnTimelineView.assistantBlockInfo (cognitive 36) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:17 — TurnTimelineView.assistantBlockInfo has cognitive complexity 36 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 11, loops 3 (5 pts), ternaries 2 (4 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · startBridge.handleApplicationMessage (cognitive 35) · ×1
  • startBridge.handleApplicationMessage (cognitive 35) phodex-bridge/src/bridge.js:1281 — startBridge.handleApplicationMessage has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21 (26 pts), boolean chains 5, error handling 2 (4 pts) (nesting depth added 7). Of this number, 29 points are the body's own statements and 6 belong to 6 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · trimThreadPayloadForRelay (cognitive 35) · ×1
  • trimThreadPayloadForRelay (cognitive 35) phodex-bridge/src/bridge.js:4915 — trimThreadPayloadForRelay has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, ternaries 3 (6 pts), other 5, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AIUnifiedPatchParser.analyzeChunk (cognitive 34) · ×1
  • AIUnifiedPatchParser.analyzeChunk (cognitive 34) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:422 — AIUnifiedPatchParser.analyzeChunk has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 20, if/else 8 (11 pts), ternaries 2, loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.loadMacScopedDefaultsState (cognitive 34) · ×1
  • CodexService.loadMacScopedDefaultsState (cognitive 34) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:124 — CodexService.loadMacScopedDefaultsState has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21, boolean chains 11, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · git-handler.assertWorktreeHasNoBoundChats (cognitive 34) · ×1
  • git-handler.assertWorktreeHasNoBoundChats (cognitive 34) phodex-bridge/src/git-handler.js:2270 — git-handler.assertWorktreeHasNoBoundChats has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 5, error handling 2 (4 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.appendSystemMessage (cognitive 33) · ×1
  • CodexService.appendSystemMessage (cognitive 33) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1939 — CodexService.appendSystemMessage has cognitive complexity 33 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 14 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · git-handler.gitRunStackedAction (cognitive 33) · ×1
  • git-handler.gitRunStackedAction (cognitive 33) phodex-bridge/src/git-handler.js:1036 — git-handler.gitRunStackedAction has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 13, ternaries 3 (nesting depth added 4). Of this number, 31 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · desktop-ipc-state-patches.applyPatchToBaselineNode (cognitive 33) · ×1
  • desktop-ipc-state-patches.applyPatchToBaselineNode (cognitive 33) phodex-bridge/src/desktop-ipc-state-patches.js:146 — desktop-ipc-state-patches.applyPatchToBaselineNode has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 9, loops 1, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · searchDirectoryEntries (cognitive 33) · ×1
  • searchDirectoryEntries (cognitive 33) phodex-bridge/src/project-handler.js:356 — searchDirectoryEntries has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (21 pts), boolean chains 6, loops 2 (3 pts), error handling 1 (2 pts), other 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.extractIncomingMessageText (cognitive 32) · ×1
  • CodexService.extractIncomingMessageText (cognitive 32) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3785 — CodexService.extractIncomingMessageText has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 10, ternaries 1 (3 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-conversation-projector.diffTurnItems (cognitive 32) · ×1
  • desktop-ipc-conversation-projector.diffTurnItems (cognitive 32) phodex-bridge/src/desktop-ipc-conversation-projector.js:480 — desktop-ipc-conversation-projector.diffTurnItems has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildConversationStateFromThread (cognitive 32) · ×1
  • buildConversationStateFromThread (cognitive 32) phodex-bridge/src/desktop-ipc-conversation-adapter.js:445 — buildConversationStateFromThread has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 29, other 2, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · createPushNotificationServiceClient.postJSON (cognitive 32) · ×1
  • createPushNotificationServiceClient.postJSON (cognitive 32) phodex-bridge/src/push-notification-service-client.js:63 — createPushNotificationServiceClient.postJSON has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (2 pts), loops 1, other 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.deliverAsyncUserInput (cognitive 31) · ×1
  • CodexService.deliverAsyncUserInput (cognitive 31) CodexMobile/CodexMobile/Services/CodexService+AsyncUserInput.swift:71 — CodexService.deliverAsyncUserInput has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 9, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnViewModel.onInputChangedForPluginAutocomplete (cognitive 31) · ×1
  • TurnViewModel.onInputChangedForPluginAutocomplete (cognitive 31) REDACTED:1059 — TurnViewModel.onInputChangedForPluginAutocomplete has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 5, error handling 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · push-notification-service-client.createPushNotificationServiceClient.postJSON (cognitive 31) · ×1
  • push-notification-service-client.createPushNotificationServiceClient.postJSON (cognitive 31) phodex-bridge/src/push-notification-service-client.js:63 — push-notification-service-client.createPushNotificationServiceClient.postJSON has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, ternaries 2 (4 pts), error handling 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.tryServeDesktopOwnedRead (cognitive 31) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.tryServeDesktopOwnedRead (cognitive 31) phodex-bridge/src/desktop-ipc-action-follower.js:1654 — desktop-ipc-action-follower.createDesktopIpcActionFollower.tryServeDesktopOwnedRead has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 7 (13 pts), boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.observeThreadListResponse (cognitive 31) · ×1
  • createDesktopIpcActionFollower.observeThreadListResponse (cognitive 31) phodex-bridge/src/desktop-ipc-action-follower.js:366 — createDesktopIpcActionFollower.observeThreadListResponse has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 9, loops 3 (4 pts), ternaries 2 (nesting depth added 9). Of this number, 30 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RawFileChangeDiffSectionParser.parse (cognitive 30) · ×1
  • RawFileChangeDiffSectionParser.parse (cognitive 30) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:244 — RawFileChangeDiffSectionParser.parse has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (19 pts), ternaries 2 (6 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkspaceRunestoneTheme.textColor (cognitive 30) · ×1
  • WorkspaceRunestoneTheme.textColor (cognitive 30) CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:1185 — WorkspaceRunestoneTheme.textColor has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 9, boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnTimelineReducer.anchorLateFileChangesToOwningTurn (cognitive 30) · ×1
  • TurnTimelineReducer.anchorLateFileChangesToOwningTurn (cognitive 30) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:257 — TurnTimelineReducer.anchorLateFileChangesToOwningTurn has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 11, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.createOpenCodeRuntime.emitItem (cognitive 30) · ×1
  • opencode-runtime.createOpenCodeRuntime.emitItem (cognitive 30) phodex-bridge/src/opencode-runtime.js:649 — opencode-runtime.createOpenCodeRuntime.emitItem has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 15, if/else 10 (11 pts), ternaries 2 (4 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.observeThreadListResponse (cognitive 30) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.observeThreadListResponse (cognitive 30) phodex-bridge/src/desktop-ipc-action-follower.js:366 — desktop-ipc-action-follower.createDesktopIpcActionFollower.observeThreadListResponse has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 9, loops 3 (4 pts), ternaries 1 (nesting depth added 9). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalizeRelayBoundJsonRpcMessage (cognitive 30) · ×1
  • normalizeRelayBoundJsonRpcMessage (cognitive 30) phodex-bridge/src/bridge.js:3474 — normalizeRelayBoundJsonRpcMessage has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 12, other 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mergeOpenCodeThreadsIntoListResponse (cognitive 30) · ×1
  • mergeOpenCodeThreadsIntoListResponse (cognitive 30) phodex-bridge/src/bridge.js:5395 — mergeOpenCodeThreadsIntoListResponse has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 5, other 3, loops 1 (nesting depth added 3). Of this number, 22 points are the body's own statements and 8 belong to 5 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.tryServeDesktopOwnedRead (cognitive 30) · ×1
  • createDesktopIpcActionFollower.tryServeDesktopOwnedRead (cognitive 30) phodex-bridge/src/desktop-ipc-action-follower.js:1654 — createDesktopIpcActionFollower.tryServeDesktopOwnedRead has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (13 pts), ternaries 7 (12 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.submitDesktopFollowerRequest (cognitive 30) · ×1
  • createDesktopIpcActionFollower.submitDesktopFollowerRequest (cognitive 30) phodex-bridge/src/desktop-ipc-action-follower.js:2430 — createDesktopIpcActionFollower.submitDesktopFollowerRequest has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 10, ternaries 2 (4 pts), error handling 2 (3 pts) (nesting depth added 7). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 2494, 2468, 2438). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · createDesktopIpcLiveOwner.observeInbound (cognitive 30) · ×1
  • createDesktopIpcLiveOwner.observeInbound (cognitive 30) phodex-bridge/src/desktop-ipc-live-owner.js:243 — createDesktopIpcLiveOwner.observeInbound has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 3, other 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createOpenCodeRuntime.emitItem (cognitive 30) · ×1
  • createOpenCodeRuntime.emitItem (cognitive 30) phodex-bridge/src/opencode-runtime.js:649 — createOpenCodeRuntime.emitItem has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 15, if/else 10 (11 pts), ternaries 2 (4 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexAutoApprovalReview.coreFileSystemPermissions (cognitive 29) · ×1
  • CodexAutoApprovalReview.coreFileSystemPermissions (cognitive 29) CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift:318 — CodexAutoApprovalReview.coreFileSystemPermissions has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.makeTurnInputPayload (cognitive 29) · ×1
  • CodexService.makeTurnInputPayload (cognitive 29) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2445 — CodexService.makeTurnInputPayload has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.shouldDisableTurnPagination (cognitive 29) · ×1
  • CodexService.shouldDisableTurnPagination (cognitive 29) CodexMobile/CodexMobile/Services/CodexService+TurnPaginationCompatibility.swift:28 — CodexService.shouldDisableTurnPagination has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 22, if/else 4 (6 pts), match/switch 1 (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.
D2 · Cognitive Complexity · RemodexNativeSSHTerminal.open (cognitive 29) · ×1
  • RemodexNativeSSHTerminal.open (cognitive 29) CodexMobile/CodexMobile/Services/Terminal/RemodexNativeSSHTerminal.swift:143 — RemodexNativeSSHTerminal.open has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, match/switch 1 (3 pts), loops 1 (2 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnComposerView.composerStack (cognitive 29) · ×1
  • TurnComposerView.composerStack (cognitive 29) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift:220 — TurnComposerView.composerStack has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 12 (16 pts), if/else 9 (10 pts), boolean chains 3 (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.
D2 · Cognitive Complexity · UnifiedDiffParser.parse (cognitive 29) · ×1
  • UnifiedDiffParser.parse (cognitive 29) CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:73 — UnifiedDiffParser.parse has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (23 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 11). Of this number, 26 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · git-handler.createWorktreeAtManagedPath (cognitive 29) · ×1
  • git-handler.createWorktreeAtManagedPath (cognitive 29) phodex-bridge/src/git-handler.js:689 — git-handler.createWorktreeAtManagedPath has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (21 pts), error handling 2 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · apply-patch-changes.parseApplyPatchChanges (cognitive 29) · ×1
  • apply-patch-changes.parseApplyPatchChanges (cognitive 29) phodex-bridge/src/apply-patch-changes.js:31 — apply-patch-changes.parseApplyPatchChanges has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 6, loops 1 (nesting depth added 10). Of this number, 25 points are the body's own statements and 4 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeInbound (cognitive 29) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeInbound (cognitive 29) phodex-bridge/src/desktop-ipc-live-owner.js:243 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeInbound has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bridge.startBridge.handleApplicationMessage (cognitive 29) · ×1
  • bridge.startBridge.handleApplicationMessage (cognitive 29) phodex-bridge/src/bridge.js:1281 — bridge.startBridge.handleApplicationMessage has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21 (25 pts), boolean chains 4 (nesting depth added 4). Of this number, 24 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · projectTurn (cognitive 29) · ×1
  • projectTurn (cognitive 29) phodex-bridge/src/desktop-ipc-conversation-projector.js:262 — projectTurn has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 6, other 4, ternaries 2 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reasoningVariants (cognitive 29) · ×1
  • reasoningVariants (cognitive 29) phodex-bridge/src/opencode-runtime.js:200 — reasoningVariants has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 7, ternaries 2 (5 pts), loops 2 (3 pts), other 1 (nesting depth added 10). Of this number, 20 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexAsyncUserInputProjection.reopenRepliesMissingFromCanonicalHistory (cognitive 28) · ×1
  • CodexAsyncUserInputProjection.reopenRepliesMissingFromCanonicalHistory (cognitive 28) CodexMobile/CodexMobile/Models/CodexAsyncUserInputProjection.swift:84 — CodexAsyncUserInputProjection.reopenRepliesMissingFromCanonicalHistory has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, ternaries 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexAutoApprovalReview.coreActionValue (cognitive 28) · ×1
  • CodexAutoApprovalReview.coreActionValue (cognitive 28) CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift:213 — CodexAutoApprovalReview.coreActionValue has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 13, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.extractItemID (cognitive 28) · ×1
  • CodexService.extractItemID (cognitive 28) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2714 — CodexService.extractItemID has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 14. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.appendCompletedAgentText (cognitive 28) · ×1
  • CodexService.appendCompletedAgentText (cognitive 28) CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift:104 — CodexService.appendCompletedAgentText has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 6, ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CodexService.reconcileLocalThreadsWithServer (cognitive 28) · ×1
  • CodexService.reconcileLocalThreadsWithServer (cognitive 28) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:222 — CodexService.reconcileLocalThreadsWithServer has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 3, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GPTVoiceTranscriptionManager.startRecording (cognitive 28) · ×1
  • GPTVoiceTranscriptionManager.startRecording (cognitive 28) CodexMobile/CodexMobile/Services/GPTVoiceTranscriptionManager.swift:106 — GPTVoiceTranscriptionManager.startRecording has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 6, error handling 2, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileChangeSummaryBox.body (cognitive 28) · ×1
  • FileChangeSummaryBox.body (cognitive 28) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryViews.swift:82 — FileChangeSummaryBox.body has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 3 (12 pts), boolean chains 2, match/switch 1 (nesting depth added 16). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · PerFileDiffParser.singleChunkFallback (cognitive 28) · ×1
  • PerFileDiffParser.singleChunkFallback (cognitive 28) CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:120 — PerFileDiffParser.singleChunkFallback has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 2 (4 pts), ternaries 1 (4 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnTimelineReducer.hasInterleavedAssistantActivityFlow (cognitive 28) · ×1
  • TurnTimelineReducer.hasInterleavedAssistantActivityFlow (cognitive 28) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:171 — TurnTimelineReducer.hasInterleavedAssistantActivityFlow has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 7, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.createOpenCodeRuntime.processEvent (cognitive 28) · ×1
  • opencode-runtime.createOpenCodeRuntime.processEvent (cognitive 28) phodex-bridge/src/opencode-runtime.js:865 — opencode-runtime.createOpenCodeRuntime.processEvent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 6, ternaries 1 (4 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-conversation-adapter.applyDeltaNotification (cognitive 28) · ×1
  • desktop-ipc-conversation-adapter.applyDeltaNotification (cognitive 28) phodex-bridge/src/desktop-ipc-conversation-adapter.js:1245 — desktop-ipc-conversation-adapter.applyDeltaNotification has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (10 pts), ternaries 3 (7 pts) (nesting depth added 5). Of this number, 27 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · runPendingRefresh (cognitive 28) · ×1
  • runPendingRefresh (cognitive 28) phodex-bridge/src/codex-desktop-refresher.js:300 — runPendingRefresh has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 7, ternaries 6 (7 pts), error handling 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · createDesktopIpcLiveOwner.runNextQueuedFollowUp (cognitive 28) · ×1
  • createDesktopIpcLiveOwner.runNextQueuedFollowUp (cognitive 28) phodex-bridge/src/desktop-ipc-live-owner.js:1776 — createDesktopIpcLiveOwner.runNextQueuedFollowUp has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 11, other 2, error handling 1, ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 3 of the 28 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 1783, a function literal at line 1821, (anonymous)::canRun, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · createOpenCodeRuntime.processEvent (cognitive 28) · ×1
  • createOpenCodeRuntime.processEvent (cognitive 28) phodex-bridge/src/opencode-runtime.js:865 — createOpenCodeRuntime.processEvent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 6, ternaries 1 (4 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContentView.mainContent (cognitive 27) · ×1
  • ContentView.mainContent (cognitive 27) CodexMobile/CodexMobile/ContentView.swift:799 — ContentView.mainContent has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.extractThreadID (cognitive 27) · ×1
  • CodexService.extractThreadID (cognitive 27) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3587 — CodexService.extractThreadID has cognitive complexity 27 (threshold 15). Drivers by points: if/else 27. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodexService.continueAfterStreamFailure (cognitive 27) · ×1
  • CodexService.continueAfterStreamFailure (cognitive 27) CodexMobile/CodexMobile/Services/CodexService+StreamRecovery.swift:51 — CodexService.continueAfterStreamFailure has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 9, error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.startTurn (cognitive 27) · ×1
  • CodexService.startTurn (cognitive 27) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:359 — CodexService.startTurn has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 6, ternaries 3 (5 pts), error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnDiffLineKind.detectVerifiedPatch (cognitive 27) · ×1
  • TurnDiffLineKind.detectVerifiedPatch (cognitive 27) CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffRenderer.swift:27 — TurnDiffLineKind.detectVerifiedPatch has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 15, if/else 7 (11 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · rollout-watch.findRecentRolloutFileForContextRead (cognitive 27) · ×1
  • rollout-watch.findRecentRolloutFileForContextRead (cognitive 27) phodex-bridge/src/rollout-watch.js:347 — rollout-watch.findRecentRolloutFileForContextRead has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.partsFromInput (cognitive 27) · ×1
  • opencode-runtime.partsFromInput (cognitive 27) phodex-bridge/src/opencode-runtime.js:93 — opencode-runtime.partsFromInput has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 6, ternaries 2 (4 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.createOpenCodeRuntime.handleClientResponse (cognitive 27) · ×1
  • opencode-runtime.createOpenCodeRuntime.handleClientResponse (cognitive 27) phodex-bridge/src/opencode-runtime.js:1357 — opencode-runtime.createOpenCodeRuntime.handleClientResponse has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (17 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 12). Of this number, 19 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · desktop-ipc-conversation-adapter.normalizeTurnInitialPrompt (cognitive 27) · ×1
  • desktop-ipc-conversation-adapter.normalizeTurnInitialPrompt (cognitive 27) phodex-bridge/src/desktop-ipc-conversation-adapter.js:1033 — desktop-ipc-conversation-adapter.normalizeTurnInitialPrompt has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-action-follower.normalizedLiveIndexNeedsRebuild (cognitive 27) · ×1
  • desktop-ipc-action-follower.normalizedLiveIndexNeedsRebuild (cognitive 27) phodex-bridge/src/desktop-ipc-action-follower.js:3466 — desktop-ipc-action-follower.normalizedLiveIndexNeedsRebuild has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, ternaries 2 (4 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createOpenCodeRuntime.handleClientResponse (cognitive 27) · ×1
  • createOpenCodeRuntime.handleClientResponse (cognitive 27) phodex-bridge/src/opencode-runtime.js:1357 — createOpenCodeRuntime.handleClientResponse has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 6 (14 pts), if/else 5 (6 pts), boolean chains 4, other 3 (nesting depth added 9). Of this number, 20 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.decodeItemText (cognitive 26) · ×1
  • CodexService.decodeItemText (cognitive 26) CodexMobile/CodexMobile/Services/CodexService+History.swift:490 — CodexService.decodeItemText has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 7, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.handleErrorNotification (cognitive 26) · ×1
  • CodexService.handleErrorNotification (cognitive 26) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:974 — CodexService.handleErrorNotification has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (17 pts), ternaries 2 (5 pts), boolean chains 4 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.isFileChangeSnapshotPayload (cognitive 26) · ×1
  • CodexService.isFileChangeSnapshotPayload (cognitive 26) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3259 — CodexService.isFileChangeSnapshotPayload has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 9, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.pruneDuplicateSystemRows (cognitive 26) · ×1
  • CodexService.pruneDuplicateSystemRows (cognitive 26) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3399 — CodexService.pruneDuplicateSystemRows has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 10 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SidebarActivityDiffStore.refresh (cognitive 26) · ×1
  • SidebarActivityDiffStore.refresh (cognitive 26) CodexMobile/CodexMobile/Services/SidebarActivityDiffStore.swift:18 — SidebarActivityDiffStore.refresh has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (10 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ContentViewModel.switchToTrustedMac (cognitive 26) · ×1
  • ContentViewModel.switchToTrustedMac (cognitive 26) CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:759 — ContentViewModel.switchToTrustedMac has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 3, ternaries 1 (3 pts), error handling 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session-jsonl-history.readRecentSessionJsonlTurns (cognitive 26) · ×1
  • session-jsonl-history.readRecentSessionJsonlTurns (cognitive 26) phodex-bridge/src/session-jsonl-history.js:73 — session-jsonl-history.readRecentSessionJsonlTurns has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), ternaries 3 (6 pts), boolean chains 5, loops 1 (nesting depth added 10). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.routeExpiredHeldRequestThroughBus (cognitive 26) · ×1
  • createDesktopIpcActionFollower.routeExpiredHeldRequestThroughBus (cognitive 26) phodex-bridge/src/desktop-ipc-action-follower.js:1520 — createDesktopIpcActionFollower.routeExpiredHeldRequestThroughBus has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (20 pts), error handling 1 (3 pts), boolean chains 2, ternaries 1 (nesting depth added 11). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1536, 1547). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · gitBranches (cognitive 26) · ×1
  • gitBranches (cognitive 26) phodex-bridge/src/git-handler.js:483 — gitBranches has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (17 pts), error handling 4 (6 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createOpenCodeRuntime.refreshSessionStatuses (cognitive 26) · ×1
  • createOpenCodeRuntime.refreshSessionStatuses (cognitive 26) phodex-bridge/src/opencode-runtime.js:776 — createOpenCodeRuntime.refreshSessionStatuses has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 9, ternaries 1 (3 pts), error handling 2 (nesting depth added 6). None of this is in the body itself: all 26 points belong to 5 function items inside it that branch (a function literal at line 802, a function literal at line 778, a function literal at line 787, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · CodexAsyncUserInputProjection.reconcile (cognitive 25) · ×1
  • CodexAsyncUserInputProjection.reconcile (cognitive 25) CodexMobile/CodexMobile/Models/CodexAsyncUserInputProjection.swift:17 — CodexAsyncUserInputProjection.reconcile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 10, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.noteDesktopMirroredActivityIfNeeded (cognitive 25) · ×1
  • CodexService.noteDesktopMirroredActivityIfNeeded (cognitive 25) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:441 — CodexService.noteDesktopMirroredActivityIfNeeded has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 11 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.handleThreadStatusChanged (cognitive 25) · ×1
  • CodexService.handleThreadStatusChanged (cognitive 25) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1068 — CodexService.handleThreadStatusChanged has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, if/else 7 (11 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.startSyncLoop (cognitive 25) · ×1
  • CodexService.startSyncLoop (cognitive 25) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:21 — CodexService.startSyncLoop has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 5 (8 pts), boolean chains 3, loops 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AudioSampleCollector.copyMonoFloatSamples (cognitive 25) · ×1
  • AudioSampleCollector.copyMonoFloatSamples (cognitive 25) CodexMobile/CodexMobile/Services/GPTVoiceTranscriptionManager.swift:793 — AudioSampleCollector.copyMonoFloatSamples has cognitive complexity 25 (threshold 15). Drivers by points: loops 5 (17 pts), if/else 5 (7 pts), boolean chains 1 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · TurnTimelineReducer.shouldMergeUserMessages (cognitive 25) · ×1
  • TurnTimelineReducer.shouldMergeUserMessages (cognitive 25) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:772 — TurnTimelineReducer.shouldMergeUserMessages has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 17, if/else 6 (8 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.
D2 · Cognitive Complexity · opencode-runtime.createOpenCodeRuntime.refreshSessionStatuses (cognitive 25) · ×1
  • opencode-runtime.createOpenCodeRuntime.refreshSessionStatuses (cognitive 25) phodex-bridge/src/opencode-runtime.js:776 — opencode-runtime.createOpenCodeRuntime.refreshSessionStatuses has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, ternaries 1 (3 pts), error handling 2 (nesting depth added 6). None of this is in the body itself: all 25 points belong to 5 function literals inside it that branch (lines 802, 778, 787, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cognitive 25) · ×1
  • createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cognitive 25) phodex-bridge/src/desktop-ipc-action-follower.js:2102 — createDesktopIpcActionFollower.emitNormalizedReviewOverlays has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), ternaries 3 (5 pts), loops 2 (3 pts), other 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexAsyncUserInputProjection.nativeReply (cognitive 24) · ×1
  • CodexAsyncUserInputProjection.nativeReply (cognitive 24) CodexMobile/CodexMobile/Models/CodexAsyncUserInputProjection.swift:165 — CodexAsyncUserInputProjection.nativeReply has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 16, if/else 5 (7 pts), loops 1 (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.
D2 · Cognitive Complexity · CodexMessage.== (cognitive 24) · ×1
  • CodexMessage.== (cognitive 24) CodexMobile/CodexMobile/Models/CodexMessage.swift:301 — CodexMessage.== has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 24. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.extractTextDelta (cognitive 24) · ×1
  • CodexService.extractTextDelta (cognitive 24) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2736 — CodexService.extractTextDelta has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 12. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.sendRequestWithApprovalPolicyFallback (cognitive 24) · ×1
  • CodexService.sendRequestWithApprovalPolicyFallback (cognitive 24) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:158 — CodexService.sendRequestWithApprovalPolicyFallback has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 7, error handling 1 (3 pts), loops 2 (3 pts), ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NewChatDraftView.body (cognitive 24) · ×1
  • NewChatDraftView.body (cognitive 24) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:116 — NewChatDraftView.body has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17 (19 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CommandHumanizer.gitInfo (cognitive 24) · ×1
  • CommandHumanizer.gitInfo (cognitive 24) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:919 — CommandHumanizer.gitInfo has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 11 (22 pts), if/else 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.
D2 · Cognitive Complexity · UserBubbleMentionExtractor.renderModel (cognitive 24) · ×1
  • UserBubbleMentionExtractor.renderModel (cognitive 24) CodexMobile/CodexMobile/Views/Turn/Messages/UserMessageBubble.swift:288 — UserBubbleMentionExtractor.renderModel has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-conversation-projector.diffItem (cognitive 24) · ×1
  • desktop-ipc-conversation-projector.diffItem (cognitive 24) phodex-bridge/src/desktop-ipc-conversation-projector.js:528 — desktop-ipc-conversation-projector.diffItem has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest (cognitive 24) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest (cognitive 24) phodex-bridge/src/desktop-ipc-action-follower.js:2430 — desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 9, ternaries 2 (3 pts), error handling 1 (2 pts) (nesting depth added 3). None of this is in the body itself: all 24 points belong to 3 function literals inside it that branch (lines 2494, 2468, 2438). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.tryBootstrapDesktopResume (cognitive 24) · ×1
  • createDesktopIpcActionFollower.tryBootstrapDesktopResume (cognitive 24) phodex-bridge/src/desktop-ipc-action-follower.js:1409 — createDesktopIpcActionFollower.tryBootstrapDesktopResume has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), error handling 4 (7 pts), boolean chains 3 (nesting depth added 7). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1440, 1426, 1434, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · CodexService.existingMessagesForCanonicalSourceReplacement (cognitive 23) · ×1
  • CodexService.existingMessagesForCanonicalSourceReplacement (cognitive 23) CodexMobile/CodexMobile/Services/CodexService+History.swift:730 — CodexService.existingMessagesForCanonicalSourceReplacement has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 31, if/else 19 (24 pts), loops 1 (nesting depth added 5). 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 shape REPEATS in the file: one other method here (CodexService.existingMessagesForCanonicalSourceReplacement::hasCanonicalCounterpart) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CodexService.normalizedFileChangePathKeys (cognitive 23) · ×1
  • CodexService.normalizedFileChangePathKeys (cognitive 23) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3038 — CodexService.normalizedFileChangePathKeys has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.beginAssistantMessage (cognitive 23) · ×1
  • CodexService.beginAssistantMessage (cognitive 23) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3779 — CodexService.beginAssistantMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AssistantMarkdownImageReferenceParser.contentSegmentsPreservingTemporaryImages (cognitive 23) · ×1
  • AssistantMarkdownImageReferenceParser.contentSegmentsPreservingTemporaryImages (cognitive 23) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:236 — AssistantMarkdownImageReferenceParser.contentSegmentsPreservingTemporaryImages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 10). Of this number, 20 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService+IncomingSupport.swift.flattenNestedText (cognitive 23) · ×1
  • CodexService+IncomingSupport.swift.flattenNestedText (cognitive 23) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:410 — CodexService+IncomingSupport.swift.flattenNestedText has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts), ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cognitive 23) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cognitive 23) phodex-bridge/src/desktop-ipc-action-follower.js:2102 — desktop-ipc-action-follower.createDesktopIpcActionFollower.emitNormalizedReviewOverlays has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (7 pts), ternaries 3 (5 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.runNextQueuedFollowUp (cognitive 23) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.runNextQueuedFollowUp (cognitive 23) phodex-bridge/src/desktop-ipc-live-owner.js:1776 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.runNextQueuedFollowUp has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 10, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1783, 1788, 1827, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · bridge.areEquivalentRelayHistoryItems (cognitive 23) · ×1
  • bridge.areEquivalentRelayHistoryItems (cognitive 23) phodex-bridge/src/bridge.js:4292 — bridge.areEquivalentRelayHistoryItems has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 11 (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 · projectConversationState (cognitive 23) · ×1
  • projectConversationState (cognitive 23) phodex-bridge/src/desktop-ipc-conversation-projector.js:179 — projectConversationState has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 17, other 5, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ContentView.edgeDragGesture (cognitive 22) · ×1
  • ContentView.edgeDragGesture (cognitive 22) CodexMobile/CodexMobile/ContentView.swift:1041 — ContentView.edgeDragGesture has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.decodeHistoryBaseDate (cognitive 22) · ×1
  • CodexService.decodeHistoryBaseDate (cognitive 22) CodexMobile/CodexMobile/Services/CodexService+History.swift:429 — CodexService.decodeHistoryBaseDate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CodexService.mergeLateReasoningDeltaIfPossible (cognitive 22) · ×1
  • CodexService.mergeLateReasoningDeltaIfPossible (cognitive 22) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3616 — CodexService.mergeLateReasoningDeltaIfPossible has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, if/else 8 (10 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.
D2 · Cognitive Complexity · CodexService.catchUpRunningThreadIfNeeded (cognitive 22) · ×1
  • CodexService.catchUpRunningThreadIfNeeded (cognitive 22) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:762 — CodexService.catchUpRunningThreadIfNeeded has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CodexService.startWebSocketKeepAliveLoop (cognitive 22) · ×1
  • CodexService.startWebSocketKeepAliveLoop (cognitive 22) CodexMobile/CodexMobile/Services/CodexService+Transport.swift:384 — CodexService.startWebSocketKeepAliveLoop has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.validateVoiceWAVData (cognitive 22) · ×1
  • CodexService.validateVoiceWAVData (cognitive 22) CodexMobile/CodexMobile/Services/CodexService+Voice.swift:285 — CodexService.validateVoiceWAVData has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SidebarThreadListView.visibleSubagentThreadIDs (cognitive 22) · ×1
  • SidebarThreadListView.visibleSubagentThreadIDs (cognitive 22) CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListView.swift:360 — SidebarThreadListView.visibleSubagentThreadIDs has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (10 pts), match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommandHumanizer.humanize (cognitive 22) · ×1
  • CommandHumanizer.humanize (cognitive 22) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:676 — CommandHumanizer.humanize has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 10 (20 pts), if/else 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · StreamingMarkdownBlockSplitter.split (cognitive 22) · ×1
  • StreamingMarkdownBlockSplitter.split (cognitive 22) CodexMobile/CodexMobile/Views/Turn/Messages/StreamingMarkdownBlockSplitter.swift:17 — StreamingMarkdownBlockSplitter.split has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageRowRenderModelCache.buildModel (cognitive 22) · ×1
  • MessageRowRenderModelCache.buildModel (cognitive 22) CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageCaches.swift:133 — MessageRowRenderModelCache.buildModel has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 8 (19 pts), match/switch 2 (3 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · codex-transport.createSpawnTransport (cognitive 22) · ×1
  • codex-transport.createSpawnTransport (cognitive 22) phodex-bridge/src/codex-transport.js:27 — codex-transport.createSpawnTransport has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 128, a function literal at line 153, a function literal at line 96, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · workspace-handler.workspaceReadImage (cognitive 22) · ×1
  • workspace-handler.workspaceReadImage (cognitive 22) phodex-bridge/src/workspace-handler.js:176 — workspace-handler.workspaceReadImage has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9, boolean chains 7, ternaries 5 (6 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.routeExpiredHeldRequestThroughBus (cognitive 22) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.routeExpiredHeldRequestThroughBus (cognitive 22) phodex-bridge/src/desktop-ipc-action-follower.js:1520 — desktop-ipc-action-follower.createDesktopIpcActionFollower.routeExpiredHeldRequestThroughBus has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 2, ternaries 1 (nesting depth added 8). Most of this is not in the body itself: 9 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1536, 1547). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState (cognitive 22) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState (cognitive 22) phodex-bridge/src/desktop-ipc-action-follower.js:1978 — desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (8 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-action-follower.applyConversationStateChange (cognitive 22) · ×1
  • desktop-ipc-action-follower.applyConversationStateChange (cognitive 22) phodex-bridge/src/desktop-ipc-action-follower.js:3294 — desktop-ipc-action-follower.applyConversationStateChange has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 9, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · session-jsonl-history.shouldSkipResponseItemForHistory (cognitive 22) · ×1
  • session-jsonl-history.shouldSkipResponseItemForHistory (cognitive 22) phodex-bridge/src/session-jsonl-history.js:1338 — session-jsonl-history.shouldSkipResponseItemForHistory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · bridge.startBridge.observeAppServerActivity (cognitive 22) · ×1
  • bridge.startBridge.observeAppServerActivity (cognitive 22) phodex-bridge/src/bridge.js:1457 — bridge.startBridge.observeAppServerActivity has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 5 (8 pts), boolean chains 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · startBridge.observeAppServerActivity (cognitive 22) · ×1
  • startBridge.observeAppServerActivity (cognitive 22) phodex-bridge/src/bridge.js:1457 — startBridge.observeAppServerActivity has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (12 pts), if/else 5 (8 pts), boolean chains 2 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.syncProjectedConversationState (cognitive 22) · ×1
  • createDesktopIpcActionFollower.syncProjectedConversationState (cognitive 22) phodex-bridge/src/desktop-ipc-action-follower.js:1978 — createDesktopIpcActionFollower.syncProjectedConversationState has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (8 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalizeModels (cognitive 22) · ×1
  • normalizeModels (cognitive 22) phodex-bridge/src/opencode-runtime.js:238 — normalizeModels has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 4 (12 pts), boolean chains 5, loops 2 (3 pts), if/else 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createPushNotificationTracker.handleGoalUpdated (cognitive 22) · ×1
  • createPushNotificationTracker.handleGoalUpdated (cognitive 22) phodex-bridge/src/push-notification-tracker.js:170 — createPushNotificationTracker.handleGoalUpdated has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 8, other 2, error handling 1, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.init (cognitive 21) · ×1
  • CodexService.init (cognitive 21) CodexMobile/CodexMobile/Services/CodexService.swift:899 — CodexService.init has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, boolean chains 7, ternaries 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodexService.mergedThread (cognitive 21) · ×1
  • CodexService.mergedThread (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:95 — CodexService.mergedThread has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20, boolean chains 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodexService.unwrapHistoryShellCommandIfPresent (cognitive 21) · ×1
  • CodexService.unwrapHistoryShellCommandIfPresent (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+History.swift:3928 — CodexService.unwrapHistoryShellCommandIfPresent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 8, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.decodeHistoryStringParts (cognitive 21) · ×1
  • CodexService.decodeHistoryStringParts (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+History.swift:4508 — CodexService.decodeHistoryStringParts has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 5 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.appendReasoningDelta (cognitive 21) · ×1
  • CodexService.appendReasoningDelta (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1211 — CodexService.appendReasoningDelta has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CodexService.handleLegacyCodexEnvelopeEvent (cognitive 21) · ×1
  • CodexService.handleLegacyCodexEnvelopeEvent (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1679 — CodexService.handleLegacyCodexEnvelopeEvent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.decodeStringParts (cognitive 21) · ×1
  • CodexService.decodeStringParts (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3293 — CodexService.decodeStringParts has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (11 pts), if/else 5 (8 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.handleItemStarted (cognitive 21) · ×1
  • CodexService.handleItemStarted (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift:295 — CodexService.handleItemStarted has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodexService.finalizeAllStreamingState (cognitive 21) · ×1
  • CodexService.finalizeAllStreamingState (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:5553 — CodexService.finalizeAllStreamingState has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (3 pts), boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.syncManagedPushRegistrationIfNeeded (cognitive 21) · ×1
  • CodexService.syncManagedPushRegistrationIfNeeded (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+Notifications.swift:195 — CodexService.syncManagedPushRegistrationIfNeeded has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts), ternaries 2 (3 pts), error handling 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.routePendingNotificationOpenIfPossible (cognitive 21) · ×1
  • CodexService.routePendingNotificationOpenIfPossible (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+Notifications.swift:421 — CodexService.routePendingNotificationOpenIfPossible has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.normalizeRuntimeSelectionsAfterModelsUpdate (cognitive 21) · ×1
  • CodexService.normalizeRuntimeSelectionsAfterModelsUpdate (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:1036 — CodexService.normalizeRuntimeSelectionsAfterModelsUpdate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RevenueCatPaywallView.bottomSection (cognitive 21) · ×1
  • RevenueCatPaywallView.bottomSection (cognitive 21) CodexMobile/CodexMobile/Views/Payments/RevenueCatPaywallView.swift:208 — RevenueCatPaywallView.bottomSection has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (8 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamingInlineMarkupAutoCloser.autoClosed (cognitive 21) · ×1
  • StreamingInlineMarkupAutoCloser.autoClosed (cognitive 21) CodexMobile/CodexMobile/Views/Turn/Messages/StreamingInlineMarkupAutoCloser.swift:16 — StreamingInlineMarkupAutoCloser.autoClosed has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5, ternaries 1 (2 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InferredPlanQuestionnaireParser.parseQuestionBlock (cognitive 21) · ×1
  • InferredPlanQuestionnaireParser.parseQuestionBlock (cognitive 21) CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:702 — InferredPlanQuestionnaireParser.parseQuestionBlock has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 1, loops 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnTimelineReducer.fileChangeMessage (cognitive 21) · ×1
  • TurnTimelineReducer.fileChangeMessage (cognitive 21) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:1380 — TurnTimelineReducer.fileChangeMessage has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 8. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · TurnTimelineView.scheduleProgressiveTailRevealIfNeeded (cognitive 21) · ×1
  • TurnTimelineView.scheduleProgressiveTailRevealIfNeeded (cognitive 21) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:965 — TurnTimelineView.scheduleProgressiveTailRevealIfNeeded has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CodexService+IncomingSupport.swift.unwrapShellCommandIfPresent (cognitive 21) · ×1
  • CodexService+IncomingSupport.swift.unwrapShellCommandIfPresent (cognitive 21) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:549 — CodexService+IncomingSupport.swift.unwrapShellCommandIfPresent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 8, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.normalizePart (cognitive 21) · ×1
  • opencode-runtime.normalizePart (cognitive 21) phodex-bridge/src/opencode-runtime.js:117 — opencode-runtime.normalizePart has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (6 pts), ternaries 3 (5 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · push-notification-tracker.readCompletionTimestamp (cognitive 21) · ×1
  • push-notification-tracker.readCompletionTimestamp (cognitive 21) phodex-bridge/src/push-notification-tracker.js:888 — push-notification-tracker.readCompletionTimestamp has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (12 pts), ternaries 1 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bridge.createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cognitive 21) · ×1
  • bridge.createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cognitive 21) phodex-bridge/src/bridge.js:371 — bridge.createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 8 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · server.handleHTTPRequest (cognitive 21) · ×1
  • server.handleHTTPRequest (cognitive 21) relay/server.js:97 — server.handleHTTPRequest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cognitive 21) · ×1
  • createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cognitive 21) phodex-bridge/src/bridge.js:371 — createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 8 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · startBridge.updatePendingAuthLoginFromCodexMessage (cognitive 21) · ×1
  • startBridge.updatePendingAuthLoginFromCodexMessage (cognitive 21) phodex-bridge/src/bridge.js:1993 — startBridge.updatePendingAuthLoginFromCodexMessage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, other 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handleInbound (cognitive 21) · ×1
  • handleInbound (cognitive 21) phodex-bridge/src/codex-desktop-refresher.js:103 — handleInbound has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, other 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createOpenCodeRuntime.ensureStarted (cognitive 21) · ×1
  • createOpenCodeRuntime.ensureStarted (cognitive 21) phodex-bridge/src/opencode-runtime.js:432 — createOpenCodeRuntime.ensureStarted has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), boolean chains 1, error handling 1, other 1 (nesting depth added 9). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 471, 446, 436, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · forEachThreadRowInResponse (cognitive 21) · ×1
  • forEachThreadRowInResponse (cognitive 21) phodex-bridge/src/thread-row-enrichment.js:11 — forEachThreadRowInResponse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.canonicalizeUniqueProvisionalTurnMappings (cognitive 20) · ×1
  • CodexService.canonicalizeUniqueProvisionalTurnMappings (cognitive 20) CodexMobile/CodexMobile/Services/CodexService+History.swift:879 — CodexService.canonicalizeUniqueProvisionalTurnMappings has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (8 pts), loops 2 (3 pts) (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.mergeStreamingSnapshotText (cognitive 20) · ×1
  • CodexService.mergeStreamingSnapshotText (cognitive 20) CodexMobile/CodexMobile/Services/CodexService+History.swift:2813 — CodexService.mergeStreamingSnapshotText has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.fallbackUserHistoryMergeIndices (cognitive 20) · ×1
  • CodexService.fallbackUserHistoryMergeIndices (cognitive 20) CodexMobile/CodexMobile/Services/CodexService+History.swift:3063 — CodexService.fallbackUserHistoryMergeIndices has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 7, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.decodeHistoryFileChangeEntries (cognitive 20) · ×1
  • CodexService.decodeHistoryFileChangeEntries (cognitive 20) CodexMobile/CodexMobile/Services/CodexService+History.swift:4203 — CodexService.decodeHistoryFileChangeEntries has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.isLikelyIncomingItemPayload (cognitive 20) · ×1
  • CodexService.isLikelyIncomingItemPayload (cognitive 20) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2654 — CodexService.isLikelyIncomingItemPayload has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 15, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.performPrepareThreadForDisplay (cognitive 20) · ×1
  • CodexService.performPrepareThreadForDisplay (cognitive 20) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:978 — CodexService.performPrepareThreadForDisplay has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CodexService.bufferSecureControlMessage (cognitive 20) · ×1
  • CodexService.bufferSecureControlMessage (cognitive 20) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:947 — CodexService.bufferSecureControlMessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 2 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.classifyVoiceFailureMessage (cognitive 20) · ×1
  • CodexService.classifyVoiceFailureMessage (cognitive 20) CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:171 — CodexService.classifyVoiceFailureMessage has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.openTerminal (cognitive 20) · ×1
  • CodexService.openTerminal (cognitive 20) CodexMobile/CodexMobile/Services/Terminal/CodexService+Terminal.swift:40 — CodexService.openTerminal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnView.composerWithSubagentAccessory (cognitive 20) · ×1
  • TurnView.composerWithSubagentAccessory (cognitive 20) CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1561 — TurnView.composerWithSubagentAccessory has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · TurnDiffPresentationBuilder.extractPath (cognitive 20) · ×1
  • TurnDiffPresentationBuilder.extractPath (cognitive 20) CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:99 — TurnDiffPresentationBuilder.extractPath has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 3, boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnGitBranchPickerSheet.body (cognitive 20) · ×1
  • TurnGitBranchPickerSheet.body (cognitive 20) CodexMobile/CodexMobile/Views/Turn/Git/TurnGitBranchSelector.swift:315 — TurnGitBranchPickerSheet.body has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (7 pts), ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CommandOutputImageReferenceParser.shellTokens (cognitive 20) · ×1
  • CommandOutputImageReferenceParser.shellTokens (cognitive 20) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:546 — CommandOutputImageReferenceParser.shellTokens has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SubagentActionCard.readableStatus (cognitive 20) · ×1
  • SubagentActionCard.readableStatus (cognitive 20) CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:172 — SubagentActionCard.readableStatus has cognitive complexity 20 (threshold 15). Drivers by points: match/switch 7 (13 pts), if/else 7 (nesting depth added 6). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · TurnTimelineReducer.removeDuplicateFileChangeMessages (cognitive 20) · ×1
  • TurnTimelineReducer.removeDuplicateFileChangeMessages (cognitive 20) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:1156 — TurnTimelineReducer.removeDuplicateFileChangeMessages has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · push-notification-tracker.createPushNotificationTracker.handleGoalUpdated (cognitive 20) · ×1
  • push-notification-tracker.createPushNotificationTracker.handleGoalUpdated (cognitive 20) phodex-bridge/src/push-notification-tracker.js:170 — push-notification-tracker.createPushNotificationTracker.handleGoalUpdated has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 8, error handling 1, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bridge.startBridge.updatePendingAuthLoginFromCodexMessage (cognitive 20) · ×1
  • bridge.startBridge.updatePendingAuthLoginFromCodexMessage (cognitive 20) phodex-bridge/src/bridge.js:1993 — bridge.startBridge.updatePendingAuthLoginFromCodexMessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalizeTurnStartForCodex (cognitive 20) · ×1
  • normalizeTurnStartForCodex (cognitive 20) phodex-bridge/src/bridge.js:2736 — normalizeTurnStartForCodex has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, ternaries 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sanitizeRelayHistoryTurn (cognitive 20) · ×1
  • sanitizeRelayHistoryTurn (cognitive 20) phodex-bridge/src/bridge.js:4471 — sanitizeRelayHistoryTurn has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5, ternaries 2 (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 literals inside it that branch (lines 4480, 4506). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · createDesktopIpcClient.dispatchEnvelope (cognitive 20) · ×1
  • createDesktopIpcClient.dispatchEnvelope (cognitive 20) phodex-bridge/src/desktop-ipc-action-follower.js:2999 — createDesktopIpcClient.dispatchEnvelope has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (9 pts), boolean chains 1, other 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backgroundRawTurn (cognitive 20) · ×1
  • backgroundRawTurn (cognitive 20) phodex-bridge/src/desktop-ipc-action-follower.js:3971 — backgroundRawTurn has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 7, ternaries 7, if/else 4, other 2. Of this number, 14 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · reduceTurnStarted (cognitive 20) · ×1
  • reduceTurnStarted (cognitive 20) phodex-bridge/src/thread-activity-projector.js:164 — reduceTurnStarted has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 5, other 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CodexService.absorbAssistantBlockReplayCompletion (cognitive 19) · ×1
  • CodexService.absorbAssistantBlockReplayCompletion (cognitive 19) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4864 — CodexService.absorbAssistantBlockReplayCompletion has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.imageMergedReplayMessage (cognitive 19) · ×1
  • CodexService.imageMergedReplayMessage (cognitive 19) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4947 — CodexService.imageMergedReplayMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.performSecureHandshake (cognitive 19) · ×1
  • CodexService.performSecureHandshake (cognitive 19) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:13 — CodexService.performSecureHandshake has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, match/switch 1, 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.
D2 · Cognitive Complexity · CodexService.userFacingTurnErrorMessage (cognitive 19) · ×1
  • CodexService.userFacingTurnErrorMessage (cognitive 19) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2258 — CodexService.userFacingTurnErrorMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 3 (7 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.decodeSkillMetadata (cognitive 19) · ×1
  • CodexService.decodeSkillMetadata (cognitive 19) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3180 — CodexService.decodeSkillMetadata has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, loops 1 (2 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnTimelineReducer.mergedUserMessage (cognitive 19) · ×1
  • TurnTimelineReducer.mergedUserMessage (cognitive 19) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:821 — TurnTimelineReducer.mergedUserMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 9. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · TurnTimelineRenderProjection.finalAssistantIndexByTurn (cognitive 19) · ×1
  • TurnTimelineRenderProjection.finalAssistantIndexByTurn (cognitive 19) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:781 — TurnTimelineRenderProjection.finalAssistantIndexByTurn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.createOpenCodeRuntime.listAllSessions (cognitive 19) · ×1
  • opencode-runtime.createOpenCodeRuntime.listAllSessions (cognitive 19) phodex-bridge/src/opencode-runtime.js:992 — opencode-runtime.createOpenCodeRuntime.listAllSessions has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 3 (7 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · account-status.composeAccountStatus (cognitive 19) · ×1
  • account-status.composeAccountStatus (cognitive 19) phodex-bridge/src/account-status.js:11 — account-status.composeAccountStatus has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, ternaries 3 (6 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcClient.dispatchEnvelope (cognitive 19) · ×1
  • desktop-ipc-action-follower.createDesktopIpcClient.dispatchEnvelope (cognitive 19) phodex-bridge/src/desktop-ipc-action-follower.js:2999 — desktop-ipc-action-follower.createDesktopIpcClient.dispatchEnvelope has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (9 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bridge.createThreadTurnsListFastPageCoordinator.extendCanonicalResponseThroughAnchor (cognitive 19) · ×1
  • bridge.createThreadTurnsListFastPageCoordinator.extendCanonicalResponseThroughAnchor (cognitive 19) phodex-bridge/src/bridge.js:291 — bridge.createThreadTurnsListFastPageCoordinator.extendCanonicalResponseThroughAnchor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createThreadTurnsListFastPageCoordinator.extendCanonicalResponseThroughAnchor (cognitive 19) · ×1
  • createThreadTurnsListFastPageCoordinator.extendCanonicalResponseThroughAnchor (cognitive 19) phodex-bridge/src/bridge.js:291 — createThreadTurnsListFastPageCoordinator.extendCanonicalResponseThroughAnchor has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · trimTurnsListPayloadForRelay (cognitive 19) · ×1
  • trimTurnsListPayloadForRelay (cognitive 19) phodex-bridge/src/bridge.js:5040 — trimTurnsListPayloadForRelay has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (6 pts), other 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createDesktopIpcLiveOwner.broadcastConversationState (cognitive 19) · ×1
  • createDesktopIpcLiveOwner.broadcastConversationState (cognitive 19) phodex-bridge/src/desktop-ipc-live-owner.js:1223 — createDesktopIpcLiveOwner.broadcastConversationState has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, other 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gitCreatePullRequest (cognitive 19) · ×1
  • gitCreatePullRequest (cognitive 19) phodex-bridge/src/git-handler.js:1144 — gitCreatePullRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, error handling 3 (4 pts) (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · normalizeTurns (cognitive 19) · ×1
  • normalizeTurns (cognitive 19) phodex-bridge/src/opencode-runtime.js:145 — normalizeTurns has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (6 pts), boolean chains 5, ternaries 2 (5 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createOpenCodeRuntime.listAllSessions (cognitive 19) · ×1
  • createOpenCodeRuntime.listAllSessions (cognitive 19) phodex-bridge/src/opencode-runtime.js:992 — createOpenCodeRuntime.listAllSessions has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (8 pts), if/else 3 (7 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContentView.scheduleSidebarPrewarmIfNeeded (cognitive 18) · ×1
  • ContentView.scheduleSidebarPrewarmIfNeeded (cognitive 18) CodexMobile/CodexMobile/ContentView.swift:1497 — ContentView.scheduleSidebarPrewarmIfNeeded has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 16, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.scheduleAsyncAnswerVerification (cognitive 18) · ×1
  • CodexService.scheduleAsyncAnswerVerification (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+AsyncUserInput.swift:204 — CodexService.scheduleAsyncAnswerVerification has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 3, error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.incompatibleBridgeAppVersionError (cognitive 18) · ×1
  • CodexService.incompatibleBridgeAppVersionError (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:435 — CodexService.incompatibleBridgeAppVersionError has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.existingMessagesForCanonicalSourceReplacement · ×1
  • CodexService.existingMessagesForCanonicalSourceReplacement::hasCanonicalCounterpart (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+History.swift:783 — CodexService.existingMessagesForCanonicalSourceReplacement::hasCanonicalCounterpart has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (7 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. This shape REPEATS in the file: one other method here (CodexService.existingMessagesForCanonicalSourceReplacement) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · CodexService.decodeHistoryFlattenText (cognitive 18) · ×1
  • CodexService.decodeHistoryFlattenText (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+History.swift:4464 — CodexService.decodeHistoryFlattenText has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.decodeFileChangeEntries (cognitive 18) · ×1
  • CodexService.decodeFileChangeEntries (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3020 — CodexService.decodeFileChangeEntries has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.preparePlanItemIdentityForUpsert (cognitive 18) · ×1
  • CodexService.preparePlanItemIdentityForUpsert (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2117 — CodexService.preparePlanItemIdentityForUpsert has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 8 (9 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.applyLateTerminalAssistantDelta (cognitive 18) · ×1
  • CodexService.applyLateTerminalAssistantDelta (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3950 — CodexService.applyLateTerminalAssistantDelta has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.turnStateSnapshot (cognitive 18) · ×1
  • CodexService.turnStateSnapshot (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3492 — CodexService.turnStateSnapshot has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.receiveNextMessage (cognitive 18) · ×1
  • CodexService.receiveNextMessage (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+Transport.swift:614 — CodexService.receiveNextMessage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.parseManualWebSocketFrame (cognitive 18) · ×1
  • CodexService.parseManualWebSocketFrame (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+Transport.swift:1094 — CodexService.parseManualWebSocketFrame has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod (cognitive 18) · ×1
  • CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:64 — CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 15, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · RemodexTerminalSnapshot.applyTerminalEvent (cognitive 18) · ×1
  • RemodexTerminalSnapshot.applyTerminalEvent (cognitive 18) CodexMobile/CodexMobile/Services/Terminal/RemodexTerminalModels.swift:225 — RemodexTerminalSnapshot.applyTerminalEvent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ContentViewModel.trustedReconnectResolution (cognitive 18) · ×1
  • ContentViewModel.trustedReconnectResolution (cognitive 18) CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:521 — ContentViewModel.trustedReconnectResolution has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, error handling 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UserBubbleCollapsedMarkdownPreview.truncatedPreview (cognitive 18) · ×1
  • UserBubbleCollapsedMarkdownPreview.truncatedPreview (cognitive 18) CodexMobile/CodexMobile/Views/Turn/Messages/UserBubbleInlineMarkdownText.swift:189 — UserBubbleCollapsedMarkdownPreview.truncatedPreview has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UserBubbleMentionExtractor.skillInlineResult (cognitive 18) · ×1
  • UserBubbleMentionExtractor.skillInlineResult (cognitive 18) CodexMobile/CodexMobile/Views/Turn/Messages/UserMessageBubble.swift:371 — UserBubbleMentionExtractor.skillInlineResult has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-shared.sanitizeUserRoleItem (cognitive 18) · ×1
  • desktop-ipc-shared.sanitizeUserRoleItem (cognitive 18) REDACTED:331 — desktop-ipc-shared.sanitizeUserRoleItem has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 4). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rollout-live-mirror.toolOutputNotifications (cognitive 18) · ×1
  • rollout-live-mirror.toolOutputNotifications (cognitive 18) phodex-bridge/src/rollout-live-mirror.js:1608 — rollout-live-mirror.toolOutputNotifications has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 2 (3 pts) (nesting depth added 2). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · desktop-ipc-conversation-projector.diffTurnLifecycle (cognitive 18) · ×1
  • desktop-ipc-conversation-projector.diffTurnLifecycle (cognitive 18) phodex-bridge/src/desktop-ipc-conversation-projector.js:447 — desktop-ipc-conversation-projector.diffTurnLifecycle has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.negotiateResumeOwnership (cognitive 18) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.negotiateResumeOwnership (cognitive 18) phodex-bridge/src/desktop-ipc-action-follower.js:1366 — desktop-ipc-action-follower.createDesktopIpcActionFollower.negotiateResumeOwnership has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, error handling 1, 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.
D2 · Cognitive Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState (cognitive 18) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState (cognitive 18) phodex-bridge/src/desktop-ipc-live-owner.js:1223 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · startBridge.rememberForwardedRequestMethod (cognitive 18) · ×1
  • startBridge.rememberForwardedRequestMethod (cognitive 18) phodex-bridge/src/bridge.js:1888 — startBridge.rememberForwardedRequestMethod has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 5 (6 pts), boolean chains 4, other 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handleDesktopMethod (cognitive 18) · ×1
  • handleDesktopMethod (cognitive 18) phodex-bridge/src/desktop-handler.js:62 — handleDesktopMethod has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 2 (4 pts), other 4, match/switch 1 (nesting depth added 2). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.negotiateResumeOwnership (cognitive 18) · ×1
  • createDesktopIpcActionFollower.negotiateResumeOwnership (cognitive 18) phodex-bridge/src/desktop-ipc-action-follower.js:1366 — createDesktopIpcActionFollower.negotiateResumeOwnership has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, error handling 1, 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.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.buildDesktopFollowerRoute (cognitive 18) · ×1
  • createDesktopIpcActionFollower.buildDesktopFollowerRoute (cognitive 18) phodex-bridge/src/desktop-ipc-action-follower.js:2346 — createDesktopIpcActionFollower.buildDesktopFollowerRoute has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 3 (5 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 · reduceItemLifecycle (cognitive 18) · ×1
  • reduceItemLifecycle (cognitive 18) phodex-bridge/src/thread-activity-projector.js:279 — reduceItemLifecycle has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (6 pts), ternaries 3, other 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · requestTranscription (cognitive 18) · ×1
  • requestTranscription (cognitive 18) phodex-bridge/src/voice-handler.js:260 — requestTranscription has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, ternaries 4, error handling 2 (nesting depth added 2). Of this number, 9 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AIUnifiedPatchParser.extractPath (cognitive 17) · ×1
  • AIUnifiedPatchParser.extractPath (cognitive 17) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:491 — AIUnifiedPatchParser.extractPath has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.receiveErrorDisposition (cognitive 17) · ×1
  • CodexService.receiveErrorDisposition (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:842 — CodexService.receiveErrorDisposition has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 5, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.upsertSubagentIdentity (cognitive 17) · ×1
  • CodexService.upsertSubagentIdentity (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:757 — CodexService.upsertSubagentIdentity has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 7 (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 · CodexService.decodeImageAttachments (cognitive 17) · ×1
  • CodexService.decodeImageAttachments (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+History.swift:650 — CodexService.decodeImageAttachments has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.historyMessagesMergingGeneratedImageArtifacts (cognitive 17) · ×1
  • CodexService.historyMessagesMergingGeneratedImageArtifacts (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+History.swift:3252 — CodexService.historyMessagesMergingGeneratedImageArtifacts has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (7 pts), loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.decodeHistoryFirstString (cognitive 17) · ×1
  • CodexService.decodeHistoryFirstString (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+History.swift:4397 — CodexService.decodeHistoryFirstString has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (16 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.appendToolCallDelta (cognitive 17) · ×1
  • CodexService.appendToolCallDelta (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1345 — CodexService.appendToolCallDelta has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CodexService.migrateMacScopedState (cognitive 17) · ×1
  • CodexService.migrateMacScopedState (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:339 — CodexService.migrateMacScopedState has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 15, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.appendGeneratedImageReference (cognitive 17) · ×1
  • CodexService.appendGeneratedImageReference (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4611 — CodexService.appendGeneratedImageReference has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.handleThreadForkResponse (cognitive 17) · ×1
  • CodexService.handleThreadForkResponse (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+ThreadFork.swift:118 — CodexService.handleThreadForkResponse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3 (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 · TurnComposerInputTextView.updateUIView (cognitive 17) · ×1
  • TurnComposerInputTextView.updateUIView (cognitive 17) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift:63 — TurnComposerInputTextView.updateUIView has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, if/else 5, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · TurnViewModel.canRestoreSavedLocalDraft (cognitive 17) · ×1
  • TurnViewModel.canRestoreSavedLocalDraft (cognitive 17) REDACTED:694 — TurnViewModel.canRestoreSavedLocalDraft has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 4, loops 1, match/switch 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · TurnViewModel.trailingFileToken (cognitive 17) · ×1
  • TurnViewModel.trailingFileToken (cognitive 17) REDACTED:2492 — TurnViewModel.trailingFileToken has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AssistantMemoryCitationParser.updateInlineBackticks (cognitive 17) · ×1
  • AssistantMemoryCitationParser.updateInlineBackticks (cognitive 17) CodexMobile/CodexMobile/Views/Turn/Messages/AssistantMemoryCitationParser.swift:98 — AssistantMemoryCitationParser.updateInlineBackticks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 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.
D2 · Cognitive Complexity · AsyncUserInputCardView.body (cognitive 17) · ×1
  • AsyncUserInputCardView.body (cognitive 17) CodexMobile/CodexMobile/Views/Turn/Messages/AsyncUserInputCardView.swift:18 — AsyncUserInputCardView.body has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (11 pts), if/else 4 (5 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-handler.continueOnDesktop (cognitive 17) · ×1
  • desktop-handler.continueOnDesktop (cognitive 17) phodex-bridge/src/desktop-handler.js:137 — desktop-handler.continueOnDesktop has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), error handling 4 (7 pts), boolean chains 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · rollout-live-mirror.processAwaitingCoherentBoundary (cognitive 17) · ×1
  • rollout-live-mirror.processAwaitingCoherentBoundary (cognitive 17) phodex-bridge/src/rollout-live-mirror.js:830 — rollout-live-mirror.processAwaitingCoherentBoundary has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (6 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · thread-activity-projector.projectDesktopThreadActivity (cognitive 17) · ×1
  • thread-activity-projector.projectDesktopThreadActivity (cognitive 17) phodex-bridge/src/thread-activity-projector.js:353 — thread-activity-projector.projectDesktopThreadActivity has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 4 (6 pts), ternaries 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · desktop-ipc-conversation-projector.matchDesktopTurnIdentityContinuities (cognitive 17) · ×1
  • desktop-ipc-conversation-projector.matchDesktopTurnIdentityContinuities (cognitive 17) phodex-bridge/src/desktop-ipc-conversation-projector.js:901 — desktop-ipc-conversation-projector.matchDesktopTurnIdentityContinuities has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, loops 3 (nesting depth added 4). None of this is in the body itself: all 17 points belong to 4 function items inside it that branch (applyMaximumMatchesForScore::tryAssign, applyMaximumMatchesForScore, a function literal at line 906, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute (cognitive 17) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute (cognitive 17) phodex-bridge/src/desktop-ipc-action-follower.js:2346 — desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, boolean chains 5, ternaries 3 (5 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 · desktop-ipc-action-follower.boundedIndexedDesktopLiveTurns (cognitive 17) · ×1
  • desktop-ipc-action-follower.boundedIndexedDesktopLiveTurns (cognitive 17) phodex-bridge/src/desktop-ipc-action-follower.js:3717 — desktop-ipc-action-follower.boundedIndexedDesktopLiveTurns has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 3, loops 3, ternaries 2 (nesting depth added 3). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cognitive 17) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cognitive 17) phodex-bridge/src/desktop-ipc-live-owner.js:1838 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 5, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · session-jsonl-history.parseSessionJsonlMetadata (cognitive 17) · ×1
  • session-jsonl-history.parseSessionJsonlMetadata (cognitive 17) phodex-bridge/src/session-jsonl-history.js:350 — session-jsonl-history.parseSessionJsonlMetadata has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, error handling 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bridge.sanitizeLiveUserNotification (cognitive 17) · ×1
  • bridge.sanitizeLiveUserNotification (cognitive 17) phodex-bridge/src/bridge.js:4565 — bridge.sanitizeLiveUserNotification has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 5 (7 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · truncateHistoryItemTextForRelay (cognitive 17) · ×1
  • truncateHistoryItemTextForRelay (cognitive 17) phodex-bridge/src/bridge.js:5189 — truncateHistoryItemTextForRelay has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 4). Of this number, 11 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handleOutbound (cognitive 17) · ×1
  • handleOutbound (cognitive 17) phodex-bridge/src/codex-desktop-refresher.js:152 — handleOutbound has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, other 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cognitive 17) · ×1
  • createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cognitive 17) phodex-bridge/src/desktop-ipc-live-owner.js:1838 — createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 5, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · buildThreadReadStateContext (cognitive 17) · ×1
  • buildThreadReadStateContext (cognitive 17) REDACTED:588 — buildThreadReadStateContext has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, other 3, error handling 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · observedTaskStartedTurnIDs (cognitive 17) · ×1
  • observedTaskStartedTurnIDs (cognitive 17) phodex-bridge/src/session-jsonl-history.js:250 — observedTaskStartedTurnIDs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 3, error handling 1 (2 pts), ternaries 1 (2 pts), loops 1, other 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.decodeBridgeGPTAccountSnapshot (cognitive 16) · ×1
  • CodexService.decodeBridgeGPTAccountSnapshot (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+Account.swift:962 — CodexService.decodeBridgeGPTAccountSnapshot has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.connect (cognitive 16) · ×1
  • CodexService.connect (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:43 — CodexService.connect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, error handling 2, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.flushPendingRuntimeOptionRefreshIfPossible (cognitive 16) · ×1
  • CodexService.flushPendingRuntimeOptionRefreshIfPossible (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:626 — CodexService.flushPendingRuntimeOptionRefreshIfPossible has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 5, error handling 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodexService.healExactDuplicateProviderRows (cognitive 16) · ×1
  • CodexService.healExactDuplicateProviderRows (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+History.swift:1641 — CodexService.healExactDuplicateProviderRows has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 3 (6 pts), loops 2 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.decodeHistoryTimestamp (cognitive 16) · ×1
  • CodexService.decodeHistoryTimestamp (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+History.swift:1924 — CodexService.decodeHistoryTimestamp has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.uniqueAssistantHistoryTextMergeIndex (cognitive 16) · ×1
  • CodexService.uniqueAssistantHistoryTextMergeIndex (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+History.swift:2703 — CodexService.uniqueAssistantHistoryTextMergeIndex has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexService.decodeHistoryFirstValue (cognitive 16) · ×1
  • CodexService.decodeHistoryFirstValue (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+History.swift:4435 — CodexService.decodeHistoryFirstValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.handleServerRequest (cognitive 16) · ×1
  • CodexService.handleServerRequest (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:114 — CodexService.handleServerRequest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, error handling 1 (3 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.appendThinkingActivityLine (cognitive 16) · ×1
  • CodexService.appendThinkingActivityLine (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2528 — CodexService.appendThinkingActivityLine has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.toolActivityTargetIndex (cognitive 16) · ×1
  • CodexService.toolActivityTargetIndex (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2643 — CodexService.toolActivityTargetIndex has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.mergeGeneratedImageArtifactsIntoAssistantMessage (cognitive 16) · ×1
  • CodexService.mergeGeneratedImageArtifactsIntoAssistantMessage (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4725 — CodexService.mergeGeneratedImageArtifactsIntoAssistantMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 6, ternaries 1 (2 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CodexService.flushPendingAssistantDeltas (cognitive 16) · ×1
  • CodexService.flushPendingAssistantDeltas (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:5852 — CodexService.flushPendingAssistantDeltas has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodexService.resetSecureTransportState (cognitive 16) · ×1
  • CodexService.resetSecureTransportState (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:297 — CodexService.resetSecureTransportState has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 2 (6 pts), if/else 4 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService.buildTurnStartRequestParams (cognitive 16) · ×1
  • CodexService.buildTurnStartRequestParams (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2685 — CodexService.buildTurnStartRequestParams has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · PetCompanionStore.loadSelectedPet (cognitive 16) · ×1
  • PetCompanionStore.loadSelectedPet (cognitive 16) CodexMobile/CodexMobile/Services/PetCompanionStore.swift:127 — PetCompanionStore.loadSelectedPet has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, error handling 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SidebarActivityRowContent.body (cognitive 16) · ×1
  • SidebarActivityRowContent.body (cognitive 16) CodexMobile/CodexMobile/Views/Sidebar/SidebarActivityRowContent.swift:19 — SidebarActivityRowContent.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FileAutocompletePanel.body (cognitive 16) · ×1
  • FileAutocompletePanel.body (cognitive 16) CodexMobile/CodexMobile/Views/Turn/Composer/FileAutocompletePanel.swift:45 — FileAutocompletePanel.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NewChatDraftView.draftContextRows (cognitive 16) · ×1
  • NewChatDraftView.draftContextRows (cognitive 16) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:361 — NewChatDraftView.draftContextRows has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 5 (7 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnViewModel.onInputChangedForFileAutocomplete (cognitive 16) · ×1
  • TurnViewModel.onInputChangedForFileAutocomplete (cognitive 16) REDACTED:844 — TurnViewModel.onInputChangedForFileAutocomplete has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, error handling 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TurnViewModel.hasClosedConfirmedFileMentionPrefix (cognitive 16) · ×1
  • TurnViewModel.hasClosedConfirmedFileMentionPrefix (cognitive 16) REDACTED:2412 — TurnViewModel.hasClosedConfirmedFileMentionPrefix has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · InferredPlanQuestionnaireParser.parse (cognitive 16) · ×1
  • InferredPlanQuestionnaireParser.parse (cognitive 16) CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:644 — InferredPlanQuestionnaireParser.parse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexService+IncomingSupport.swift.firstValue (cognitive 16) · ×1
  • CodexService+IncomingSupport.swift.firstValue (cognitive 16) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:374 — CodexService+IncomingSupport.swift.firstValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QRScannerPairingValidator.swift.validatePairingQRCode (cognitive 16) · ×1
  • QRScannerPairingValidator.swift.validatePairingQRCode (cognitive 16) CodexMobile/CodexMobile/Views/QRScannerPairingValidator.swift:21 — QRScannerPairingValidator.swift.validatePairingQRCode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (16 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · opencode-runtime.createOpenCodeRuntime.startEvents (cognitive 16) · ×1
  • opencode-runtime.createOpenCodeRuntime.startEvents (cognitive 16) phodex-bridge/src/opencode-runtime.js:943 — opencode-runtime.createOpenCodeRuntime.startEvents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 951, 965). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · workspace-handler.analyzePatchChunk (cognitive 16) · ×1
  • workspace-handler.analyzePatchChunk (cognitive 16) phodex-bridge/src/workspace-handler.js:930 — workspace-handler.analyzePatchChunk has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, loops 1 (nesting depth added 2). Of this number, 14 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · secure-transport.createBridgeSecureTransport.handleClientHello (cognitive 16) · ×1
  • secure-transport.createBridgeSecureTransport.handleClientHello (cognitive 16) REDACTED:139 — secure-transport.createBridgeSecureTransport.handleClientHello has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · desktop-ipc-shared.sanitizeUserInputEntries (cognitive 16) · ×1
  • desktop-ipc-shared.sanitizeUserInputEntries (cognitive 16) REDACTED:301 — desktop-ipc-shared.sanitizeUserInputEntries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.releaseHeldFollowerRequests (cognitive 16) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.releaseHeldFollowerRequests (cognitive 16) phodex-bridge/src/desktop-ipc-action-follower.js:1560 — desktop-ipc-action-follower.createDesktopIpcActionFollower.releaseHeldFollowerRequests has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.handlePeerBroadcast (cognitive 16) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.handlePeerBroadcast (cognitive 16) phodex-bridge/src/desktop-ipc-live-owner.js:1288 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.handlePeerBroadcast has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · sanitizeThreadHistoryImagesForRelay (cognitive 16) · ×1
  • sanitizeThreadHistoryImagesForRelay (cognitive 16) phodex-bridge/src/bridge.js:3579 — sanitizeThreadHistoryImagesForRelay has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, ternaries 4 (5 pts), if/else 4, other 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · createDesktopIpcActionFollower.releaseHeldFollowerRequests (cognitive 16) · ×1
  • createDesktopIpcActionFollower.releaseHeldFollowerRequests (cognitive 16) phodex-bridge/src/desktop-ipc-action-follower.js:1560 — createDesktopIpcActionFollower.releaseHeldFollowerRequests has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · desktopFollowerPayloadForResponse (cognitive 16) · ×1
  • desktopFollowerPayloadForResponse (cognitive 16) phodex-bridge/src/desktop-ipc-action-follower.js:3111 — desktopFollowerPayloadForResponse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, other 3 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · createDesktopIpcLiveOwner.markThreadReadByPhone (cognitive 16) · ×1
  • createDesktopIpcLiveOwner.markThreadReadByPhone (cognitive 16) phodex-bridge/src/desktop-ipc-live-owner.js:493 — createDesktopIpcLiveOwner.markThreadReadByPhone has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, error handling 1 (nesting depth added 1). Of this number, 8 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · createDesktopIpcLiveOwner.handlePeerBroadcast (cognitive 16) · ×1
  • createDesktopIpcLiveOwner.handlePeerBroadcast (cognitive 16) phodex-bridge/src/desktop-ipc-live-owner.js:1288 — createDesktopIpcLiveOwner.handlePeerBroadcast has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · gitTransferManagedHandoff (cognitive 16) · ×1
  • gitTransferManagedHandoff (cognitive 16) phodex-bridge/src/git-handler.js:821 — gitTransferManagedHandoff has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, other 4, boolean chains 3, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · gitRemoveWorktree (cognitive 16) · ×1
  • gitRemoveWorktree (cognitive 16) phodex-bridge/src/git-handler.js:912 — gitRemoveWorktree has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, error handling 3 (4 pts), boolean chains 3, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · createOpenCodeRuntime.startEvents (cognitive 16) · ×1
  • createOpenCodeRuntime.startEvents (cognitive 16) phodex-bridge/src/opencode-runtime.js:943 — createOpenCodeRuntime.startEvents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 951, a function literal at line 965, a function literal at line 956, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · createBridgeSecureTransport.handleClientHello (cognitive 16) · ×1
  • createBridgeSecureTransport.handleClientHello (cognitive 16) REDACTED:139 — createBridgeSecureTransport.handleClientHello has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, 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.
D36 · Supply-chain Provenance & Signing REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×1
  • Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:252 — CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:252-264 | CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:291-308 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) CodexMobile/CodexMobile/Views/Payments/RevenueCatPaywallView.swift:509 — CodexMobile/CodexMobile/Views/Payments/RevenueCatPaywallView.swift:509-545 | CodexMobile/CodexMobile/Views/Payments/RevenueCatPaywallView.swift:548-584 — 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 `CodexMobile/CodexMobile/Views/Payments/RevenueCatPaywallView.swift:509` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) REDACTED:1376 — REDACTED:1376-1409 | REDACTED:1428-1461 — 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 `REDACTED:1376` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:557 — CodexMobile/CodexMobile/Services/CodexService+History.swift:557-580 | CodexMobile/CodexMobile/Services/CodexService+History.swift:583-607 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×1
  • Duplicated block (25 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:421 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:421-445 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:483-507 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:421` 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 · Duplicated block (16–22 lines × 2) · ×1
  • Duplicated block (16–22 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3156 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3156-3171 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:665-686 — 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 `CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:665` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×1
  • Duplicated block (22 lines × 2) CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1296 — CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1296-1317 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1389-1410 — 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 `CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1296` 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (21 lines × 5) · ×1
  • Duplicated block (21 lines × 5) CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:520 — CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:520-540 | CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:546-566 | CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:572-592 | CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:602-622 | CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:650-670 — all 5 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 `CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:520` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1431 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1431-1450 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1467-1487 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1431` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×1
  • Duplicated block (21 lines × 2) CodexMobile/CodexMobile/Views/Turn/Composer/QueuedDraftsPanel.swift:174 — CodexMobile/CodexMobile/Views/Turn/Composer/QueuedDraftsPanel.swift:174-194 | CodexMobile/CodexMobile/Views/Turn/Composer/QueuedDraftsPanel.swift:203-223 — 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 `CodexMobile/CodexMobile/Views/Turn/Composer/QueuedDraftsPanel.swift:174` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerMetaMapper.swift:49 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerMetaMapper.swift:49-65 | CodexMobile/CodexMobile/Views/Turn/Git/TurnGitActionsToolbar.swift:87-105 — 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 `CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerMetaMapper.swift:49` 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.
D4 · Code Duplication · Duplicated block (18 lines × 4) · ×1
  • Duplicated block (18 lines × 4) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:22 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:22-39 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:41-58 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:60-77 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:79-96 — 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.
D4 · Code Duplication · Duplicated block (16–17 lines × 4) · ×1
  • Duplicated block (16–17 lines × 4) CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:59 — CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:59-74 | CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:117-133 | CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:140-156 | CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:162-177 — 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 `CodexMobile/CodexMobile/Services/DesktopHandoffService.swift:59` 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 · Duplicated block (14–17 lines × 2) · ×1
  • Duplicated block (14–17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:434 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:434-447 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:479-495 — 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 `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:434` 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 after the matched lines, `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:448` calls `ensureThreadResumed` and `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:496` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×1
  • Duplicated block (15–17 lines × 2) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:153 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:153-169 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:230-244 — 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 `CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:153` 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.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:477 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:477-492 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:495-510 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:513-528 — 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 `CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:477` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1197 — CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1197-1211 | CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:669-684 — 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 `CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1197` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (4–15 lines × 4) · ×1
  • Duplicated block (4–15 lines × 4) CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:52 — CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:52-66 | CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:58-72 | CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift:68-71 | CodexMobile/CodexMobile/Services/CodexThreadListPersistence.swift:55-69 — before extracting anything, compare `CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift` and `CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 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. Read the line range as the matched WINDOW rather than a finished unit: at `CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift:68` 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.
D4 · Code Duplication · Duplicated block (9–15 lines × 3) · ×1
  • Duplicated block (9–15 lines × 3) CodexMobile/CodexMobile/Services/GitActionsService.swift:32 — CodexMobile/CodexMobile/Services/GitActionsService.swift:32-40 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerMetaMapper.swift:49-63 | CodexMobile/CodexMobile/Views/Turn/Git/TurnGitActionsToolbar.swift:87-101 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 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 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `CodexMobile/CodexMobile/Services/GitActionsService.swift:32` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1931 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1931-1944 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1994-2008 — 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 `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1931` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×1
  • Duplicated block (14–15 lines × 3) CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:287 — CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:287-301 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:311-325 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:334-347 — 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 `CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:287` 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.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2603 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2603-2616 | REDACTED:3159-3170 — 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 `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2603` 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.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×1
  • Duplicated block (13 lines × 3) CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:503 — CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:503-515 | CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:615-627 | CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:663-675 — 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 `CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:503` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:516` calls `CodexStructuredUserInputOption` and `CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:676` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×1
  • Duplicated block (11–13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:489 — CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:489-501 | CodexMobile/CodexMobile/Services/CodexService+Sync.swift:544-554 — 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 `CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:489` 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.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×1
  • Duplicated block (12 lines × 4) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:416 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:416-427 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:543-554 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1778-1789 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2106-2117 — 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 `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:416` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×1
  • Duplicated block (10–12 lines × 2) CodexMobile/CodexMobile/Views/Turn/Messages/TurnMermaidRenderer.swift:651 — CodexMobile/CodexMobile/Views/Turn/Messages/TurnMermaidRenderer.swift:651-662 | CodexMobile/CodexMobile/Views/Turn/Messages/UserBubbleInlineMarkdownText.swift:300-309 — 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 `CodexMobile/CodexMobile/Views/Turn/Messages/TurnMermaidRenderer.swift:651` 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. 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 after the matched lines, `CodexMobile/CodexMobile/Views/Turn/Messages/UserBubbleInlineMarkdownText.swift:311` calls `markdownLinkRanges`, `inlineCodeRanges` and `CodexMobile/CodexMobile/Views/Turn/Messages/TurnMermaidRenderer.swift:664` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–11 lines × 4) · ×1
  • Duplicated block (10–11 lines × 4) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4311 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4311-4321 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4379-4388 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4405-4414 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4434-4443 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4311` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:374 — CodexMobile/CodexMobile/Services/CodexService+History.swift:374-383 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2469-2476 — 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 `CodexMobile/CodexMobile/Services/CodexService+History.swift:374` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×1
  • Duplicated block (9–10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1964 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1964-1973 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2808-2816 — 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 `CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1964` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–9 lines × 2) · ×1
  • Duplicated block (6–9 lines × 2) CodexMobile/CodexMobile/Services/GitActionsService.swift:29 — CodexMobile/CodexMobile/Services/GitActionsService.swift:29-34 | CodexMobile/CodexMobile/Services/GitActionsService.swift:49-57 — 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 `CodexMobile/CodexMobile/Services/GitActionsService.swift:29` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1757 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1757-1763 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1935-1942 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1999-2006 — 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.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) CodexMobile/CodexMobile/Views/Turn/Core/TurnToolbarContent.swift:359 — CodexMobile/CodexMobile/Views/Turn/Core/TurnToolbarContent.swift:359-365 | CodexMobile/CodexMobile/Views/Turn/Git/TurnGitActionsToolbar.swift:188-193 — 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 `CodexMobile/CodexMobile/Views/Turn/Core/TurnToolbarContent.swift:359` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×1
  • Duplicated block (6 lines × 4) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3105 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3105-3110 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3126-3131 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3159-3164 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:846-851 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:41 — CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:41-45 | CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:47-51 | CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift:58-62 | CodexMobile/CodexMobile/Services/CodexThreadListPersistence.swift:44-48 — before extracting anything, compare `CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift` and `CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 39 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.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×1
  • Duplicated block (8 lines × 3) CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:127 — CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:127-134 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:236-243 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionStatusBadge.swift:77-84 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 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 3 times.
D4 · Code Duplication · Duplicated block (5 lines × 9) · ×1
  • Duplicated block (5 lines × 9) CodexMobile/CodexMobile/Services/CodexService+AIChangeSets.swift:704 — CodexMobile/CodexMobile/Services/CodexService+AIChangeSets.swift:704-711 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3710-3717 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3879-3886 | CodexMobile/CodexMobile/Services/CodexService+IncomingPlanMode.swift:146-153 | CodexMobile/CodexMobile/Services/CodexService+IncomingPlanMode.swift:155-162 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6898-6905 | CodexMobile/CodexMobile/Services/CodexService+ThreadProjectRouting.swift:299-306 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1154-1161 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3291-3295 — there are 9 copies across 6 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 9 sites; resolving a subset leaves the remainder to drift apart.
R1 · Type Safety · Type Safety · ×1
  • Type Safety — 0 typed · 110 plain JS — the untyped files are phodex-bridge/scripts/cleanup-private-defaults.js, phodex-bridge/scripts/prepare-private-defaults.js, phodex-bridge/src/account-status.js, phodex-bridge/src/apply-patch-changes.js, phodex-bridge/src/bootstrap-codex-cli.js, phodex-bridge/src/bridge-status.js (+104 more).
R10 · Code Duplication · Duplicated block with local edits (161 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (161 matched lines × 2 locations) relay/phodex-backend-relay.mjs:19 — relay/phodex-backend-relay.mjs:19 · relay/relay.js:33 — the two spans are one implementation copied and then locally edited — 965 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (115 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (115 matched lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js:2843 — phodex-bridge/src/desktop-ipc-action-follower.js:2843 · phodex-bridge/src/desktop-ipc-owner-transport.js:72 — the two spans are one implementation copied and then locally edited — 617 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (35 lines × 3 locations) · ×1
  • Duplicated block (35 lines × 3 locations) phodex-bridge/src/pet-handler.js:17 — phodex-bridge/src/pet-handler.js:17 · phodex-bridge/src/project-handler.js:24 · phodex-bridge/src/workspace-handler.js:46 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (32 lines × 3 locations) · ×1
  • Duplicated block (32 lines × 3 locations) phodex-bridge/src/desktop-handler.js:26 — phodex-bridge/src/desktop-handler.js:26 · phodex-bridge/src/project-handler.js:28 · phodex-bridge/src/workspace-handler.js:48 — the 3 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. There is one copy in each of 3 separate files rather than several in one place, so check first whether these are sibling modules that each declare their own version of one shape — one per entity, per provider, per language. Where they are, no single extracted module collapses them: each module still has to be written, and what recurs is the TEMPLATE. The moves that do collapse a template are to generate these modules from the set they enumerate, or to replace the repeated construction with one factory each site calls with its own values — and where the set is the point, each module pinning one distinct thing, the repetition IS the enumeration and there is nothing to delete.
R10 · Code Duplication · Duplicated block with local edits (32 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (32 matched lines × 2 locations) REDACTED:843 — REDACTED:843 · relay/relay.js:629 — the two spans are one implementation copied and then locally edited — 132 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (31 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (31 matched lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js:4192 — phodex-bridge/src/desktop-ipc-action-follower.js:4192 · phodex-bridge/src/desktop-ipc-state-patches.js:162 — the two spans are one implementation copied and then locally edited — 162 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (29 lines × 2 locations) · ×1
  • Duplicated block (29 lines × 2 locations) phodex-bridge/src/desktop-handler.js:209 — phodex-bridge/src/desktop-handler.js:209 · phodex-bridge/src/desktop-handler.js:245 — 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.
R10 · Code Duplication · Duplicated block (27 lines × 2 locations) · ×1
  • Duplicated block (27 lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js:1090 — phodex-bridge/src/desktop-ipc-action-follower.js:1090 · phodex-bridge/src/desktop-ipc-live-owner.js:1355 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (22 lines × 2 locations) · ×1
  • Duplicated block (22 lines × 2 locations) phodex-bridge/src/git-handler.js:2998 — phodex-bridge/src/git-handler.js:2998 · phodex-bridge/src/workspace-handler.js:1323 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (20 lines × 2 locations) · ×1
  • Duplicated block (20 lines × 2 locations) phodex-bridge/bin/remodex.js:103 — phodex-bridge/bin/remodex.js:103 · phodex-bridge/bin/remodex.js:124 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (19 lines × 2 locations) · ×1
  • Duplicated block (19 lines × 2 locations) phodex-bridge/src/desktop-ipc-conversation-projector.js:1011 — phodex-bridge/src/desktop-ipc-conversation-projector.js:1011 · phodex-bridge/src/desktop-ipc-conversation-projector.js:1234 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (18 lines × 2 locations) · ×1
  • Duplicated block (18 lines × 2 locations) phodex-bridge/src/bridge.js:4083 — phodex-bridge/src/bridge.js:4083 · phodex-bridge/src/bridge.js:4106 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (18 lines × 4 locations) · ×1
  • Duplicated block (18 lines × 4 locations) phodex-bridge/src/notifications-handler.js:8 — phodex-bridge/src/notifications-handler.js:8 · phodex-bridge/src/pet-handler.js:19 · phodex-bridge/src/project-handler.js:28 · phodex-bridge/src/workspace-handler.js:48 — the 4 copies are spread across 4 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (17 lines × 2 locations) · ×1
  • Duplicated block (17 lines × 2 locations) REDACTED:245 — REDACTED:245 · REDACTED:274 — all 2 copies are in the same file, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block with local edits (15 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (15 matched lines × 2 locations) phodex-bridge/src/codex-desktop-refresher.js:659 — phodex-bridge/src/codex-desktop-refresher.js:659 · phodex-bridge/src/desktop-ipc-live-owner.js:1136 — the two spans are one implementation copied and then locally edited — 69 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block (14 lines × 3 locations) · ×1
  • Duplicated block (14 lines × 3 locations) phodex-bridge/src/desktop-ipc-conversation-adapter.js:922 — phodex-bridge/src/desktop-ipc-conversation-adapter.js:922 · phodex-bridge/src/desktop-ipc-conversation-projector.js:1016 · phodex-bridge/src/desktop-ipc-conversation-projector.js:1247 — the 3 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication · Duplicated block (13 lines × 3 locations) · ×1
  • Duplicated block (13 lines × 3 locations) phodex-bridge/src/desktop-ipc-action-follower.js:712 — phodex-bridge/src/desktop-ipc-action-follower.js:712 · phodex-bridge/src/desktop-ipc-action-follower.js:1018 · phodex-bridge/src/desktop-ipc-live-owner.js:460 — the 3 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R2 · Cyclomatic Complexity · Complex function applyAppServerMessageToConversationState (cyclomatic 95, cognitive 97) · ×1
  • Complex function applyAppServerMessageToConversationState (cyclomatic 95, cognitive 97) phodex-bridge/src/desktop-ipc-conversation-adapter.js:143 — applyAppServerMessageToConversationState has cyclomatic complexity 95 and cognitive complexity 97; 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 parseSessionJsonlTurns (cyclomatic 67, cognitive 124) · ×1
  • Complex function parseSessionJsonlTurns (cyclomatic 67, cognitive 124) phodex-bridge/src/session-jsonl-history.js:400 — parseSessionJsonlTurns has cyclomatic complexity 67 and cognitive complexity 124; 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 synthesizeNotificationsFromRolloutEntry (cyclomatic 56, cognitive 83) · ×1
  • Complex function synthesizeNotificationsFromRolloutEntry (cyclomatic 56, cognitive 83) phodex-bridge/src/rollout-live-mirror.js:938 — synthesizeNotificationsFromRolloutEntry has cyclomatic complexity 56 and cognitive complexity 83; 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 synchronizeDesktopConversationCompatibility (cyclomatic 55, cognitive 42) · ×1
  • Complex function synchronizeDesktopConversationCompatibility (cyclomatic 55, cognitive 42) phodex-bridge/src/desktop-ipc-conversation-adapter.js:619 — synchronizeDesktopConversationCompatibility has cyclomatic complexity 55 and cognitive complexity 42; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function handleRequest (cyclomatic 54, cognitive 73) · ×1
  • Complex function handleRequest (cyclomatic 54, cognitive 73) phodex-bridge/src/opencode-runtime.js:1228 — handleRequest has cyclomatic complexity 54 and cognitive complexity 73; 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 observeInbound (cyclomatic 52, cognitive 73) · ×1
  • Complex function observeInbound (cyclomatic 52, cognitive 73) phodex-bridge/src/desktop-ipc-action-follower.js:507 — observeInbound has cyclomatic complexity 52 and cognitive complexity 73; 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 onEnvelope (cyclomatic 47, cognitive 64) · ×1
  • Complex function onEnvelope (cyclomatic 47, cognitive 64) phodex-bridge/src/desktop-ipc-action-follower.js:762 — onEnvelope has cyclomatic complexity 47 and cognitive complexity 64; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function buildConversationStateFromThread (cyclomatic 45, cognitive 32) · ×1
  • Complex function buildConversationStateFromThread (cyclomatic 45, cognitive 32) phodex-bridge/src/desktop-ipc-conversation-adapter.js:445 — buildConversationStateFromThread has cyclomatic complexity 45 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 sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function refreshTouchedNormalizedActiveTurns (cyclomatic 44, cognitive 73) · ×1
  • Complex function refreshTouchedNormalizedActiveTurns (cyclomatic 44, cognitive 73) phodex-bridge/src/desktop-ipc-action-follower.js:3497 — refreshTouchedNormalizedActiveTurns has cyclomatic complexity 44 and cognitive complexity 73; 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 diagnoseSessionJsonl (cyclomatic 44, cognitive 49) · ×1
  • Complex function diagnoseSessionJsonl (cyclomatic 44, cognitive 49) phodex-bridge/bin/remodex-jsonl-diagnose.js:72 — diagnoseSessionJsonl has cyclomatic complexity 44 and cognitive complexity 49; 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 poll (cyclomatic 43, cognitive 43) · ×1
  • Complex function poll (cyclomatic 43, cognitive 43) phodex-bridge/src/opencode-runtime.js:588 — poll has cyclomatic complexity 43 and cognitive complexity 43; 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 observeOutbound (cyclomatic 42, cognitive 50) · ×1
  • Complex function observeOutbound (cyclomatic 42, cognitive 50) phodex-bridge/src/desktop-ipc-live-owner.js:327 — observeOutbound has cyclomatic complexity 42 and cognitive complexity 50; 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 bootstrapFromExistingRollout (cyclomatic 37, cognitive 48) · ×1
  • Complex function bootstrapFromExistingRollout (cyclomatic 37, cognitive 48) phodex-bridge/src/rollout-live-mirror.js:435 — bootstrapFromExistingRollout has cyclomatic complexity 37 and cognitive complexity 48; 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 projectConversationState (cyclomatic 35, cognitive 23) · ×1
  • Complex function projectConversationState (cyclomatic 35, cognitive 23) phodex-bridge/src/desktop-ipc-conversation-projector.js:179 — projectConversationState has cyclomatic complexity 35 and cognitive complexity 23; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizeRelayBoundJsonRpcMessage (cyclomatic 33, cognitive 30) · ×1
  • Complex function normalizeRelayBoundJsonRpcMessage (cyclomatic 33, cognitive 30) phodex-bridge/src/bridge.js:3474 — normalizeRelayBoundJsonRpcMessage has cyclomatic complexity 33 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function processEvent (cyclomatic 33, cognitive 28) · ×1
  • Complex function processEvent (cyclomatic 33, cognitive 28) phodex-bridge/src/opencode-runtime.js:865 — processEvent has cyclomatic complexity 33 and cognitive complexity 28; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function inspectBootstrapRunBoundary (cyclomatic 31, cognitive 43) · ×1
  • Complex function inspectBootstrapRunBoundary (cyclomatic 31, cognitive 43) phodex-bridge/src/rollout-live-mirror.js:671 — inspectBootstrapRunBoundary has cyclomatic complexity 31 and cognitive complexity 43; 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 gitRunStackedAction (cyclomatic 31, cognitive 31) · ×1
  • Complex function gitRunStackedAction (cyclomatic 31, cognitive 31) phodex-bridge/src/git-handler.js:1036 — gitRunStackedAction has cyclomatic complexity 31 and cognitive complexity 31; 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 emitItem (cyclomatic 31, cognitive 30) · ×1
  • Complex function emitItem (cyclomatic 31, cognitive 30) phodex-bridge/src/opencode-runtime.js:649 — emitItem has cyclomatic complexity 31 and cognitive complexity 30; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function createNormalizedLiveIndex (cyclomatic 30, cognitive 49) · ×1
  • Complex function createNormalizedLiveIndex (cyclomatic 30, cognitive 49) phodex-bridge/src/desktop-ipc-action-follower.js:3372 — createNormalizedLiveIndex has cyclomatic complexity 30 and cognitive complexity 49; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · phodex-bridge/src/bridge.js · ×1
  • phodex-bridge/src/bridge.js: 5024 lines of code phodex-bridge/src/bridge.js:1 — phodex-bridge/src/bridge.js has 5024 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/desktop-ipc-action-follower.js · ×1
  • phodex-bridge/src/desktop-ipc-action-follower.js: 4011 lines of code phodex-bridge/src/desktop-ipc-action-follower.js:1 — phodex-bridge/src/desktop-ipc-action-follower.js has 4011 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/git-handler.js · ×1
  • phodex-bridge/src/git-handler.js: 2714 lines of code phodex-bridge/src/git-handler.js:1 — phodex-bridge/src/git-handler.js has 2714 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/rollout-live-mirror.js · ×1
  • phodex-bridge/src/rollout-live-mirror.js: 2081 lines of code phodex-bridge/src/rollout-live-mirror.js:1 — phodex-bridge/src/rollout-live-mirror.js has 2081 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/desktop-ipc-live-owner.js · ×1
  • phodex-bridge/src/desktop-ipc-live-owner.js: 1949 lines of code phodex-bridge/src/desktop-ipc-live-owner.js:1 — phodex-bridge/src/desktop-ipc-live-owner.js has 1949 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/desktop-ipc-conversation-adapter.js · ×1
  • phodex-bridge/src/desktop-ipc-conversation-adapter.js: 1397 lines of code phodex-bridge/src/desktop-ipc-conversation-adapter.js:1 — phodex-bridge/src/desktop-ipc-conversation-adapter.js has 1397 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/session-jsonl-history.js · ×1
  • phodex-bridge/src/session-jsonl-history.js: 1381 lines of code phodex-bridge/src/session-jsonl-history.js:1 — phodex-bridge/src/session-jsonl-history.js has 1381 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/opencode-runtime.js · ×1
  • phodex-bridge/src/opencode-runtime.js: 1362 lines of code phodex-bridge/src/opencode-runtime.js:1 — phodex-bridge/src/opencode-runtime.js has 1362 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/workspace-handler.js · ×1
  • phodex-bridge/src/workspace-handler.js: 1211 lines of code phodex-bridge/src/workspace-handler.js:1 — phodex-bridge/src/workspace-handler.js has 1211 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/desktop-ipc-conversation-projector.js · ×1
  • phodex-bridge/src/desktop-ipc-conversation-projector.js: 1199 lines of code phodex-bridge/src/desktop-ipc-conversation-projector.js:1 — phodex-bridge/src/desktop-ipc-conversation-projector.js has 1199 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/push-notification-tracker.js · ×1
  • phodex-bridge/src/push-notification-tracker.js: 896 lines of code phodex-bridge/src/push-notification-tracker.js:1 — phodex-bridge/src/push-notification-tracker.js has 896 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 890 lines of code REDACTED:1 — REDACTED has 890 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/codex-desktop-refresher.js · ×1
  • phodex-bridge/src/codex-desktop-refresher.js: 865 lines of code phodex-bridge/src/codex-desktop-refresher.js:1 — phodex-bridge/src/codex-desktop-refresher.js has 865 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/rollout-watch.js · ×1
  • phodex-bridge/src/rollout-watch.js: 847 lines of code phodex-bridge/src/rollout-watch.js:1 — phodex-bridge/src/rollout-watch.js has 847 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/desktop-ipc-owner-transport.js · ×1
  • phodex-bridge/src/desktop-ipc-owner-transport.js: 769 lines of code phodex-bridge/src/desktop-ipc-owner-transport.js:1 — phodex-bridge/src/desktop-ipc-owner-transport.js has 769 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 677 lines of code REDACTED:1 — REDACTED has 677 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · relay/relay.js · ×1
  • relay/relay.js: 653 lines of code relay/relay.js:1 — relay/relay.js has 653 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/macos-launch-agent.js · ×1
  • phodex-bridge/src/macos-launch-agent.js: 644 lines of code phodex-bridge/src/macos-launch-agent.js:1 — phodex-bridge/src/macos-launch-agent.js has 644 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/thread-activity-projector.js · ×1
  • phodex-bridge/src/thread-activity-projector.js: 637 lines of code phodex-bridge/src/thread-activity-projector.js:1 — phodex-bridge/src/thread-activity-projector.js has 637 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/project-handler.js · ×1
  • phodex-bridge/src/project-handler.js: 559 lines of code phodex-bridge/src/project-handler.js:1 — phodex-bridge/src/project-handler.js has 559 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/voice-handler.js · ×1
  • phodex-bridge/src/voice-handler.js: 539 lines of code phodex-bridge/src/voice-handler.js:1 — phodex-bridge/src/voice-handler.js has 539 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/desktop-handler.js · ×1
  • phodex-bridge/src/desktop-handler.js: 507 lines of code phodex-bridge/src/desktop-handler.js:1 — phodex-bridge/src/desktop-handler.js has 507 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/pet-handler.js · ×1
  • phodex-bridge/src/pet-handler.js: 468 lines of code phodex-bridge/src/pet-handler.js:1 — phodex-bridge/src/pet-handler.js has 468 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · REDACTED · ×1
  • REDACTED: 460 lines of code REDACTED:1 — REDACTED has 460 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files · phodex-bridge/src/secure-device-state.js · ×1
  • phodex-bridge/src/secure-device-state.js: 433 lines of code phodex-bridge/src/secure-device-state.js:1 — phodex-bridge/src/secure-device-state.js has 433 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling · No lint or typecheck script · ×1
  • No lint or typecheck script — test ✓ · lint ✗ · typecheck ✗ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
R7 · Dead Code · Dead file (~343 LoC) · ×1
  • Dead file (~343 LoC) relay/phodex-backend-relay.mjs — no import path from any entry point (9 application, 6 tooling, 51 test roots considered), and no other file in the scanned tree imports it — nothing in-repo names this module at all, which is the strongest form of this claim the import graph can make
Minor — 94 finding(s)
P2 · Observability · Console output used as the logging channel · ×39
  • Console output used as the logging channel phodex-bridge/src/bridge.js:727 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 727 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:728 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 728 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:736 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 736 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:988 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 988 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:990 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 990 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:991 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 991 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:992 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 992 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:994 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 994 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:1043 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1043 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:1072 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1072 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:1094 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1094 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:1265 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1265 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:1314 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1314 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:1709 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1709 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:2261 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 2261 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:2482 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 2482 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:3880 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 3880 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/bridge.js:3917 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 3917 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/codex-desktop-refresher.js:581 — `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 581 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/codex-desktop-refresher.js:586 — `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 586 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/codex-desktop-refresher.js:617 — `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 617 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/desktop-ipc-action-follower.js:2335 — `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2335 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/desktop-ipc-action-follower.js:2498 — `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2498 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/desktop-ipc-action-follower.js:2587 — `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2587 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • Console output used as the logging channel phodex-bridge/src/desktop-ipc-action-follower.js:2684 — `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2684 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
  • + 14 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate relay/phodex-backend-relay.mjs:224 — `!Number.isFinite(registration.pairingExpiresAt) || now > registration.pairingExpiresAt` appears character-identically in 2 files — relay/phodex-backend-relay.mjs, relay/relay.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/bridge.js:2902 — `!params || typeof params !== "object" || Array.isArray(params)` appears character-identically in 2 files — phodex-bridge/src/bridge.js, phodex-bridge/src/rollout-live-mirror.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/bridge.js:2889 — `!parsed || typeof parsed !== "object" || Array.isArray(parsed)` appears character-identically in 2 files — phodex-bridge/src/bridge.js, phodex-bridge/src/push-notification-tracker.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate relay/phodex-backend-relay.mjs:220 — `!registration || !hasActiveMacSession(registration.sessionId)` appears character-identically in 2 files — relay/phodex-backend-relay.mjs, relay/relay.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate relay/phodex-backend-relay.mjs:230 — `!registration.macDeviceId || !registration.macIdentityPublicKey || !Number.isFinite(registration.pairingVersion)` appears character-identically in 2 files — relay/phodex-backend-relay.mjs, relay/relay.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/apply-patch-changes.js:171 — `!relativePath || relativePath.startsWith("..") || path.isAbsolute(relativePath)` appears character-identically in 2 files — phodex-bridge/src/apply-patch-changes.js, phodex-bridge/src/worktree-origin.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate relay/phodex-backend-relay.mjs:61 — `!sessionId || (role !== "mac" && !isRelayMobileRole(role))` appears character-identically in 2 files — relay/phodex-backend-relay.mjs, relay/relay.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/desktop-ipc-action-follower.js:4192 — `Array.isArray(parent) && Number.isInteger(key)` appears character-identically in 2 files — phodex-bridge/src/desktop-ipc-action-follower.js, phodex-bridge/src/desktop-ipc-state-patches.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate relay/phodex-backend-relay.mjs:170 — `client.readyState === WebSocket.OPEN || client.readyState === WebSocket.CONNECTING` appears character-identically in 2 files — relay/phodex-backend-relay.mjs, relay/relay.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/desktop-ipc-action-follower.js:765 — `envelope.params?.clientId || envelope.sourceClientId` appears character-identically in 2 files — phodex-bridge/src/desktop-ipc-action-follower.js, phodex-bridge/src/desktop-ipc-live-owner.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/desktop-ipc-action-follower.js:2878 — `error?.code !== "ENOENT" && error?.code !== "ECONNREFUSED"` appears character-identically in 2 files — phodex-bridge/src/desktop-ipc-action-follower.js, phodex-bridge/src/desktop-ipc-owner-transport.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate relay/phodex-backend-relay.mjs:118 — `existingClient.readyState === WebSocket.OPEN || existingClient.readyState === WebSocket.CONNECTING` appears character-identically in 2 files — relay/phodex-backend-relay.mjs, relay/relay.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/desktop-ipc-action-follower.js:1073 — `followerClientIdsByThreadId.get(threadId) || new Set()` appears character-identically in 2 files — phodex-bridge/src/desktop-ipc-action-follower.js, phodex-bridge/src/desktop-ipc-live-owner.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate relay/phodex-backend-relay.mjs:71 — `isRelayMobileRole(role) && !sessions.has(sessionId)` appears character-identically in 2 files — relay/phodex-backend-relay.mjs, relay/relay.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/desktop-ipc-action-follower.js:2121 — `item?.review && typeof item.review === "object"` appears character-identically in 2 files — phodex-bridge/src/desktop-ipc-action-follower.js, phodex-bridge/src/desktop-ipc-conversation-projector.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/apply-patch-changes.js:109 — `line.startsWith("+") && !line.startsWith("+++")` appears character-identically in 2 files — phodex-bridge/src/apply-patch-changes.js, phodex-bridge/src/workspace-handler.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/apply-patch-changes.js:111 — `line.startsWith("-") && !line.startsWith("---")` appears character-identically in 2 files — phodex-bridge/src/apply-patch-changes.js, phodex-bridge/src/workspace-handler.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/opencode-runtime.js:1252 — `method === "thread/read" || method === "thread/resume"` appears character-identically in 2 files — phodex-bridge/src/opencode-runtime.js, phodex-bridge/src/thread-row-enrichment.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/thread-list-provenance.js:67 — `normalizeString(thread?.id) || normalizeString(thread?.threadId)` appears character-identically in 2 files — phodex-bridge/src/thread-list-provenance.js, phodex-bridge/src/thread-runtime-settings-store.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/desktop-ipc-action-follower.js:2604 — `normalized && typeof normalized === "object" && !Array.isArray(normalized)` appears character-identically in 2 files — phodex-bridge/src/desktop-ipc-action-follower.js, phodex-bridge/src/desktop-ipc-live-owner.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/rollout-live-mirror.js:2034 — `normalized === "exec_command" || normalized === "shell_command"` appears character-identically in 2 files — phodex-bridge/src/rollout-live-mirror.js, phodex-bridge/src/session-jsonl-history.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/pet-handler.js:66 — `params.includeData !== false && params.metadataOnly !== true` appears character-identically in 2 files — phodex-bridge/src/pet-handler.js, phodex-bridge/src/workspace-handler.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/codex-home.js:11 — `process.env.CODEX_HOME || path.join(os.homedir(), ".codex")` appears character-identically in 4 files — phodex-bridge/src/codex-home.js, phodex-bridge/src/git-handler.js, phodex-bridge/src/rollout-watch.js, phodex-bridge/src/worktree-origin.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/desktop-ipc-action-follower.js:2162 — `readString(item.decisionSource) || readString(item?.event?.decision_source) || null` appears character-identically in 2 files — phodex-bridge/src/desktop-ipc-action-follower.js, phodex-bridge/src/desktop-ipc-conversation-projector.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate phodex-bridge/src/desktop-ipc-action-follower.js:226 — `readString(item?.id) || readString(item?.itemId) || readString(item?.item_id)` appears character-identically in 3 files — phodex-bridge/src/desktop-ipc-action-follower.js, phodex-bridge/src/desktop-ipc-conversation-projector.js, phodex-bridge/src/thread-activity-projector.js. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
X7 · Silent fallback defaults · Silent fallback default in catch · ×15
  • Silent fallback default in catch CodexMobile/RemodexMenuBar/BridgeControlService.swift:446 — `nvmExecutableCandidates` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:414 — `markdownLinkTargets` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:429 — `absoluteImagePathMatches` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). 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 at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
  • Silent fallback default in catch phodex-bridge/src/workspace-handler.js:1017 — `findStagedTargetedFiles` 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.
  • Silent fallback default in catch phodex-bridge/src/secure-device-state.js:335 — `deleteKeychainStateString` swallows every exception into `return false` — 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.
  • Silent fallback default in catch phodex-bridge/src/secure-device-state.js:368 — `deleteCanonicalFileState` swallows every exception into `return false` — 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.
  • Silent fallback default in catch REDACTED:861 — `verifyTranscript` swallows every exception into `return false` — 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.
  • Silent fallback default in catch phodex-bridge/src/worktree-origin.js:138 — `readOwningCheckoutRoot` 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.
  • Silent fallback default in catch phodex-bridge/src/bridge.js:3722 — `readJsonlThreadCwd` 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.
  • Silent fallback default in catch relay/phodex-backend-relay.mjs:36 — `readRelayRole` 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.
  • Silent fallback default in catch relay/push-service.js:317 — `readAPNsPrivateKey` 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.
  • Silent fallback default in catch relay/relay.js:52 — `readRelayRole` 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.
  • Silent fallback default in catch relay/relay.js:647 — `verifyTrustedSessionResolveSignature` swallows every exception into `return false` — 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.
  • Silent fallback default in catch relay/server.js:287 — `safePathname` 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.
  • Silent fallback default in catch relay/server.js:345 — `readUpgradeRole` 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.
M4 · Documentation accuracy · README/code drift · ×4
  • README/code drift phodex-bridge/README.md:36 — phodex-bridge/README.md links to `SELF_HOSTING_MODEL.md`, but `phodex-bridge/SELF_HOSTING_MODEL.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift phodex-bridge/README.md:40 — phodex-bridge/README.md links to `CONTRIBUTING.md`, but `phodex-bridge/CONTRIBUTING.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift phodex-bridge/README.md:204 — phodex-bridge/README.md links to `Docs/self-hosting.md`, but `phodex-bridge/Docs/self-hosting.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift phodex-bridge/README.md:395 — phodex-bridge/README.md links to `relay/`, but `phodex-bridge/relay` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 3 project(s) overshoot their size bounds, lowering Project Cohesion to 3.3/10. The most over is `CodexMobile` (106587 LoC, 880 module-visible types across 27 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.
D34 · Knowledge Freshness · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 1 of 266 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (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; 266 of the 325 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: CodexMobile/CodexMobile/RemodexQuickActionCenter.swift. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D34 · Knowledge Freshness · Orphaned file · ×1
  • Orphaned file CodexMobile/CodexMobile/RemodexQuickActionCenter.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
M3 · Folder & project structure · No src/ separation · ×1
  • No src/ separation — Production code isn't grouped under a src/ folder — it's spread across several top-level directories, so there's no one place that says 'this is the product'.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 1/3 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `CodexMobile`, `relay`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST — 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 3964 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.
R7 · Dead Code · Unused module-local declaration 'hasTrustedPhones' · ×1
  • Unused module-local declaration 'hasTrustedPhones' phodex-bridge/src/secure-device-state.js:173 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
R7 · Dead Code · Unused module-local declaration 'responseItemContentText' · ×1
  • Unused module-local declaration 'responseItemContentText' phodex-bridge/src/session-jsonl-history.js:1423 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
Minor — 1 finding(s)
D12 · Dependency Hygiene · Outdated (npm) · ×1
  • Outdated (npm): ws — ws is pinned at 8.21.0; registry.npmjs.org publishes 8.22.0 as the latest release. Upgrading is a judgement call — read that package's changelog for what changed between the two — but a direct production dependency several releases behind is where security and compatibility debt accumulates silently.

Appendix B — Reproduction & audit trail

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

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

Run 01a184a6-1b1b-7147-9336-e727e6b0fad9 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

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

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