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

Emanuele-web04/remodex

Measured 14 November 2026, 22:40 UTC, at code version c06dcb1

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 47out of 100 Weak
CriticalWeakAdequateStrongExemplary
Down 1 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,923 lines of product code in 5 projects, tests not counted · Estimated rebuild effort: about 0.9 person-years · Weakest lens: Code Health, 32

Findings by how serious they are

12 critical 1381 serious 117 minor

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

This survey was produced by

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

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

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

52of 52 dimensions measured by tools.
1499of 1510 findings point to an exact file and line, so you can open each one in the code. The other 11 concern the repository as a whole, such as missing documentation.
52dimensions across 7 lenses, read from 106,923 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 47 out of 100 and is rated Weak, and eight of its 12 critical findings are security problems.

Code Health, at 32, is the weakest lens and counts most in the score. The best first step for the work it takes is fixing the password or key in the code, worth about 3 points. Adding type checking would lift Code Health itself, worth about 6 points. Raising Code Health to 70 would lift the score to about 59.

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. Replacing the exposed password or key, pinning each tool to an exact version and updating the vulnerable packages 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,923 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 32 · counts for 46%Production Readiness 52 · counts for 25%Performance 60 · counts for 14%Maturity 60 · counts for 8%Event-Driven 79 · counts for 4%Security and Compliance 85 · counts for 2%Architecture 94 · counts for 1%

If Code Health rose from 32 to 70, the lowest score rated Strong, the score would rise from 47 to about 59.

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

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

  • Cyclomatic Complexity · CodexService.checkMissingCatalogThreads (cyclomatic 27) CodexMobile/CodexMobile/Services/CodexService+Sync.swift
  • Cyclomatic Complexity · fileChangePatchKey (cyclomatic 22) phodex-bridge/src/session-jsonl-history.js
  • Cyclomatic Complexity · bridge.startBridge.rememberForwardedRequestMethod (cyclomatic 21) phodex-bridge/src/bridge.js
  • Cyclomatic Complexity · bridge.startBridge.sanitizeRelayBoundCodexMessage (cyclomatic 21) phodex-bridge/src/bridge.js
  • Cyclomatic Complexity · startBridge.sanitizeRelayBoundCodexMessage (cyclomatic 21) phodex-bridge/src/bridge.js
  • Cyclomatic Complexity · TurnViewModel.steerQueuedDraft (cyclomatic 19) REDACTED
  • Cyclomatic Complexity · desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState (cyclomatic 19) phodex-bridge/src/desktop-ipc-live-owner.js
  • Cyclomatic Complexity · bridge.shouldMergeLatestJsonlTurn (cyclomatic 19) phodex-bridge/src/bridge.js
  • Cyclomatic Complexity · maybeMergeLatestJsonlTurnIntoTurnsListResponse (cyclomatic 19) phodex-bridge/src/bridge.js
  • Cyclomatic Complexity · desktop-handler.openThreadOnDesktop (cyclomatic 17) phodex-bridge/src/desktop-handler.js
  • Cyclomatic Complexity · bridge.reconcileLegacyHomeThreadProject (cyclomatic 17) phodex-bridge/src/bridge.js
  • Cyclomatic Complexity · desktop-ipc-shared.createFrameReader.push (cyclomatic 16) REDACTED
  • Cyclomatic Complexity · createFrameReader.push (cyclomatic 16) REDACTED
  • Cognitive Complexity · TurnViewModel.steerQueuedDraft (cognitive 37) REDACTED
  • Cognitive Complexity · CodexService.checkMissingCatalogThreads (cognitive 32) CodexMobile/CodexMobile/Services/CodexService+Sync.swift
  • Cognitive Complexity · desktop-ipc-shared.createFrameReader.push (cognitive 30) REDACTED
  • Cognitive Complexity · createFrameReader.push (cognitive 30) REDACTED
  • Cognitive Complexity · fileChangePatchKey (cognitive 24) phodex-bridge/src/session-jsonl-history.js
  • Cognitive Complexity · bridge.startBridge.sanitizeRelayBoundCodexMessage (cognitive 23) phodex-bridge/src/bridge.js
  • Cognitive Complexity · startBridge.sanitizeRelayBoundCodexMessage (cognitive 23) phodex-bridge/src/bridge.js
  • Cognitive Complexity · bridge.startBridge.rememberForwardedRequestMethod (cognitive 21) phodex-bridge/src/bridge.js
  • Cognitive Complexity · openThreadOnDesktop (cognitive 21) phodex-bridge/src/desktop-handler.js
  • Cognitive Complexity · TurnDiffRenderingPolicy.section (cognitive 19) CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift
  • Cognitive Complexity · CodexService.setForegroundState (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+Sync.swift
  • Cognitive Complexity · bridge.startBridge.maybeBuildJsonlThreadTurnsListFallback (cognitive 17) phodex-bridge/src/bridge.js
  • Cognitive Complexity · startBridge.maybeBuildJsonlThreadTurnsListFallback (cognitive 17) phodex-bridge/src/bridge.js
  • God Classes · FunctionTooLong: desktop-handler.openThreadOnDesktop phodex-bridge/src/desktop-handler.js
  • God Classes · FunctionTooLong: secure-transport.createBridgeSecureTransport.handleClientAuth REDACTED
  • God Classes · MethodTooLong: CodexService.loadMacScopedDefaultsState CodexMobile/CodexMobile/Services/CodexService+MacContext.swift
  • Code Duplication · Edited copy of a member (25 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Account.swift
  • Code Duplication · Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+RuntimeCompatibility.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Code Duplication · Edited copy of a member (60 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Edited copy of a member (40 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (57 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift
  • Code Duplication · Edited copy of a member (50 corresponding lines) REDACTED
  • Code Duplication · Edited copy of a member (50 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift
  • Code Duplication · Edited copy of a member (45 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionStatusCard.swift
  • Code Duplication · Edited copy of a member (34 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (36 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (49 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Edited copy of a member (41 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift
  • Code Duplication · Edited copy of a member (23 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (26 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Edited copy of a member (28 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (38 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift
  • Code Duplication · Edited copy of a member (48 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift
  • Code Duplication · Edited copy of a member (38 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift
  • Code Duplication · Edited copy of a member (39 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift
  • Code Duplication · Edited copy of a member (48 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift
  • Code Duplication · Edited copy of a member (52 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Connection.swift
  • Code Duplication · Edited copy of a member (31 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (22 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (33 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift
  • Code Duplication · Edited copy of a member (29 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift
  • Code Duplication · Edited copy of a member (21 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnToolbarContent.swift
  • Code Duplication · Edited copy of a member (23 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift
  • Code Duplication · Edited copy of a member (48 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Code Duplication · Edited copy of a member (17 corresponding lines) CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift
  • Code Duplication · Edited copy of a member (19 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Composer/TurnAttachmentPipeline.swift
  • Code Duplication · Edited copies of one member (3 members, 29+ corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift
  • Code Duplication · Edited copy of a member (28 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Review.swift
  • Code Duplication · Edited copy of a member (33 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (24 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Models/GitActionModels.swift
  • Code Duplication · Edited copy of a member (35 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift
  • Code Duplication · Edited copy of a member (21 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift
  • Code Duplication · Edited copy of a member (19 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Code Duplication · Edited copy of a member (23 corresponding lines) CodexMobile/CodexMobile/Views/Onboarding/OnboardingView.swift
  • Code Duplication · Edited copy of a member (17 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Edited copy of a member (20 corresponding lines) CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift
  • Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift
  • Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift
  • Code Duplication · Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift
  • Code Duplication · Edited copy of a member (18 corresponding lines) REDACTED
  • Code Duplication · Edited copy of a member (21 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (29 corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListView.swift
  • Code Duplication · Edited copy of a member (11 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift
  • Code Duplication · Edited copy of a member (20 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift
  • Code Duplication · Edited copy of a member (22 corresponding lines) CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Views/Shared/CodexWorktreeIcon.swift
  • Code Duplication · Edited copy of a member (25 corresponding lines) CodexMobile/CodexMobile/Views/SidebarView.swift
  • Code Duplication · Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift
  • Code Duplication · Edited copy of a member (22 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift
  • Code Duplication · Edited copy of a member (19 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift
  • Code Duplication · Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/ContentView.swift
  • Code Duplication · Edited copy of a member (17 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift
  • Code Duplication · Edited copy of a member (17 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift
  • Code Duplication · Edited copy of a member (11 corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarFloatingSettingsButton.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/CodeCommentDirectiveParser.swift
  • Code Duplication · Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/Views/SidebarView.swift
  • Code Duplication · Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift
  • Code Duplication · Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Support/ConnectionRecoveryCard.swift

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

Fixed since the last survey: 208 findings

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

  • Cyclomatic Complexity · CodexService.refreshInFlightTurnState (cyclomatic 44) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Cyclomatic Complexity · CodexService.sendTurnStart (cyclomatic 32) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Cyclomatic Complexity · CodexService.startTurn (cyclomatic 19) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Cognitive Complexity · CodexService.refreshInFlightTurnState (cognitive 91) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Cognitive Complexity · CodexService.sendTurnStart (cognitive 55) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Cognitive Complexity · CodexService.startTurn (cognitive 27) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Cognitive Complexity · CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift
  • Cognitive Complexity · desktop-handler.continueOnDesktop (cognitive 17) phodex-bridge/src/desktop-handler.js
  • Cognitive Complexity · desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute (cognitive 17) phodex-bridge/src/desktop-ipc-action-follower.js
  • God Classes · MethodTooLong: CodexService.startTurn CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Code Duplication · Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift
  • Code Duplication · Duplicated block (21 lines × 5) CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift
  • Code Duplication · Duplicated block (20 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Duplicated block (17–19 lines × 2) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerMetaMapper.swift
  • Code Duplication · Duplicated block (18 lines × 4) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift
  • Code Duplication · Duplicated block (18 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Duplicated block (17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift
  • Code Duplication · Duplicated block (17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Duplicated block (14–17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Code Duplication · Duplicated block (16 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Duplicated block (16 lines × 2) CodexMobile/CodexMobile/Views/Terminal/TerminalConnectionHelpSheet.swift
  • Code Duplication · Duplicated block (9–15 lines × 3) CodexMobile/CodexMobile/Services/GitActionsService.swift
  • Code Duplication · Duplicated block (15 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Code Duplication · Duplicated block (14–15 lines × 3) CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift
  • Code Duplication · Duplicated block (14 lines × 3) CodexMobile/CodexMobile/Services/CodexService+Account.swift
  • Code Duplication · Duplicated block (14 lines × 2) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift
  • Code Duplication · Duplicated block (13 lines × 3) CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift
  • Code Duplication · Duplicated block (13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Connection.swift
  • Code Duplication · Duplicated block (12–13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift
  • Code Duplication · Duplicated block (13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift
  • Code Duplication · Duplicated block (12–13 lines × 2) CodexMobile/CodexMobile/Views/Sidebar/SidebarNewChatProjectPickerSheet.swift
  • Code Duplication · Duplicated block (12 lines × 2) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift
  • Code Duplication · Duplicated block (12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Duplicated block (11–12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Duplicated block (12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Duplicated block (10–11 lines × 4) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Duplicated block (11 lines × 2) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift
  • Code Duplication · Duplicated block (11 lines × 2) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift
  • Code Duplication · Duplicated block (11 lines × 2) CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift
  • Code Duplication · Duplicated block (11 lines × 2) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift
  • Code Duplication · Duplicated block (10 lines × 4) CodexMobile/CodexMobile/Services/CodexService+RuntimeCompatibility.swift
  • Code Duplication · Duplicated block (10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Connection.swift
  • Code Duplication · Duplicated block (10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Connection.swift
  • Code Duplication · Duplicated block (9–10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Duplicated block (10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Code Duplication · Duplicated block (10 lines × 2) CodexMobile/CodexMobile/Views/Turn/Messages/AutoApprovalReviewRow.swift
  • Code Duplication · Duplicated block (9 lines × 4) CodexMobile/CodexMobile/Services/CodexService+Connection.swift
  • Code Duplication · Duplicated block (9 lines × 4) CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift
  • Code Duplication · Duplicated block (8–9 lines × 2) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift
  • Code Duplication · Duplicated block (6–9 lines × 2) CodexMobile/CodexMobile/Services/GitActionsService.swift
  • Code Duplication · Duplicated block (9 lines × 2) CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift
  • Code Duplication · Duplicated block (8 lines × 4) CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift
  • Code Duplication · Duplicated block (8 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift
  • Code Duplication · Duplicated block (8 lines × 2) CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift
  • Code Duplication · Duplicated block (8 lines × 2) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift
  • Code Duplication · Duplicated block (7 lines × 2) CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift
  • Code Duplication · Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+TurnPaginationCompatibility.swift
  • Code Duplication · Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Services/GitActionsService.swift
  • Code Duplication · Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift
  • Code Duplication · Duplicated block (5 lines × 3) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift
  • Code Duplication · Duplicated block (5 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Duplicated block (5 lines × 2) CodexMobile/CodexMobile/Models/CodexCollaboration.swift
  • Code Duplication · Duplicated block (5 lines × 4) CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift
  • Code Duplication · Duplicated block (14 lines × 2) CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift
  • Code Duplication · Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift
  • Code Duplication · Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift
  • Code Duplication · Duplicated block (5 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift
  • Cohesion (LCOM4) · Low cohesion: TurnViewModel (LCOM4 5) phodex-bridge/test/fixtures/stream-recovery-harness.swift
  • Test Reliability · Flaky test: phodex-bridge/::live owner dedupes read-state broadcasts for already-clean threads
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Services/CodexService+Messages.swift CodexMobile/CodexMobile/Services/CodexService+Messages.swift
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift
  • Churn × Complexity Hotspots · Hotspot: phodex-bridge/src/rollout-live-mirror.js phodex-bridge/src/rollout-live-mirror.js
  • Churn × Complexity Hotspots · Hotspot: phodex-bridge/src/session-jsonl-history.js phodex-bridge/src/session-jsonl-history.js
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Services/CodexService.swift CodexMobile/CodexMobile/Services/CodexService.swift
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift
  • Churn × Complexity Hotspots · Hotspot: phodex-bridge/src/desktop-ipc-conversation-projector.js phodex-bridge/src/desktop-ipc-conversation-projector.js
  • Churn × Complexity Hotspots · Hotspot: REDACTED REDACTED
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Services/CodexService+Sync.swift CodexMobile/CodexMobile/Services/CodexService+Sync.swift
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift
  • Churn × Complexity Hotspots · Hotspot: phodex-bridge/src/git-handler.js phodex-bridge/src/git-handler.js
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift
  • Churn × Complexity Hotspots · Hotspot: phodex-bridge/src/push-notification-tracker.js phodex-bridge/src/push-notification-tracker.js
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Models/CodexMessage.swift CodexMobile/CodexMobile/Models/CodexMessage.swift
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Services/GPTVoiceTranscriptionManager.swift CodexMobile/CodexMobile/Services/GPTVoiceTranscriptionManager.swift
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Views/Turn/Git/TurnGitBranchSelector.swift CodexMobile/CodexMobile/Views/Turn/Git/TurnGitBranchSelector.swift
  • Churn × Complexity Hotspots · Hotspot: phodex-bridge/src/voice-handler.js phodex-bridge/src/voice-handler.js
  • Churn × Complexity Hotspots · Hotspot: CodexMobile/CodexMobile/Services/CodexService+Pets.swift CodexMobile/CodexMobile/Services/CodexService+Pets.swift
  • Change Coupling · Change-coupling hub: CodexService+Connection.swift → CodexService+SecureTransport.swift, CodexService+Transport.swift, ContentViewModel.swift, REDACTED CodexMobile/CodexMobile/Services/CodexService+Connection.swift
  • Change Coupling · Change-coupling hub: CodexService+SecureTransport.swift → ContentViewModel.swift, bridge.js, REDACTED CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift
  • Change Coupling · Change coupling: REDACTED ↔ git-handler.js REDACTED
  • Code Duplication · Duplicated block with local edits (115 matched lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js
Rebuild cost: about €130,000 · Estimate
Cost to rebuild€43,000 to €210,000, for 713 to 2,263 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 47. 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,923 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

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

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 32 (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
Resolve the 1 Leaked secret finding(s) in Secret Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 3 points for low effort, because it clears the 1 Secret Scanning findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.5 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 6% to 14% on every change. The history of the code shows how much it changes: about 25,413 lines over the last 90 days, which is about 103,064 lines a year. At that pace, the extra work comes to an estimated 16.2 to 97.3 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

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

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

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

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

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

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

At a glance — Security · 85% · Checked 3 of 8 ·

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

Top priorities: 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; Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package; Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.

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

Do thisHelpsEffortDimension
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.+3.4 ptsLowSecret Scanning
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.5 ptsMediumType Safety
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.+6.5 ptsMediumLarge Files
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj.+1.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.9 ptsMediumSecurity & performance tooling
Add eslint and type checking (adopt TypeScript, or type-check the existing JavaScript with `checkJs`) as package.json scripts and run them in CI.+2.2 ptsMediumTooling
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.+2.0 ptsMediumAsync & latency hygiene
Resolve the 40 finding(s) in Cyclomatic Complexity.+1.7 ptsMediumCyclomatic Complexity

File quality

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

FileScoreBandWorst signal
REDACTED1.1SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.7SlopSecret Scanning: Leaked secret: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift4.8MixedCyclomatic Complexity: CodexService.performSecureHandshake (cyclomatic 19)
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/Views/Turn/Timeline/TurnTimelineView.swift5.5MixedCyclomatic Complexity: TurnTimelineView.scheduleProgressiveTailRevealIfNeeded (cyclomatic 19)
CodexMobile/CodexMobile/Services/CodexService+IncomingAssistant.swift5.6MixedCyclomatic Complexity: CodexService.appendCompletedAgentText (cyclomatic 24)
CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift5.6MixedGod Classes: TooManyMethods: GhosttyTerminalView
CodexMobile/CodexMobile/Models/GitActionModels.swift5.7MixedCode Duplication: Edited copy of a member (10 corresponding lines)
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
CodexMobile/CodexMobile/Views/Turn/Messages/UserMessageBubble.swift6.0MixedExplicit Debt: TodoComment
phodex-bridge/src/opencode-runtime.js6.3MixedCyclomatic Complexity: opencode-runtime.createOpenCodeRuntime.handleRequest (cyclomatic 54)
phodex-bridge/src/session-jsonl-history.js6.5MixedCyclomatic Complexity: parseSessionJsonlTurns (cyclomatic 76)
phodex-bridge/src/bridge.js6.5MixedCyclomatic Complexity: bridge.startBridge (cyclomatic 57)

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

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

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

Could not be resolved — 25

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

Methodology & how to trust this report

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

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

What we checked — 52 dimensions across the health lenses
D1D2D3D4D5D6D10D12D13D14D15D17D19D20D21D24D26D27D28D29D30D34D35D43AX10AX3AX4AX8AX9ED4M1M2M3M4P1P10P2P3PF3R1R10R2R3R4R5R6R7R8R9X14X28X3

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, 1499 of 1510 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a1dc38-42af-7030-9229-a853dffa59b2.

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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: 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 91.3% — 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.
  • D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 1,293 test(s) behind this row are the ones the code-model census could read, and this repository also carries at least 55 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability NOT SCORED: this repository's production source includes .swift, and the 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/ (895 tests); node:test via `npm ci --ignore-scripts` in relay/ (46 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 (15 contributor(s) across 579 commit(s) sampled, automation and bot accounts excluded). One of them holds 92% of the history; the other 14 hold 0.6% 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.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
  • D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `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`, … (+67 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • D44 Platform End-of-Life — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
  • AX6 Interface segregation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check 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.
  • AXB2 Runtime readiness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. (rule: no-root-manifest). The renderer reported: the dev server (`npm run start`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
  • AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Render strategy: boot via DevServer (start). the dev server (`npm run start`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered.
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Swift is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • P2 Observability — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 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 — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 34 further occurrence(s) are not listed individually; the score already reflects all 74.
  • R2 Cyclomatic Complexity — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 161 further occurrence(s) are not listed individually; the score already reflects all 201.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X1 Async correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X10 Duplicated predicate — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 36 further occurrence(s) are not listed individually; the score already reflects all 76.
  • X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X13 Undrained process stream — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X2 Cancellation propagation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Go, PHP, Dart, Kotlin, Ruby, Scala, Java, Python and Rust source only, and no C# was loaded, and no named async function in this repository's JavaScript/TypeScript, nor any Go, PHP or Dart function or Kotlin suspend function, makes a request that can be cancelled (fetch, axios, ky, ofetch, got, undici, node:http; net/http, net.Dial; amphp; Dio; Ktor, OkHttp), so there is nothing to judge, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X21 Side-effecting pattern guard — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 35 further occurrence(s) are not listed individually; the score already reflects all 75.
  • X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP log through no library that carries a message's values as fields (pino, winston, bunyan, tslog, LogTape, roarr; Python's logging, structlog; PHP's PSR-3 loggers), so its log calls cannot be judged, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's Swift is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • 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 checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • 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: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.

Dimensions

D1 · Cyclomatic Complexity4.0 / 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.0 / 10 · rule-coverage 100% · ceiling Prevented

360 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:938
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:2055

+ 286 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.0 to about 4.6/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

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

D2 · Cognitive Complexity2.5 / 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.5 / 10 · rule-coverage 100% · ceiling Prevented

440 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:938
CodexService.upsertStreamingSystemItemMessage (cognitive 193)CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2692
CodexService.loadThreadHistoryIfNeeded (cognitive 181)CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1271
parseSessionJsonlTurns (cognitive 155)phodex-bridge/src/session-jsonl-history.js:442
CodexService.completeAssistantMessage (cognitive 111)CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4013

+ 361 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.5 to about 3.8/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

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

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

136 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 · ×27phodex-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 (5), CodexService+Messages.swift (4). — One of this dimension's main actionable groups (33 warning-level).
  3. Resolve the 27 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 (27 warning-level).

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

D4 · Code Duplication6.8 / 10Adequate✓ Tool-verified

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

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

190 duplicated block group(s) detected. 8.1 % of the production lines (8,617 of 106,923) are in a reported copy. A further 182 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.

Duplicated block (11 lines × 2) · ×17CodexMobile/CodexMobile/ContentView.swift:1923
Duplicated block (6 lines × 2) · ×13CodexMobile/CodexMobile/Services/CodexService+History.swift:4338
Duplicated block (10 lines × 2) · ×12CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1872
Duplicated block (7 lines × 2) · ×12CodexMobile/CodexMobile/Models/CodexAutoApprovalReview.swift:223
Duplicated block (9 lines × 2) · ×11CodexMobile/CodexMobile/Models/AppFont.swift:87

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

What to do

  1. Resolve the 17 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with CodexService+History.swift (2), REDACTED (2), ContentView.swift. — One of this dimension's main actionable groups (17 warning-level).
  2. Resolve the 13 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with CodexService+History.swift (2), GitActionsService.swift (2), TurnDiffRenderer.swift (2). — One of this dimension's main actionable groups (13 warning-level).
  3. Resolve the 12 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with CodexService+Incoming.swift, CodexService+Messages.swift, CodexService+ThreadsTurns.swift. — One of this dimension's main actionable groups (12 warning-level).

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 52 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, desktop-steer-harness.swift. — One of this dimension's main actionable groups (6 warning-level).

Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.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 1293 tests. Measured on the .swift suite only — at least 55 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).

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, not deprecated, and not bloated. Known vulnerabilities are D30's.

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

Maturity: Documented → Verified → Prevented · effective 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).

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 package(s) this repository's committed lockfile installs for a consumer — its 2 production, optional and peer dependency(ies), across 2 product package.json manifest(s), and everything those install in turn. Its 0 `devDependencies` declaration(s), and every package only they reach, are excluded: a consumer installs none of them. ★ Each licence is the one the registry publishes for the package's CURRENT release rather than for the pinned version, which is the same caveat the Hex and RubyGems arms carry. 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.5 / 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.5 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: phodex-bridge/src/bridge.js (19×57=1083); CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift (14×46=644); CodexMobile/CodexMobile/Services/CodexService+History.swift (3×168=504)

Hotspot: phodex-bridge/src/bridge.js · ×17phodex-bridge/src/bridge.js:718

What to do

  1. Resolve the 17 Hotspot finding(s) in Churn × Complexity Hotspots — start with bridge.js, CodexService+ThreadsTurns.swift, CodexService+History.swift. — One of this dimension's main actionable groups (17 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 106923 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).

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 3 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: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.

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

No architecture decision records were found.

No ADRs foundCodexMobile/CodexMobile.xcodeproj/project.pbxproj:1

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj. — 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.

D21 · Naming Consistency7.6 / 10Strong✓ Tool-verified

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

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

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

6 naming inconsistencies among 253 declarations measured against a convention their peers follow.

`hasInlineHistoryImageDataURL` spells `URL` where 22 names in the project spell it `Url`phodex-bridge/src/bridge.js:5081
`sessionID` spells `ID` where 225 names in the project spell it `Id`phodex-bridge/src/opencode-runtime.js:21
`modelID` spells `ID` where 225 names in the project spell it `Id`phodex-bridge/src/opencode-runtime.js:170
`petFolderNameFromID` spells `ID` where 225 names in the project spell it `Id`phodex-bridge/src/pet-handler.js:133
`rawID` spells `ID` where 225 names in the project spell it `Id`phodex-bridge/src/pet-handler.js:133

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

What to do

  1. Resolve the 1 `hasInlineHistoryImageDataURL` spells `URL` where 22 names in the… finding(s) in Naming Consistency — start with bridge.js. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 `sessionID` spells `ID` where 225 names in the project spell it `Id` finding(s) in Naming Consistency — start with opencode-runtime.js. — One of this dimension's main actionable groups (1 recommendation-level).
  3. Resolve the 1 `modelID` spells `ID` where 225 names in the project spell it `Id` finding(s) in Naming Consistency — start with opencode-runtime.js. — One of this dimension's main actionable groups (1 recommendation-level).

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

D24 · Comment Value10.0 9.9 / 10Exemplary○ Nothing flagged

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

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

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

0 of 879 judged comments only repeat the code they sit on (0.0 %). 9 comment(s) in another language or script were not judged.

✓ On the Gold path — maintain.

Detailed fixes: d24_recommendation.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.

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.

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.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 8 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/bridge.js`, `phodex-bridge/src/desktop-ipc-action-follower.js`, … (+3 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.

REDACTED
REDACTED
REDACTED
REDACTED

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. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.

Maturity: Documented → Verified → Prevented · effective 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.2 / 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.2 / 10 · rule-coverage 100% · ceiling Documented

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

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

What to do

  1. Resolve the 7 Change coupling finding(s) in Change Coupling — start with CodexService+SecureTransport.swift (2), GitActionModels.swift, CodexService.swift. — One of this dimension's main actionable groups (7 warning-level).
  2. Resolve the 3 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 (3 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. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

Frontend & cross-cutting dimensions

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

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.

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:39

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)10.0 / 10Exemplary✓ Tool-verified

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

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

M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

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

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

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

What to do

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

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

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

M4 · Documentation accuracy2.0 / 10Critical✓ Tool-verified

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

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

  • 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:401

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's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

P2 · 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 741 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:741
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 742 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:742
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 750 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:750
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1014 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:1014
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1016 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:1016
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1017 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:1017
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1018 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:1018
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1020 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:1020
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1082 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:1082
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1111 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:1111
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1133 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:1133
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1303 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:1303
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1353 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:1353
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 1811 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:1811
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 2386 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:2386
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 2606 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:2606
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 4070 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:4070
  • `phodex-bridge/src/bridge.js` reports through `console.*` at line 4107 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:4107
  • `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 580 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:580
  • `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 585 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:585
  • `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 616 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:616
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2353 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:2353
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2516 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:2516
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2610 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:2610
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2708 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:2708
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2890 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:2890
  • `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2903 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:2903
  • `phodex-bridge/src/desktop-ipc-live-owner.js` reports through `console.*` at line 1215 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:1215
  • `phodex-bridge/src/desktop-ipc-live-owner.js` reports through `console.*` at line 1864 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:1864
  • `phodex-bridge/src/desktop-ipc-live-owner.js` reports through `console.*` at line 1912 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:1912
  • `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 2072 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:2072
  • `phodex-bridge/src/git-handler.js` reports through `console.*` at line 2078 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:2078
  • `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.
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 2 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:9
  • `phodex-bridge/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — phodex-bridge/package.json:39

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.
PF3 · Async & latency hygiene6.0 / 10Adequate✓ Tool-verified

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

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

  • `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
  • `fsModule.existsSync` in `openThreadOnDesktop` 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/desktop-handler.js:216
  • `fsModule.existsSync` in `codexAppProcessArgs` 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/desktop-handler.js:446
  • `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:256
  • `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:722
  • `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:1180
  • `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:1203
  • `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:1705
  • `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:1710
  • `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:1737
  • `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:1969
  • `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:1979
  • `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:2028
  • `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:2182
  • `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:1092
  • `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:1131
  • `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:1232

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 · 115 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 (+109 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 Duplication7.1 / 10Strong✓ Tool-verified

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

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

  • 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:2867 · phodex-bridge/src/desktop-ipc-owner-transport.js:72 — the two spans are one implementation copied and then locally edited — 621 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:2867
  • phodex-bridge/src/pet-handler.js:17 · phodex-bridge/src/workspace-handler.js:46 — 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/pet-handler.js:17
  • phodex-bridge/src/desktop-handler.js:26 · phodex-bridge/src/workspace-handler.js:48 — 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/desktop-handler.js:26
  • REDACTED:862 · 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:862
  • phodex-bridge/src/desktop-ipc-action-follower.js:4216 · 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:4216
  • phodex-bridge/src/desktop-handler.js:228 · phodex-bridge/src/desktop-handler.js:262 — 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:228
  • phodex-bridge/src/desktop-ipc-action-follower.js:1090 · phodex-bridge/src/desktop-ipc-live-owner.js:1379 — 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:453 · REDACTED:612 — 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:453
  • phodex-bridge/src/session-jsonl-history.js:296 · phodex-bridge/src/session-jsonl-history.js:459 — 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:296
  • phodex-bridge/src/git-handler.js:2981 · phodex-bridge/src/workspace-handler.js:1333 — 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:2981
  • 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:4273 · phodex-bridge/src/bridge.js:4296 — 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:4273
  • phodex-bridge/src/notifications-handler.js:8 · phodex-bridge/src/pet-handler.js:19 · phodex-bridge/src/project-handler.js:42 · 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:1232 — 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:345 · phodex-bridge/src/session-jsonl-history.js:393 — 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:345
  • phodex-bridge/src/bridge.js:5081 · phodex-bridge/src/session-jsonl-history.js:1161 — 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:5081
  • phodex-bridge/src/codex-desktop-refresher.js:658 · phodex-bridge/src/desktop-ipc-live-owner.js:1154 — 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:658
  • 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:2734 · phodex-bridge/src/git-handler.js:2760 — 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:2734
  • 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:52 · phodex-bridge/src/codex-transport.js:324 — 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:52
  • 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:701 · REDACTED:727 — 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:701
  • 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:475 — 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-action-follower.js:3265 · REDACTED:459 — 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:3265
  • phodex-bridge/src/project-handler.js:545 · phodex-bridge/src/project-handler.js:568 — 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:545
  • phodex-bridge/src/workspace-handler.js:709 · phodex-bridge/src/workspace-handler.js:791 — 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:709
  • phodex-bridge/src/workspace-handler.js:737 · phodex-bridge/src/workspace-handler.js:821 — 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:737
  • 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:3965 · phodex-bridge/src/bridge.js:4192 — 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:3965
  • phodex-bridge/src/desktop-ipc-action-follower.js:2783 · phodex-bridge/src/desktop-ipc-action-follower.js:2809 — 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:2783

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 76 and cognitive complexity 155; 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:442
  • 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
  • observeOutbound has cyclomatic complexity 45 and cognitive complexity 53; 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:334
  • 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:3521
  • 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
  • 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:3618
  • 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:1037
  • 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:3396
  • readDescendingTurnPage has cyclomatic complexity 30 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/opencode-runtime.js:1177
  • tick has cyclomatic complexity 30 and cognitive complexity 39; 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:201
  • main has cyclomatic complexity 30 and cognitive complexity 37; 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.js:67
  • trimThreadPayloadForRelay has cyclomatic complexity 30 and cognitive complexity 35; 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/bridge.js:5105
  • handleApplicationMessage has cyclomatic complexity 30 and cognitive complexity 33; 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/bridge.js:1319
  • projectTurn has cyclomatic complexity 30 and cognitive complexity 29; 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:262
  • runPendingRefresh has cyclomatic complexity 29 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/codex-desktop-refresher.js:299
  • mergeRelayHistoryItemsWithJsonlItems has cyclomatic complexity 28 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/bridge.js:4208
  • tryServeDesktopOwnedRead has cyclomatic complexity 28 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 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:1654
  • applyImmerPatchCopyOnWrite has cyclomatic complexity 27 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/desktop-ipc-action-follower.js:4190
  • areEquivalentRelayHistoryItems has cyclomatic complexity 27 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — phodex-bridge/src/bridge.js:4482
  • backgroundRawTurn has cyclomatic complexity 25 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — phodex-bridge/src/desktop-ipc-action-follower.js:3995
  • fetchAdaptiveThreadTurnsListForRelay has cyclomatic complexity 24 and cognitive complexity 41; 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/bridge.js:3053
  • applyPatchToBaselineNode has cyclomatic complexity 24 and cognitive complexity 33; 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-state-patches.js:146
  • backgroundHistoryTurns has cyclomatic complexity 24 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 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:3923
  • handleGoalUpdated has cyclomatic complexity 24 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — phodex-bridge/src/push-notification-tracker.js:170
  • observeThreadListResponse has cyclomatic complexity 23 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 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:366
  • workspaceReadImage has cyclomatic complexity 23 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — phodex-bridge/src/workspace-handler.js:176
  • normalizePart has cyclomatic complexity 23 and cognitive complexity 20; 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:117
  • sanitizeThreadHistoryImagesForRelay has cyclomatic complexity 23 and cognitive complexity 19; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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:3723
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 5206 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 4035 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 2700 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 2067 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/session-jsonl-history.js has 1486 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/desktop-ipc-conversation-adapter.js has 1398 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/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 1220 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
  • REDACTED has 908 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/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
  • phodex-bridge/src/codex-desktop-refresher.js has 874 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 709 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 524 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 505 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.

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 17 application, 6 tooling and 55 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 (17 application, 6 tooling, 55 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:1529

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.

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.

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.

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. (×32) — relay/push-service.js:285, phodex-bridge/src/bootstrap-codex-cli.js:50, phodex-bridge/src/bridge.js:2648, …
  • `.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:1661, 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included. (×2) — phodex-bridge/src/git-handler.js:2123, phodex-bridge/src/project-handler.js:378

What to do

  • Swallowed exception (empty catch)

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 Health32%Weak — gated by D2, R1, R3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture94%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity60%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.
Security85%Checked 3 of 8Strongest 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 publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files). Build integrity and workflow-token hygiene are reported below: they describe what the CI runs and the token it runs with, neither of which is affected by whether the pipeline ships an artifact.
  • X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 16 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 — 71 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.
  • 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 (`npm run start`) exited before it served a page. Likely cause (our sandbox): `npm run` found no package.json in the folder where our sandbox ran it. This is a limit of our sandbox, not of your repository. Last output: "npm error code ENOENT / npm error syscall open / npm error path <repo>/package.json / npm error errno -2 / npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '<repo>/package.json' / npm error enoent This is related to npm not being able to find a file. / npm error enoent / npm error A complete log of this run can be found in: <path>" No runtime evidence was gathered. 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.
  • 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+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D25 ADR Conformance — no ADRs to check
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 72 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.
  • 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 112 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.
  • PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X1 Async correctness — X1 reached only 27% of this repository's production lines — swift (106,923 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X12 Unreachable branch — X12 reached only 27% of this repository's production lines — swift (106,923 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X13 Undrained process stream — X13 reached only 27% of this repository's production lines — swift (106,923 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — X16 reached only 27% of this repository's production lines — swift (106,923 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X19 Unrestored process-global state — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X21 Side-effecting pattern guard — X21 reached only 27% of this repository's production lines — swift (106,923 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — X24 reached only 27% of this repository's production lines — swift (106,923 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X27 Collection changed while being enumerated — Not 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.
  • X29 Per-element action decided by a fixed element — X29 reached only 27% of this repository's production lines — swift (106,923 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

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

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/::bridge Activity is opt-in and canonical-only endpoints need no Desktop IPC — Passed 2×, failed 1× across repeated runs.
  • 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.
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:39 — `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 — 1381 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 — 3898 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 3398 over it, 7.80× 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 — 3189 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2689 over it, 6.38× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: src/desktop-ipc-action-follower.js phodex-bridge/src/desktop-ipc-action-follower.js — FileTooLong — 2919 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-2836). The bar is 500 significant lines; this is 2419 over it, 5.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: Services/CodexService+Incoming.swift CodexMobile/CodexMobile/Services/CodexService+Incoming.swift — FileTooLong — 2641 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2141 over it, 5.28× 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 — 2556 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: TurnViewModel (166-3635). The bar is 500 significant lines; this is 2056 over it, 5.11× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Services/CodexService+ThreadsTurns.swift CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift — FileTooLong — 2417 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1917 over it, 4.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: src/git-handler.js phodex-bridge/src/git-handler.js — FileTooLong — 2043 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 1543 over it, 4.09× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: 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: src/desktop-ipc-live-owner.js phodex-bridge/src/desktop-ipc-live-owner.js — FileTooLong — 1506 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 85% of them inside a single declaration: createDesktopIpcLiveOwner (138-1994). The bar is 500 significant lines; this is 1006 over it, 3.01× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • 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: Core/TurnView.swift CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift — FileTooLong — 1301 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: TurnView (18-1870). The bar is 500 significant lines; this is 801 over it, 2.60× 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/session-jsonl-history.js phodex-bridge/src/session-jsonl-history.js — FileTooLong — 1153 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 653 over it, 2.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-conversation-adapter.js phodex-bridge/src/desktop-ipc-conversation-adapter.js — FileTooLong — 1115 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 615 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: 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 — 1038 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 538 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: 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 — 933 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 433 over it, 1.87× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Services/CodexService+Connection.swift CodexMobile/CodexMobile/Services/CodexService+Connection.swift — FileTooLong — 920 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 420 over it, 1.84× 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 — 911 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: NewChatDraftView (59-1314). The bar is 500 significant lines; this is 411 over it, 1.82× 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: Services/CodexService.swift CodexMobile/CodexMobile/Services/CodexService.swift — FileTooLong — 890 significant lines (blank, comment-only and punctuation-only lines excluded), about 65% of them inside a single declaration: CodexService (424-1277). The bar is 500 significant lines; this is 390 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.
  • + 28 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×38
  • 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:1661 — `.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:2648 — 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-desktop-app.js:40 — 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:4161 — 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:552 — `.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:1513 — 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:678 — 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:474 — 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:723 — 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:950 — 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:1986 — 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:1995 — 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:2001 — 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:2009 — 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:2015 — 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:2111 — 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:2133 — 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.
  • + 13 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:938 — MethodTooLong — mergeHistoryMessages runs 337 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 237 over it, 3.37× 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:104 — MethodTooLong — decodeMessagesFromThreadRead runs 262 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 162 over it, 2.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.loadOlderThreadHistoryPage CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:221 — MethodTooLong — loadOlderThreadHistoryPage runs 181 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 81 over it, 1.81× 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 165 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 65 over it, 1.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CodexService.handleStructuredItemLifecycle CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2417 — 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:1441 — 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:1288 — 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:2055 — 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:1992 — MethodTooLong — steerTurn runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: CodexService.sendTurnStart CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1664 — 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:1708 — 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: 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:3251 — 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.
  • MethodTooLong: TurnView.composerWithSubagentAccessory CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1565 — MethodTooLong — composerWithSubagentAccessory 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.
  • + 8 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×27
  • FunctionTooLong: desktop-ipc-action-follower.createDesktopIpcActionFollower phodex-bridge/src/desktop-ipc-action-follower.js:240 — FunctionTooLong — createDesktopIpcActionFollower runs 1765 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1665 over it, 17.65× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: bridge.startBridge phodex-bridge/src/bridge.js:718 — FunctionTooLong — startBridge runs 1290 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1190 over it, 12.90× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: desktop-ipc-live-owner.createDesktopIpcLiveOwner phodex-bridge/src/desktop-ipc-live-owner.js:138 — FunctionTooLong — createDesktopIpcLiveOwner runs 1282 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1182 over it, 12.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: git-handler.tokenizeThreadTitleWords phodex-bridge/src/git-handler.js:1592 — FunctionTooLong — tokenizeThreadTitleWords runs 884 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 784 over it, 8.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: secure-transport.createBridgeSecureTransport REDACTED:36 — FunctionTooLong — createBridgeSecureTransport runs 523 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 423 over it, 5.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • 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:182 — 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:2839 — 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: desktop-handler.openThreadOnDesktop phodex-bridge/src/desktop-handler.js:160 — FunctionTooLong — openThreadOnDesktop runs 124 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 24 over it, 1.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • 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: secure-transport.createBridgeSecureTransport.handleClientAuth REDACTED:274 — FunctionTooLong — createBridgeSecureTransport.handleClientAuth runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× 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:4208 — 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:3053 — 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.
  • + 2 more in this group — see findings.md.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×18
  • 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/desktop-handler.js:216 — `fsModule.existsSync` in `openThreadOnDesktop` 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/desktop-handler.js:446 — `fsModule.existsSync` in `codexAppProcessArgs` 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:256 — `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:722 — `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:1180 — `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:1203 — `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:1705 — `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:1710 — `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:1737 — `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:1969 — `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:1979 — `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:2028 — `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:2182 — `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:1092 — `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:1131 — `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:1232 — `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.
D15 · Churn × Complexity Hotspots · Hotspot · ×17
  • Hotspot: phodex-bridge/src/bridge.js phodex-bridge/src/bridge.js:718 — phodex-bridge/src/bridge.js changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in bridge.startBridge at line 718. 3 of those changes were fix/bug commits, and the other 16 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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: CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1288 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in CodexService.ensureThreadResumed at line 1288. 4 of those changes were fix/bug commits, and the other 10 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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: CodexMobile/CodexMobile/Services/CodexService+History.swift CodexMobile/CodexMobile/Services/CodexService+History.swift:938 — CodexMobile/CodexMobile/Services/CodexService+History.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 168 in CodexService.mergeHistoryMessages at line 938. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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: CodexMobile/CodexMobile/Services/CodexService+Incoming.swift CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:177 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in CodexService.handleNotification at line 177. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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-action-follower.js phodex-bridge/src/desktop-ipc-action-follower.js:2448 — phodex-bridge/src/desktop-ipc-action-follower.js changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest at line 2448. 2 of those changes were fix/bug commits, and the other 8 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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/Views/Turn/Core/TurnView.swift CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:75 — CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in TurnView.body at line 75. 2 of those changes were fix/bug commits, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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: 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. 3 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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: phodex-bridge/src/desktop-ipc-live-owner.js phodex-bridge/src/desktop-ipc-live-owner.js:334 — phodex-bridge/src/desktop-ipc-live-owner.js changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound at line 334. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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/Messages/TurnMessageComponents.swift CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift:536 — CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 62 in MessageRow.assistantView at line 536. 2 of those changes were fix/bug commits, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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/desktop-ipc-conversation-adapter.js phodex-bridge/src/desktop-ipc-conversation-adapter.js:445 — phodex-bridge/src/desktop-ipc-conversation-adapter.js changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in desktop-ipc-conversation-adapter.buildConversationStateFromThread at line 445. 1 of those changes was a fix/bug commit, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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/Views/Turn/Composer/TurnComposerHostView.swift CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerHostView.swift:62 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerHostView.swift changed 3 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-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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/Services/CodexService+MacContext.swift CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:226 — CodexMobile/CodexMobile/Services/CodexService+MacContext.swift changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in CodexService.loadMacScopedDefaultsState at line 226. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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+ThreadHistoryPagination.swift CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:221 — CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift changed 3 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-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01: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/Services/CodexService+Helpers.swift CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:95 — CodexMobile/CodexMobile/Services/CodexService+Helpers.swift changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in CodexService.mergedThread at line 95. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+Helpers.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+AsyncUserInput.swift CodexMobile/CodexMobile/Services/CodexService+AsyncUserInput.swift:71 — CodexMobile/CodexMobile/Services/CodexService+AsyncUserInput.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in CodexService.deliverAsyncUserInput at line 71. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01:00' --full-history --no-merges -- CodexMobile/CodexMobile/Services/CodexService+AsyncUserInput.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/Core/NewChatDraftView.swift CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:116 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in NewChatDraftView.body at line 116. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01:00' --full-history --no-merges -- CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.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-handler.js phodex-bridge/src/desktop-handler.js:62 — phodex-bridge/src/desktop-handler.js changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in desktop-handler.handleDesktopMethod at line 62. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-05..2026-11-03, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-05 10:19:50 +01:00' --until='2026-11-03 10:19:50 +01:00' --full-history --no-merges -- phodex-bridge/src/desktop-handler.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.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×17
  • 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:743-753 — 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:3376 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3376-3386 | 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:4417 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4417-4427 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3193-3203 — 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:4417` 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:2905 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2905-2915 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2922-2932 — 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:2905` 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+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/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:3192 — REDACTED:3192-3202 | REDACTED:3234-3244 — 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:3192` 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) REDACTED:3339 — REDACTED:3339-3349 | REDACTED:3435-3450 — 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/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/TurnTimelineReducer.swift:240 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:240-250 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:1155-1165 — 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.
D3 · God Classes · ClassTooLong · ×13
  • ClassTooLong: TurnViewModel REDACTED:164 — ClassTooLong — 2357 significant lines (blank, comment-only and punctuation-only lines excluded), 159 methods. The bar is 400 significant lines; this is 1957 over it, 5.89× 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 — 1289 significant lines (blank, comment-only and punctuation-only lines excluded), 47 methods. The bar is 400 significant lines; this is 889 over it, 3.22× 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 — 849 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 449 over it, 2.12× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: 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 — 744 significant lines (blank, comment-only and punctuation-only lines excluded), 43 methods. The bar is 400 significant lines; this is 344 over it, 1.86× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MacSwitchInterruptTimeout CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:326 — ClassTooLong — 655 significant lines (blank, comment-only and punctuation-only lines excluded), 0 methods. The bar is 400 significant lines; this is 255 over it, 1.64× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CodexService CodexMobile/CodexMobile/Services/CodexService.swift:422 — ClassTooLong — 578 significant lines (blank, comment-only and punctuation-only lines excluded), 1345 methods. The bar is 400 significant lines; this is 178 over it, 1.45× 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:25 — 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.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×13
  • Duplicated block (6 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4338 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4338-4343 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3115-3120 — 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/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/TurnPerFileDiffParser.swift:59 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:59-64 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:261-266 — 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:1109 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1109-1114 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1483-1488 — 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:4519 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4519-4524 | 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:4519` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×12
  • Duplicated block (10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1872 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1872-1881 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1952-1961 — 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:1872` 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:800 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:800-809 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:859-868 — 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:201 — CodexMobile/CodexMobile/Views/MyMacs/MyDevicesSettingsSheet.swift:201-210 | 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:201` 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) · ×12
  • 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+Incoming.swift:1081 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1081-1087 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1177-1183 — 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:1081` 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:1088` calls `firstStringValue` and `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1184` 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:614 — CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:614-620 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:182-188 — 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:1271-1277 — 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:968 — CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:968-974 | 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.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×11
  • 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:2193 — CodexMobile/CodexMobile/Services/CodexService+History.swift:2193-2201 | 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:2435 — CodexMobile/CodexMobile/Services/CodexService+History.swift:2435-2443 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2492-2500 — 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:2503 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2503-2511 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2521-2529 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • 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:3354 — REDACTED:3354-3362 | REDACTED:3370-3378 — 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:3354` 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/Models/AIChangeSetModels.swift:352 — CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:352-360 | CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:391-399 — 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/Services/CodexService+History.swift:4017 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4017-4025 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:760-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. 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+ThreadHistoryPagination.swift:761 — CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:761-769 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1258-1266 — 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.
D3 · God Classes · TooManyMethods · ×10
  • TooManyMethods: CodexService CodexMobile/CodexMobile/Services/CodexService.swift:422 — TooManyMethods — 1345 methods, declared across 38 files: Services/CodexService+Messages.swift (204), Services/CodexService+History.swift (135), Services/CodexService+ThreadsTurns.swift (126), Services/CodexService+Incoming.swift (124), +34 more file(s). The bar is 30 methods; this is 1315 over it, 44.83× 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:25 — 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 · Edited copy of a member (14 corresponding lines) · ×10
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:498 — CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:498-513 | CodexMobile/CodexMobile/Services/CodexService+Sync.swift:673-686 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Support/ConnectionRecoveryCard.swift:172 — CodexMobile/CodexMobile/Views/Turn/Support/ConnectionRecoveryCard.swift:172-185 | CodexMobile/CodexMobile/Views/Turn/Support/TurnErrorReportCard.swift:63-76 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:3375 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3375-3389 | CodexMobile/CodexMobile/Views/Turn/Messages/UserAttachmentViews.swift:107-120 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:102 — CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:102-115 | CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:117-130 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:1004 — CodexMobile/CodexMobile/Services/CodexService+Sync.swift:1004-1017 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2999-3014 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Models/CodexThread.swift:690 — CodexMobile/CodexMobile/Models/CodexThread.swift:690-703 | CodexMobile/CodexMobile/Models/CodexThread.swift:705-718 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadGrouping.swift:337 — CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadGrouping.swift:337-353 | CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadGrouping.swift:355-368 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:404 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:404-417 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:476-496 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4540 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4540-4553 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:626-639 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) CodexMobile/CodexMobile/Services/CodexService.swift:1201 — CodexMobile/CodexMobile/Services/CodexService.swift:1201-1214 | CodexMobile/CodexMobile/Views/Settings/SettingsConnectionCard.swift:109-122 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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:4299 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4299-4315 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3076-3092 — 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:4299` 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:2312 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2312-2328 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2392-2408 — 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:2312` 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+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:1255 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1255-1271 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1769-1785 — 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.
  • Duplicated block (17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4033 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4033-4049 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2828-2844 — 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:4033` 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 (12 lines × 2) · ×9
  • Duplicated block (12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3595 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3595-3606 | CodexMobile/CodexMobile/Services/CodexService+History.swift:3613-3624 — 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:3595` 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+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/Diff/TurnDiffSheet.swift:190 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:190-201 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:419-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.
  • Duplicated block (12 lines × 2) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:713 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:713-724 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:900-911 — 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 · Edited copy of a member (10 corresponding lines) · ×8
  • Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:349 — CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:349-361 | CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:388-405 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Models/GitActionModels.swift:177 — CodexMobile/CodexMobile/Models/GitActionModels.swift:177-186 | CodexMobile/CodexMobile/Models/GitActionModels.swift:357-371 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Voice.swift:295 — CodexMobile/CodexMobile/Services/CodexService+Voice.swift:295-304 | CodexMobile/CodexMobile/Services/CodexService+Voice.swift:306-315 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Account.swift:564 — CodexMobile/CodexMobile/Services/CodexService+Account.swift:564-573 | CodexMobile/CodexMobile/Services/CodexService+Account.swift:589-598 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ProjectFolders.swift:142 — CodexMobile/CodexMobile/Services/CodexService+ProjectFolders.swift:142-151 | CodexMobile/CodexMobile/Services/CodexService+ProjectFolders.swift:153-165 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+AIChangeSets.swift:766 — CodexMobile/CodexMobile/Services/CodexService+AIChangeSets.swift:766-775 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3728-3737 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerViewState.swift:96 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerViewState.swift:96-105 | REDACTED:451-460 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Plan/PlanAccessoryCard.swift:14 — CodexMobile/CodexMobile/Views/Turn/Plan/PlanAccessoryCard.swift:14-23 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:585-594 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×8
  • Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:3416 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3416-3433 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2787-2804 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) REDACTED:3189 — REDACTED:3189-3210 | REDACTED:3230-3247 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/ContentView.swift:2210 — CodexMobile/CodexMobile/ContentView.swift:2210-2229 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewSupportViews.swift:11-28 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/Views/SidebarView.swift:387 — CodexMobile/CodexMobile/Views/SidebarView.swift:387-404 | CodexMobile/CodexMobile/Views/SidebarView.swift:407-424 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4381 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4381-4398 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3158-3175 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1197 — CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1197-1214 | CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:667-684 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:545 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:545-562 | CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:573-590 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift:639 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift:639-656 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerView.swift:663-680 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×8
  • Edited copy of a member (16 corresponding lines) CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:29 — CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:29-44 | CodexMobile/CodexMobile/Services/CodexThreadListPersistence.swift:25-42 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnChatToolbarTitleLabel.swift:41 — CodexMobile/CodexMobile/Views/Turn/Core/TurnChatToolbarTitleLabel.swift:41-56 | CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:781-798 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:130 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:130-145 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:148-164 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) CodexMobile/CodexMobile/Services/Payments/SubscriptionService.swift:235 — CodexMobile/CodexMobile/Services/Payments/SubscriptionService.swift:235-259 | CodexMobile/CodexMobile/Services/Payments/SubscriptionService.swift:262-277 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:167 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:167-184 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:209-224 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Transport.swift:48 — CodexMobile/CodexMobile/Services/CodexService+Transport.swift:48-63 | CodexMobile/CodexMobile/Services/CodexService+Transport.swift:138-154 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Voice/VoiceInputCoordinator.swift:111 — CodexMobile/CodexMobile/Views/Turn/Voice/VoiceInputCoordinator.swift:111-126 | CodexMobile/CodexMobile/Views/Turn/Voice/VoiceInputCoordinator.swift:129-147 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) CodexMobile/CodexMobile/Services/Terminal/RemodexTerminalModels.swift:25 — CodexMobile/CodexMobile/Services/Terminal/RemodexTerminalModels.swift:25-40 | CodexMobile/CodexMobile/Views/Terminal/TerminalScreen.swift:110-125 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×8
  • 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:4185 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4185-4192 | 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+ThreadsTurns.swift:365 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:365-372 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1994-2001 — 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/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/Services/CodexService+History.swift:3810 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3810-3817 | CodexMobile/CodexMobile/Services/CodexService+History.swift:3827-3834 — 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:3810` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (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:4469 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4469-4480 | 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.
D35 · Change Coupling · Change coupling · ×7
  • 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 64% of the time (7 of the 11 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 62% of the time (25 of the 40 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+SecureTransport.swift ↔ ContentViewModel.swift CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1 — `CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift` and `CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift` change together 56% of the time (9 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). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 9 shared commits counted here, the most recent 3 are `b712ecd7` Encrypt local change ledgers with failure-safe key recovery (#216); `73e5bc5b` Improve local relay reconnect handling; `33f05c3f` Fix trusted reconnect recovery — 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 55% of the time (6 of the 11 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 6 shared commits counted here, the most recent 3 are `d492e01b` Bound detailed diff rendering on iOS (#227); `1a5b0eb5` Harden bridge and mobile runtime error handling (#162); `c987076f` Add native Codex thread goal support (/goal) — 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: CodexService+SecureTransport.swift ↔ bridge.js CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1 — `CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift` and `phodex-bridge/src/bridge.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 `73e5bc5b` Improve local relay reconnect handling; `8d0c292e` Harden reconnect recovery and relay watchdog; `86227c76` Fix iPhone voice auth and local bridge pairing flow — run `git show` on any of them.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×7
  • Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Views/Shared/CodexWorktreeIcon.swift:35 — CodexMobile/CodexMobile/Views/Shared/CodexWorktreeIcon.swift:35-47 | CodexMobile/CodexMobile/Views/Shared/RemodexIcon.swift:189-203 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1669 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1669-1684 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:71-83 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/CodeCommentDirectiveParser.swift:132 — CodexMobile/CodexMobile/Views/Turn/Messages/CodeCommentDirectiveParser.swift:132-144 | CodexMobile/CodexMobile/Views/Turn/Messages/ThinkingDisclosureParser.swift:177-190 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:804 — CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:804-819 | CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:821-833 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:173 — CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:173-185 | CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:249-261 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Services/GitActionsService.swift:178 — CodexMobile/CodexMobile/Services/GitActionsService.swift:178-192 | CodexMobile/CodexMobile/Services/GitActionsService.swift:195-207 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:1097 — CodexMobile/CodexMobile/Services/CodexService+Sync.swift:1097-1113 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:1211-1223 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×7
  • Edited copy of a member (12 corresponding lines) CodexMobile/CodexMobile/Models/CodexThreadGoal.swift:118 — CodexMobile/CodexMobile/Models/CodexThreadGoal.swift:118-129 | CodexMobile/CodexMobile/Models/ContextWindowUsage.swift:40-51 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) CodexMobile/CodexMobile/Models/CodexThreadGoal.swift:131 — CodexMobile/CodexMobile/Models/CodexThreadGoal.swift:131-142 | CodexMobile/CodexMobile/Views/Turn/Support/GoalStatusChip.swift:147-159 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Plan/PlanAccessoryCard.swift:475 — CodexMobile/CodexMobile/Views/Turn/Plan/PlanAccessoryCard.swift:475-486 | CodexMobile/CodexMobile/Views/Turn/Plan/PlanAccessoryCard.swift:488-499 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:888 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:888-899 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:911-922 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:3359 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3359-3372 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:4775-4786 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) CodexMobile/CodexMobile/Models/CodexThread.swift:663 — CodexMobile/CodexMobile/Models/CodexThread.swift:663-675 | CodexMobile/CodexMobile/Models/CodexThread.swift:677-688 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) CodexMobile/CodexMobile/Views/SidebarView.swift:248 — CodexMobile/CodexMobile/Views/SidebarView.swift:248-260 | CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1140-1151 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×7
  • Edited copy of a member (9 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+WorkspaceImages.swift:203 — CodexMobile/CodexMobile/Services/CodexService+WorkspaceImages.swift:203-212 | CodexMobile/CodexMobile/Services/CodexService+WorkspaceImages.swift:214-222 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift:63 — CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift:63-72 | CodexMobile/CodexMobile/Views/Terminal/TerminalUIModels.swift:134-142 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4337 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4337-4345 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3114-3122 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:58 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:58-69 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:260-268 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift:228 — CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageComponents.swift:228-236 | CodexMobile/CodexMobile/Views/Turn/Plan/StructuredUserInputCardView.swift:414-424 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:904 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:904-912 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:920-928 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Account.swift:1232 — CodexMobile/CodexMobile/Services/CodexService+Account.swift:1232-1246 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:66-74 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×7
  • Edited copy of a member (7 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Notifications.swift:701 — CodexMobile/CodexMobile/Services/CodexService+Notifications.swift:701-707 | CodexMobile/CodexMobile/Services/CodexService+Notifications.swift:716-722 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageCaches.swift:252 — CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageCaches.swift:252-258 | CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageCaches.swift:284-290 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:839 — CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:839-849 | CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:910-916 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+AsyncUserInput.swift:173 — CodexMobile/CodexMobile/Services/CodexService+AsyncUserInput.swift:173-179 | CodexMobile/CodexMobile/Services/CodexService+Pets.swift:76-85 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:2988 — CodexMobile/CodexMobile/Services/CodexService+History.swift:2988-2994 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:936-942 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListState.swift:213 — CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListState.swift:213-219 | CodexMobile/CodexMobile/Views/Turn/Messages/TurnMermaidRenderer.swift:864-870 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) CodexMobile/CodexMobile/Services/Terminal/CodexService+Terminal.swift:249 — CodexMobile/CodexMobile/Services/Terminal/CodexService+Terminal.swift:249-255 | CodexMobile/CodexMobile/Views/Terminal/TerminalScreen.swift:671-677 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×7
  • Edited copy of a member (8 corresponding lines) CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift:1663 — CodexMobile/CodexMobile/Views/Terminal/GhosttyTerminalView.swift:1663-1672 | CodexMobile/CodexMobile/Views/Terminal/TerminalFallbackSurface.swift:63-70 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Account.swift:555 — CodexMobile/CodexMobile/Services/CodexService+Account.swift:555-562 | CodexMobile/CodexMobile/Services/CodexService+Account.swift:580-587 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/ThinkingSystemBlock.swift:169 — CodexMobile/CodexMobile/Views/Turn/Messages/ThinkingSystemBlock.swift:169-176 | CodexMobile/CodexMobile/Views/Turn/Messages/UserBubbleInlineMarkdownText.swift:282-291 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) CodexMobile/CodexMobile/Models/CodexMessage.swift:291 — CodexMobile/CodexMobile/Models/CodexMessage.swift:291-299 | CodexMobile/CodexMobile/Views/Turn/Plan/PlanAccessoryCard.swift:144-151 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:499 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:499-506 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:1215-1223 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2272 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2272-2279 | CodexMobile/CodexMobile/Views/Home/ContentViewModel.swift:996-1003 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1086 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1086-1093 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:691-701 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×7
  • Edited copy of a member (4 corresponding lines) CodexMobile/CodexMobile/Services/Terminal/RemodexSSHKnownHostStore.swift:22 — CodexMobile/CodexMobile/Services/Terminal/RemodexSSHKnownHostStore.swift:22-27 | REDACTED:2829-2832 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) CodexMobile/CodexMobile/Services/AssistantReplayDeduper.swift:251 — CodexMobile/CodexMobile/Services/AssistantReplayDeduper.swift:251-254 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:144-147 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:80 — CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:80-83 | CodexMobile/CodexMobile/Services/CodexMessagePersistence.swift:101-104 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1273 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:1273-1276 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1796-1799 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) CodexMobile/CodexMobile/Models/CodexCollaboration.swift:210 — CodexMobile/CodexMobile/Models/CodexCollaboration.swift:210-213 | CodexMobile/RemodexMenuBar/BridgeControlService.swift:423-426 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) CodexMobile/CodexMobile/Models/CodexImageAttachment.swift:110 — CodexMobile/CodexMobile/Models/CodexImageAttachment.swift:110-113 | CodexMobile/CodexMobile/Views/Terminal/TerminalScreen.swift:75-78 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:59 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:59-64 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:17-20 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×7
  • Duplicated block (13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:908 — CodexMobile/CodexMobile/Services/CodexService+Connection.swift:908-920 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3074-3086 — 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:908` 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:538 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:538-550 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:574-586 — 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:538` 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:3295 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3295-3307 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3504-3516 — 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.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×6
  • Members sharing a duplicated core (4 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:92 — CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:92-118 | 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:4120 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4120-4204 | CodexMobile/CodexMobile/Services/CodexService+History.swift:4288-4315 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3065-3092 | 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:1742 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1742-1789 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1863-1907 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1933-1993 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1995-2131 — 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:364 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:364-460 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:464-508 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1664-1839 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1992-2176 — 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.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×6
  • Edited copy of a member (21 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnToolbarContent.swift:359 — CodexMobile/CodexMobile/Views/Turn/Core/TurnToolbarContent.swift:359-379 | CodexMobile/CodexMobile/Views/Turn/Git/TurnGitActionsToolbar.swift:188-210 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:144 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:144-169 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineView.swift:224-244 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:2996 — CodexMobile/CodexMobile/Services/CodexService+History.swift:2996-3021 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:944-964 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2643 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2643-2667 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:430-450 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:207 — CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:207-228 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:455-475 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) CodexMobile/CodexMobile/Models/CodexThread.swift:764 — CodexMobile/CodexMobile/Models/CodexThread.swift:764-792 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2669-2689 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×6
  • Edited copy of a member (15 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelinePlaceholderViews.swift:10 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelinePlaceholderViews.swift:10-24 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelinePlaceholderViews.swift:28-44 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:293 — CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:293-307 | CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:320-336 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) CodexMobile/CodexMobile/Services/SecureStore.swift:32 — CodexMobile/CodexMobile/Services/SecureStore.swift:32-47 | CodexMobile/CodexMobile/Services/SecureStore.swift:50-64 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:753 — CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:753-767 | CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:728-743 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarHeaderView.swift:213 — CodexMobile/CodexMobile/Views/Sidebar/SidebarHeaderView.swift:213-227 | CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadContextMenu.swift:73-90 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:3435 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3435-3449 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2806-2820 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×6
  • Edited copy of a member (6 corresponding lines) REDACTED:1334 — REDACTED:1334-1340 | REDACTED:1342-1347 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) CodexMobile/CodexMobile/Models/CodexCollaboration.swift:439 — CodexMobile/CodexMobile/Models/CodexCollaboration.swift:439-444 | CodexMobile/CodexMobile/Views/Turn/Messages/SubagentViews.swift:533-539 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) CodexMobile/CodexMobile/Services/AssistantReplayDeduper.swift:152 — CodexMobile/CodexMobile/Services/AssistantReplayDeduper.swift:152-157 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:1104-1110 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:756 — CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:756-761 | CodexMobile/CodexMobile/Views/MyMacs/MyDevicesPresentation.swift:167-174 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:604 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:604-609 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRenderProjection.swift:1253-1259 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1468 — CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1468-1473 | CodexMobile/CodexMobile/Services/CodexService+Transport.swift:163-168 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×6
  • Edited copy of a member (5 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageRegexCache.swift:57 — CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageRegexCache.swift:57-61 | CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageRegexCache.swift:63-67 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:264 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:264-268 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:270-274 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:438 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:438-442 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:444-448 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) CodexMobile/CodexMobile/Services/AssistantReplayDeduper.swift:193 — CodexMobile/CodexMobile/Services/AssistantReplayDeduper.swift:193-197 | CodexMobile/CodexMobile/Services/CodexService+History.swift:2265-2269 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) CodexMobile/CodexMobile/Models/CodexServiceTier.swift:53 — CodexMobile/CodexMobile/Models/CodexServiceTier.swift:53-58 | CodexMobile/CodexMobile/Models/CodexReasoningEffortOption.swift:48-52 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) CodexMobile/CodexMobile/Models/CodexCollaboration.swift:246 — CodexMobile/CodexMobile/Models/CodexCollaboration.swift:246-250 | REDACTED:3642-3646 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×6
  • Duplicated block (16 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:4364 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4364-4379 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3141-3156 — 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:4364` 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:4383 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4383-4398 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3160-3175 — 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:4383` 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/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.
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/desktop-steer-harness.swift:16 — 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 · Edited copy of a member (17 corresponding lines) · ×5
  • Edited copy of a member (17 corresponding lines) CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:386 — CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:386-402 | CodexMobile/RemodexMenuBar/BridgeMenuBarViews.swift:404-420 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3155 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:3155-3171 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineReducer.swift:659-686 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:767 — CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:767-791 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:793-809 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:2415 — CodexMobile/CodexMobile/Services/CodexService+History.swift:2415-2432 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2502-2518 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:621 — CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:621-637 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:640-657 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×5
  • Edited copy of a member (11 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:412 — CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:412-422 | CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:424-437 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarFloatingSettingsButton.swift:14 — CodexMobile/CodexMobile/Views/Sidebar/SidebarFloatingSettingsButton.swift:14-24 | CodexMobile/CodexMobile/Views/Sidebar/SidebarFloatingSettingsButton.swift:59-69 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:14 — CodexMobile/CodexMobile/Services/CodexComposerDraftPersistence.swift:14-26 | CodexMobile/CodexMobile/Services/CodexThreadListPersistence.swift:13-23 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadGrouping.swift:223 — CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadGrouping.swift:223-233 | CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadGrouping.swift:236-246 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) CodexMobile/CodexMobile/Views/Settings/SettingsBaseComponents.swift:215 — CodexMobile/CodexMobile/Views/Settings/SettingsBaseComponents.swift:215-225 | CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:902-912 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×5
  • Edited copy of a member (3 corresponding lines) CodexMobile/CodexMobile/Services/Terminal/CodexService+Terminal.swift:261 — CodexMobile/CodexMobile/Services/Terminal/CodexService+Terminal.swift:261-263 | CodexMobile/RemodexMenuBar/BridgeControlService.swift:586-588 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) CodexMobile/CodexMobile/ContentView.swift:1583 — CodexMobile/CodexMobile/ContentView.swift:1583-1585 | CodexMobile/CodexMobile/Views/Terminal/TerminalScreen.swift:579-586 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:421 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:421-423 | CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:243-245 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:85 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:85-87 | CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionViews.swift:344-346 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (3 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:241 — CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:241-243 | CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:255-257 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · 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:4318 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4318-4335 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3095-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. 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:275 — CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:275-292 | CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:314-331 — 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:275` 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×5
  • Duplicated block (14 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3420 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3420-3433 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2791-2804 — 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:3420` 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/Views/Home/HomeEmptyStateView.swift:83 — CodexMobile/CodexMobile/Views/Home/HomeEmptyStateView.swift:83-96 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:133-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:83` 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) 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:2300 — REDACTED:2300-2313 | REDACTED:2588-2601 — 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.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×5
  • 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/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:513 — CodexMobile/CodexMobile/Services/CodexService+History.swift:513-517 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3805-3809 — 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:513` 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:2699 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2699-2703 | 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.
R10 · Code Duplication · Duplicated block (15 lines × 2 locations) · ×5
  • Duplicated block (15 lines × 2 locations) phodex-bridge/src/bridge.js:5081 — phodex-bridge/src/bridge.js:5081 · phodex-bridge/src/session-jsonl-history.js:1161 — 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:2734 — phodex-bridge/src/git-handler.js:2734 · phodex-bridge/src/git-handler.js:2760 — 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.
R10 · Code Duplication · Duplicated block (13 lines × 2 locations) · ×5
  • Duplicated block (13 lines × 2 locations) phodex-bridge/src/desktop-ipc-action-follower.js:3265 — phodex-bridge/src/desktop-ipc-action-follower.js:3265 · REDACTED:459 — 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 (13 lines × 2 locations) phodex-bridge/src/project-handler.js:545 — phodex-bridge/src/project-handler.js:545 · phodex-bridge/src/project-handler.js:568 — 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:709 — phodex-bridge/src/workspace-handler.js:709 · phodex-bridge/src/workspace-handler.js:791 — 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:737 — phodex-bridge/src/workspace-handler.js:737 · phodex-bridge/src/workspace-handler.js:821 — 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.
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.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×4
  • Edited copy of a member (23 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4027 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4027-4049 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2822-2844 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:411 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:411-436 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnUnifiedDiffView.swift:464-486 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) CodexMobile/CodexMobile/Views/Onboarding/OnboardingView.swift:134 — CodexMobile/CodexMobile/Views/Onboarding/OnboardingView.swift:134-156 | CodexMobile/CodexMobile/Views/Sidebar/SidebarConnectionEmptyStatePanel.swift:188-212 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) REDACTED:2198 — REDACTED:2198-2221 | REDACTED:2223-2245 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×4
  • Edited copy of a member (22 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:3392 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3392-3414 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnAttachmentPipeline.swift:89-110 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:473 — CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:473-494 | CodexMobile/CodexMobile/Services/Coordination/WorktreeFlowCoordinator.swift:552-573 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:393 — CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:393-414 | CodexMobile/CodexMobile/Views/Turn/Plan/TurnPlanModeComponents.swift:518-545 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) CodexMobile/CodexMobile/ContentView.swift:2137 — CodexMobile/CodexMobile/ContentView.swift:2137-2158 | CodexMobile/CodexMobile/ContentView.swift:2160-2181 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×4
  • Edited copy of a member (19 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Composer/TurnAttachmentPipeline.swift:64 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnAttachmentPipeline.swift:64-86 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerInputTextView.swift:674-692 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3017 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3017-3035 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3038-3056 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:354 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:354-372 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:298-316 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:102 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:102-120 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:124-142 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×4
  • Edited copy of a member (20 corresponding lines) CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:628 — CodexMobile/CodexMobile/Views/Payments/SubscriptionGateView.swift:628-647 | CodexMobile/CodexMobile/Views/Turn/Voice/GPTVoiceSetupSheet.swift:75-94 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:755 — CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:755-774 | CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:776-795 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift:91 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineCommandGroupView.swift:91-110 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineRows.swift:295-314 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListState.swift:33 — CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListState.swift:33-52 | CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListState.swift:83-103 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×4
  • Duplicated block (15 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:753 — CodexMobile/CodexMobile/Services/CodexService+History.swift:753-767 | CodexMobile/CodexMobile/Services/CodexService+History.swift:912-926 — 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:753` 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:4255 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4255-4269 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3033-3047 — 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:4401 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4401-4415 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3178-3192 — 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:4401` 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:3018 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3018-3032 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3039-3053 — 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:52 — phodex-bridge/src/codex-transport.js:52 · phodex-bridge/src/codex-transport.js:324 — 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:701 — REDACTED:701 · REDACTED:727 — 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.
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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D35 · Change Coupling · Change-coupling hub · ×3
  • 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 CodexMobile/CodexMobile/Services/CodexService+Connection.swift — `CodexMobile/CodexMobile/Services/CodexService+Connection.swift` changes together with 3 other files — `CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift`, `CodexMobile/CodexMobile/Services/CodexService+Transport.swift`, `CodexMobile/CodexMobile/Views/Home/ContentViewModel.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.
D4 · Code Duplication · Edited copy of a member (48 corresponding lines) · ×3
  • Edited copy of a member (48 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:214 — CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:214-268 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:408-455 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (48 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1299 — CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1299-1352 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1392-1439 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (48 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:983 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:983-1033 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2713-2760 — These two members are one piece of code written twice and then edited apart: 48 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 (11–12 lines × 2) · ×3
  • Duplicated block (11–12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1310 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1310-1321 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1358-1368 — 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:1356` calls `extractIncomingItemObject` and `CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1308` 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 (10 lines × 3) · ×3
  • Duplicated block (10 lines × 3) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:902 — CodexMobile/CodexMobile/Services/CodexService+Connection.swift:902-911 | CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:581-590 | CodexMobile/CodexMobile/Services/CodexService+RuntimeConfig.swift:805-814 — 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/Services/CodexService+Connection.swift:912` 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 × 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:2300 — REDACTED:2300-2309 | REDACTED:2533-2542 | REDACTED:2588-2597 — 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 lines × 3) · ×3
  • Duplicated block (6 lines × 3) CodexMobile/CodexMobile/Services/CodexService+History.swift:4289 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4289-4294 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3066-3071 | 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:4289` 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:1867 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1867-1874 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1942-1947 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2006-2011 — 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:1867` 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:1232 — 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:345 — phodex-bridge/src/session-jsonl-history.js:345 · phodex-bridge/src/session-jsonl-history.js:393 — 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.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×2
  • Edited copy of a member (25 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Account.swift:825 — CodexMobile/CodexMobile/Services/CodexService+Account.swift:825-849 | CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:64-90 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) CodexMobile/CodexMobile/Views/SidebarView.swift:309 — CodexMobile/CodexMobile/Views/SidebarView.swift:309-333 | CodexMobile/CodexMobile/Views/SidebarView.swift:335-359 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (50 corresponding lines) · ×2
  • Edited copy of a member (50 corresponding lines) REDACTED:1375 — REDACTED:1375-1424 | REDACTED:1427-1476 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (50 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:462 — CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:462-518 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:521-570 — These two members are one piece of code written twice and then edited apart: 50 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×2
  • Edited copy of a member (26 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6550 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6550-6583 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6604-6629 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:365 — CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:365-390 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:393-418 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×2
  • Edited copy of a member (28 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4511 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4511-4538 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:410-442 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Review.swift:147 — CodexMobile/CodexMobile/Services/CodexService+Review.swift:147-174 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2947-2980 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×2
  • Edited copy of a member (38 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:112 — CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:112-149 | CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:152-193 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:106 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:106-143 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:145-190 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×2
  • Edited copy of a member (33 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:537 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:537-570 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:573-605 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4347 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4347-4379 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3124-3156 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×2
  • Edited copy of a member (29 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:798 — CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:798-837 | CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:880-908 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListView.swift:119 — CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListView.swift:119-147 | CodexMobile/CodexMobile/Views/Sidebar/SidebarThreadListView.swift:234-270 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 14+ corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:321 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:321-340 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:342-359 | CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageRegexCache.swift:42-55 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) CodexMobile/CodexMobile/Views/Terminal/TerminalRouteChrome.swift:306 — CodexMobile/CodexMobile/Views/Terminal/TerminalRouteChrome.swift:306-321 | CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:151-165 | CodexMobile/CodexMobile/Views/Turn/Support/TurnImagePreview.swift:120-133 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 8+ corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3291 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3291-3299 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:395-402 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:465-474 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) CodexMobile/CodexMobile/Models/GitActionModels.swift:158 — CodexMobile/CodexMobile/Models/GitActionModels.swift:158-166 | CodexMobile/CodexMobile/Models/GitActionModels.swift:193-200 | CodexMobile/CodexMobile/Models/GitActionModels.swift:248-256 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 4+ corresponding lines) CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:957 — CodexMobile/CodexMobile/Services/CodexService+ThreadHistoryPagination.swift:957-962 | CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:380-385 | CodexMobile/CodexMobile/Services/CodexServiceError.swift:18-21 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:641 — CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:641-644 | CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:375-378 | CodexMobile/CodexMobile/Views/Turn/Timeline/TurnTimelineBlockAccessories.swift:333-336 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×2
  • Duplicated block (28 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3976 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3976-4003 | 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:3976` 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:1324 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1324-1351 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1406-1433 — 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:1324` 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 (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:1001 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1001-1020 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2727-2746 — 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:1001` 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 (9–12 lines × 2) · ×2
  • Duplicated block (9–12 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:3957 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3957-3965 | 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 (7–9 lines × 3) · ×2
  • Duplicated block (7–9 lines × 3) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3292 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3292-3299 | 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:169 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:169-177 | 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:201 — CodexMobile/CodexMobile/Views/MyMacs/MyDevicesSettingsSheet.swift:201-209 | 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:201` 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–9 lines × 2) · ×2
  • 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:144-151 — 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 (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2289 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2289-2295 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3029-3035 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3050-3056 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3084-3090 | 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:2289` 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:3083` calls `contains` and `CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3028` 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:120 — CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:120-126 | 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/Services/CodexComposerDraftPersistence.swift:47 — 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.
  • 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:1140-1144 — 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 (27 lines × 2 locations) · ×2
  • Duplicated block (27 lines × 2 locations) phodex-bridge/src/desktop-handler.js:228 — phodex-bridge/src/desktop-handler.js:228 · phodex-bridge/src/desktop-handler.js:262 — 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 (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:1379 — 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 (24 lines × 2 locations) · ×2
  • Duplicated block (24 lines × 2 locations) REDACTED:453 — REDACTED:453 · REDACTED:612 — 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:296 — phodex-bridge/src/session-jsonl-history.js:296 · phodex-bridge/src/session-jsonl-history.js:459 — 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) · ×2
  • 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.
R10 · Code Duplication · Duplicated block (12 lines × 2 locations) · ×2
  • Duplicated block (12 lines × 2 locations) phodex-bridge/src/bridge.js:3965 — phodex-bridge/src/bridge.js:3965 · phodex-bridge/src/bridge.js:4192 — 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:2783 — phodex-bridge/src/desktop-ipc-action-follower.js:2783 · phodex-bridge/src/desktop-ipc-action-follower.js:2809 — 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.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×2
  • Swallowed exception (caught, then discarded) phodex-bridge/src/git-handler.js:2123 — `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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
  • Swallowed exception (caught, then discarded) phodex-bridge/src/project-handler.js:378 — `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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
D1 · Cyclomatic Complexity · CodexService.mergeHistoryMessages (cyclomatic 168) · ×1
  • CodexService.mergeHistoryMessages (cyclomatic 168) CodexMobile/CodexMobile/Services/CodexService+History.swift:938 — 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:2055 — 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 76) · ×1
  • parseSessionJsonlTurns (cyclomatic 76) phodex-bridge/src/session-jsonl-history.js:442 — parseSessionJsonlTurns has cyclomatic complexity 76 (threshold 15). To reduce it, separate the cases: extract each independent branch into its 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 68) · ×1
  • CodexService.handleNotification (cyclomatic 68) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:177 — CodexService.handleNotification has cyclomatic complexity 68 (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 · bridge.startBridge (cyclomatic 57) · ×1
  • bridge.startBridge (cyclomatic 57) phodex-bridge/src/bridge.js:718 — bridge.startBridge has cyclomatic complexity 57 (threshold 15). Of this number, 30 points are the body's own statements and 27 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 · 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:718 — 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:2417 — 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:1288 — 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 · createDesktopIpcLiveOwner.observeOutbound (cyclomatic 45) · ×1
  • createDesktopIpcLiveOwner.observeOutbound (cyclomatic 45) phodex-bridge/src/desktop-ipc-live-owner.js:334 — createDesktopIpcLiveOwner.observeOutbound has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · 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:3521 — 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 · desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound (cyclomatic 44) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound (cyclomatic 44) phodex-bridge/src/desktop-ipc-live-owner.js:334 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound 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 · 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:1441 — 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 · CodexService.decodeMessagesFromThreadRead (cyclomatic 41) · ×1
  • CodexService.decodeMessagesFromThreadRead (cyclomatic 41) CodexMobile/CodexMobile/Services/CodexService+History.swift:104 — 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:1708 — 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 · 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:4208 — 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:3923 — 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:167 — 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:586 — 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:1992 — 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 · startBridge.handleApplicationMessage (cyclomatic 34) · ×1
  • startBridge.handleApplicationMessage (cyclomatic 34) phodex-bridge/src/bridge.js:1319 — startBridge.handleApplicationMessage has cyclomatic complexity 34 (threshold 15). Of this number, 30 points are the body's own statements and 4 belong to 7 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 · createDesktopIpcActionFollower.submitDesktopFollowerRequest (cyclomatic 34) · ×1
  • createDesktopIpcActionFollower.submitDesktopFollowerRequest (cyclomatic 34) phodex-bridge/src/desktop-ipc-action-follower.js:2448 — createDesktopIpcActionFollower.submitDesktopFollowerRequest has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 2 of the 34 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2512, 2486, 2456). 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 · createNormalizedLiveIndex (cyclomatic 34) · ×1
  • createNormalizedLiveIndex (cyclomatic 34) phodex-bridge/src/desktop-ipc-action-follower.js:3396 — 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 · CodexService.reconcileLocalThreadsWithServer (cyclomatic 33) · ×1
  • CodexService.reconcileLocalThreadsWithServer (cyclomatic 33) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:235 — CodexService.reconcileLocalThreadsWithServer 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 · 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:1037 — 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 · desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest (cyclomatic 33) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest (cyclomatic 33) phodex-bridge/src/desktop-ipc-action-follower.js:2448 — desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 1 of the 33 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 2512, 2486, 2456). 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 · normalizeRelayBoundJsonRpcMessage (cyclomatic 33) · ×1
  • normalizeRelayBoundJsonRpcMessage (cyclomatic 33) phodex-bridge/src/bridge.js:3618 — 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:519 — 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 · bridge.startBridge.handleApplicationMessage (cyclomatic 32) · ×1
  • bridge.startBridge.handleApplicationMessage (cyclomatic 32) phodex-bridge/src/bridge.js:1319 — bridge.startBridge.handleApplicationMessage has cyclomatic complexity 32 (threshold 15). Of this number, 28 points are the body's own statements and 4 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 · 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:3995 — 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 · createDesktopIpcLiveOwner.runNextQueuedFollowUp (cyclomatic 32) · ×1
  • createDesktopIpcLiveOwner.runNextQueuedFollowUp (cyclomatic 32) phodex-bridge/src/desktop-ipc-live-owner.js:1805 — createDesktopIpcLiveOwner.runNextQueuedFollowUp has cyclomatic complexity 32 (threshold 15). Most of this is not in the body itself: 6 of the 32 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 1815, (anonymous)::canRun, a function literal at line 1854, …). 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 · CodexService.handleTurnCompleted (cyclomatic 31) · ×1
  • CodexService.handleTurnCompleted (cyclomatic 31) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:845 — 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:5585 — 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 · trimThreadPayloadForRelay (cyclomatic 30) · ×1
  • trimThreadPayloadForRelay (cyclomatic 30) phodex-bridge/src/bridge.js:5105 — 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 · 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:2722 — 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:299 — 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 · desktop-ipc-live-owner.createDesktopIpcLiveOwner.runNextQueuedFollowUp (cyclomatic 29) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.runNextQueuedFollowUp (cyclomatic 29) phodex-bridge/src/desktop-ipc-live-owner.js:1805 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.runNextQueuedFollowUp has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 5 of the 29 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1815, 1820, 1863, …). 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 · 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:3595 — 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 · 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 · 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:1995 — 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 · CodexService.checkMissingCatalogThreads (cyclomatic 27) · ×1
  • CodexService.checkMissingCatalogThreads (cyclomatic 27) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:373 — CodexService.checkMissingCatalogThreads 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 · desktop-ipc-action-follower.applyImmerPatchCopyOnWrite (cyclomatic 27) · ×1
  • desktop-ipc-action-follower.applyImmerPatchCopyOnWrite (cyclomatic 27) phodex-bridge/src/desktop-ipc-action-follower.js:4190 — 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 · bridge.areEquivalentRelayHistoryItems (cyclomatic 27) · ×1
  • bridge.areEquivalentRelayHistoryItems (cyclomatic 27) phodex-bridge/src/bridge.js:4482 — 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:825 — 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 · CodexService.loadMacScopedDefaultsState (cyclomatic 26) · ×1
  • CodexService.loadMacScopedDefaultsState (cyclomatic 26) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:226 — CodexService.loadMacScopedDefaultsState has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · 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:2744 — 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:3251 — 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:28 — 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 110, a function literal at line 129, a function literal at line 97, …). 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.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:940 — 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:3053 — 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:3793 — 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 · desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState (cyclomatic 23) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState (cyclomatic 23) phodex-bridge/src/desktop-ipc-action-follower.js:1979 — desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState 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 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 · sanitizeThreadHistoryImagesForRelay (cyclomatic 23) · ×1
  • sanitizeThreadHistoryImagesForRelay (cyclomatic 23) phodex-bridge/src/bridge.js:3723 — sanitizeThreadHistoryImagesForRelay 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 · createDesktopIpcActionFollower.syncProjectedConversationState (cyclomatic 23) · ×1
  • createDesktopIpcActionFollower.syncProjectedConversationState (cyclomatic 23) phodex-bridge/src/desktop-ipc-action-follower.js:1979 — createDesktopIpcActionFollower.syncProjectedConversationState has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to 5 function literals inside it that branch. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · 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:497 — 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:446 — 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:1076 — 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:2253 — 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:1444 — 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 · startBridge.rememberForwardedRequestMethod (cyclomatic 22) · ×1
  • startBridge.rememberForwardedRequestMethod (cyclomatic 22) phodex-bridge/src/bridge.js:1989 — startBridge.rememberForwardedRequestMethod 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 · createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cyclomatic 22) · ×1
  • createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cyclomatic 22) phodex-bridge/src/desktop-ipc-action-follower.js:2120 — 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:250 — 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 · fileChangePatchKey (cyclomatic 22) · ×1
  • fileChangePatchKey (cyclomatic 22) phodex-bridge/src/session-jsonl-history.js:706 — fileChangePatchKey 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: 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 · CodexService.existingMessagesForCanonicalSourceReplacement (cyclomatic 21) · ×1
  • CodexService.existingMessagesForCanonicalSourceReplacement (cyclomatic 21) CodexMobile/CodexMobile/Services/CodexService+History.swift:737 — 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:3110 — 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:2662 — 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 · GPTVoiceTranscriptionManager.startRecording (cyclomatic 21) · ×1
  • GPTVoiceTranscriptionManager.startRecording (cyclomatic 21) CodexMobile/CodexMobile/Services/GPTVoiceTranscriptionManager.swift:100 — 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:3490 — 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:250 — 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 · bridge.startBridge.rememberForwardedRequestMethod (cyclomatic 21) · ×1
  • bridge.startBridge.rememberForwardedRequestMethod (cyclomatic 21) phodex-bridge/src/bridge.js:1989 — bridge.startBridge.rememberForwardedRequestMethod 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 · bridge.startBridge.sanitizeRelayBoundCodexMessage (cyclomatic 21) · ×1
  • bridge.startBridge.sanitizeRelayBoundCodexMessage (cyclomatic 21) phodex-bridge/src/bridge.js:2044 — bridge.startBridge.sanitizeRelayBoundCodexMessage has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · startBridge.sanitizeRelayBoundCodexMessage (cyclomatic 21) · ×1
  • startBridge.sanitizeRelayBoundCodexMessage (cyclomatic 21) phodex-bridge/src/bridge.js:2044 — startBridge.sanitizeRelayBoundCodexMessage has cyclomatic complexity 21 (threshold 15). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · handleDesktopMethod (cyclomatic 21) · ×1
  • handleDesktopMethod (cyclomatic 21) phodex-bridge/src/desktop-handler.js:62 — handleDesktopMethod has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
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.catchUpRunningThreadIfNeeded (cyclomatic 20) · ×1
  • CodexService.catchUpRunningThreadIfNeeded (cyclomatic 20) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:896 — 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 · CodexService.classifyVoiceFailureMessage (cyclomatic 20) · ×1
  • CodexService.classifyVoiceFailureMessage (cyclomatic 20) CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:164 — CodexService.classifyVoiceFailureMessage 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.emitNormalizedReviewOverlays (cyclomatic 20) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cyclomatic 20) phodex-bridge/src/desktop-ipc-action-follower.js:2120 — 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:3318 — 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:4661 — 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 4670, 4696). 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 · 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 · createDesktopIpcLiveOwner.broadcastConversationState (cyclomatic 20) · ×1
  • createDesktopIpcLiveOwner.broadcastConversationState (cyclomatic 20) phodex-bridge/src/desktop-ipc-live-owner.js:1241 — createDesktopIpcLiveOwner.broadcastConversationState has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: 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 · 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:436 — 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.migrateMacScopedState (cyclomatic 19) · ×1
  • CodexService.migrateMacScopedState (cyclomatic 19) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:461 — CodexService.migrateMacScopedState 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.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 · 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 · TurnViewModel.steerQueuedDraft (cyclomatic 19) · ×1
  • TurnViewModel.steerQueuedDraft (cyclomatic 19) REDACTED:2019 — TurnViewModel.steerQueuedDraft 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 · 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 · desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState (cyclomatic 19) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState (cyclomatic 19) phodex-bridge/src/desktop-ipc-live-owner.js:1241 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: 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 · bridge.shouldMergeLatestJsonlTurn (cyclomatic 19) · ×1
  • bridge.shouldMergeLatestJsonlTurn (cyclomatic 19) phodex-bridge/src/bridge.js:3261 — bridge.shouldMergeLatestJsonlTurn has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, 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 · maybeMergeLatestJsonlTurnIntoTurnsListResponse (cyclomatic 19) · ×1
  • maybeMergeLatestJsonlTurnIntoTurnsListResponse (cyclomatic 19) phodex-bridge/src/bridge.js:3214 — maybeMergeLatestJsonlTurnIntoTurnsListResponse has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 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 · 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:1145 — 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:357 — 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:910 — 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.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:1565 — 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:690 — 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-live-owner.createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cyclomatic 18) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cyclomatic 18) phodex-bridge/src/desktop-ipc-live-owner.js:1874 — 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:74 — 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:375 — 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 · bridge.startBridge.maybeBuildJsonlThreadTurnsListFallback (cyclomatic 18) · ×1
  • bridge.startBridge.maybeBuildJsonlThreadTurnsListFallback (cyclomatic 18) phodex-bridge/src/bridge.js:1755 — bridge.startBridge.maybeBuildJsonlThreadTurnsListFallback 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 · createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cyclomatic 18) · ×1
  • createThreadTurnsListFastPageCoordinator.resolveCanonicalRequest (cyclomatic 18) phodex-bridge/src/bridge.js:375 — 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 · startBridge.maybeBuildJsonlThreadTurnsListFallback (cyclomatic 18) · ×1
  • startBridge.maybeBuildJsonlThreadTurnsListFallback (cyclomatic 18) phodex-bridge/src/bridge.js:1755 — startBridge.maybeBuildJsonlThreadTurnsListFallback 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:1874 — 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:822 — 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:851 — 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:790 — 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:2750 — 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:3975 — 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:1219 — 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:2365 — 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:195 — 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 · desktop-handler.openThreadOnDesktop (cyclomatic 17) · ×1
  • desktop-handler.openThreadOnDesktop (cyclomatic 17) phodex-bridge/src/desktop-handler.js:160 — desktop-handler.openThreadOnDesktop 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, 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 · 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 · desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute (cyclomatic 17) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute (cyclomatic 17) phodex-bridge/src/desktop-ipc-action-follower.js:2364 — desktop-ipc-action-follower.createDesktopIpcActionFollower.buildDesktopFollowerRoute 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 · bridge.normalizeTurnStartForCodex (cyclomatic 17) · ×1
  • bridge.normalizeTurnStartForCodex (cyclomatic 17) phodex-bridge/src/bridge.js:2860 — 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.reconcileLegacyHomeThreadProject (cyclomatic 17) · ×1
  • bridge.reconcileLegacyHomeThreadProject (cyclomatic 17) phodex-bridge/src/bridge.js:3851 — bridge.reconcileLegacyHomeThreadProject 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 · bridge.augmentRelayHistoryTurnsWithJsonlArtifacts (cyclomatic 17) · ×1
  • bridge.augmentRelayHistoryTurnsWithJsonlArtifacts (cyclomatic 17) phodex-bridge/src/bridge.js:3978 — 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 4000, 3986). 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 · createDesktopIpcActionFollower.buildDesktopFollowerRoute (cyclomatic 17) · ×1
  • createDesktopIpcActionFollower.buildDesktopFollowerRoute (cyclomatic 17) phodex-bridge/src/desktop-ipc-action-follower.js:2364 — createDesktopIpcActionFollower.buildDesktopFollowerRoute 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:258 — 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:631 — 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:769 — 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:886 — 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:2860 — 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:982 — 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:3631 — 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 · CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod (cyclomatic 16) · ×1
  • CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod (cyclomatic 16) CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:64 — CodexService.shouldTreatAsUnsupportedVoiceBridgeMethod 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 · TurnViewModel.trailingFileToken (cyclomatic 16) · ×1
  • TurnViewModel.trailingFileToken (cyclomatic 16) REDACTED:2532 — 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 · desktop-ipc-shared.createFrameReader.push (cyclomatic 16) · ×1
  • desktop-ipc-shared.createFrameReader.push (cyclomatic 16) REDACTED:547 — desktop-ipc-shared.createFrameReader.push 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 · 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:1312 — 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:1057 — 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 · 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:3135 — 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:509 — 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.handlePeerBroadcast (cyclomatic 16) · ×1
  • createDesktopIpcLiveOwner.handlePeerBroadcast (cyclomatic 16) phodex-bridge/src/desktop-ipc-live-owner.js:1312 — 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 · createFrameReader.push (cyclomatic 16) · ×1
  • createFrameReader.push (cyclomatic 16) REDACTED:547 — createFrameReader.push 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 · gitBranches (cyclomatic 16) · ×1
  • gitBranches (cyclomatic 16) phodex-bridge/src/git-handler.js:484 — 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:913 — 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:938 — 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 155) · ×1
  • parseSessionJsonlTurns (cognitive 155) phodex-bridge/src/session-jsonl-history.js:442 — parseSessionJsonlTurns has cognitive complexity 155 (threshold 15). Drivers by points: if/else 31 (108 pts), boolean chains 23, ternaries 4 (17 pts), loops 2 (4 pts), error handling 1 (2 pts), other 1 (nesting depth added 93). 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:2055 — 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 · 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:104 — 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:3521 — 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:1288 — 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:718 — 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:586 — 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 · bridge.startBridge (cognitive 62) · ×1
  • bridge.startBridge (cognitive 62) phodex-bridge/src/bridge.js:718 — bridge.startBridge has cognitive complexity 62 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 18, ternaries 9, error handling 2 (3 pts) (nesting depth added 9). Of this number, 32 points are the body's own statements and 30 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.
D2 · Cognitive Complexity · CodexService.startThreadImpl (cognitive 61) · ×1
  • CodexService.startThreadImpl (cognitive 61) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:167 — 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:1441 — 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:1708 — 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:1992 — 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:825 — 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:2417 — 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 · mergeRelayHistoryItemsWithJsonlItems (cognitive 53) · ×1
  • mergeRelayHistoryItemsWithJsonlItems (cognitive 53) phodex-bridge/src/bridge.js:4208 — 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:3396 — 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 · createDesktopIpcLiveOwner.observeOutbound (cognitive 53) · ×1
  • createDesktopIpcLiveOwner.observeOutbound (cognitive 53) phodex-bridge/src/desktop-ipc-live-owner.js:334 — createDesktopIpcLiveOwner.observeOutbound has cognitive complexity 53 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 15, 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 · 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 · desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound (cognitive 52) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound (cognitive 52) phodex-bridge/src/desktop-ipc-live-owner.js:334 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.observeOutbound has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 15, 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 · 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 · 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.handleNotification (cognitive 47) · ×1
  • CodexService.handleNotification (cognitive 47) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:177 — CodexService.handleNotification has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24 (36 pts), boolean chains 7, match/switch 3 (4 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 · CodexService.handleTurnCompleted (cognitive 47) · ×1
  • CodexService.handleTurnCompleted (cognitive 47) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:845 — 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 · CodexService.reconcileLocalThreadsWithServer (cognitive 45) · ×1
  • CodexService.reconcileLocalThreadsWithServer (cognitive 45) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:235 — CodexService.reconcileLocalThreadsWithServer has cognitive complexity 45 (threshold 15). Drivers by points: if/else 19 (31 pts), boolean chains 11, loops 3 (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:4190 — 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:3251 — 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 · startBridge.handleApplicationMessage (cognitive 41) · ×1
  • startBridge.handleApplicationMessage (cognitive 41) phodex-bridge/src/bridge.js:1319 — startBridge.handleApplicationMessage has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (30 pts), boolean chains 5, error handling 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 9). Of this number, 33 points are the body's own statements and 8 belong to 7 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 · fetchAdaptiveThreadTurnsListForRelay (cognitive 41) · ×1
  • fetchAdaptiveThreadTurnsListForRelay (cognitive 41) phodex-bridge/src/bridge.js:3053 — 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 · createDesktopIpcActionFollower.submitDesktopFollowerRequest (cognitive 40) · ×1
  • createDesktopIpcActionFollower.submitDesktopFollowerRequest (cognitive 40) phodex-bridge/src/desktop-ipc-action-follower.js:2448 — createDesktopIpcActionFollower.submitDesktopFollowerRequest has cognitive complexity 40 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 12, ternaries 6 (12 pts), error handling 2 (3 pts) (nesting depth added 11). Most of this is not in the body itself: 1 of the 40 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 2512, 2486, 2456). 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 · 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:3923 — 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 · CodexService.loadMacScopedDefaultsState (cognitive 37) · ×1
  • CodexService.loadMacScopedDefaultsState (cognitive 37) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:226 — CodexService.loadMacScopedDefaultsState has cognitive complexity 37 (threshold 15). Drivers by points: if/else 23, boolean chains 12, 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 · TurnViewModel.steerQueuedDraft (cognitive 37) · ×1
  • TurnViewModel.steerQueuedDraft (cognitive 37) REDACTED:2019 — TurnViewModel.steerQueuedDraft has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 7, error handling 2 (4 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 · 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:1995 — 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 · trimThreadPayloadForRelay (cognitive 35) · ×1
  • trimThreadPayloadForRelay (cognitive 35) phodex-bridge/src/bridge.js:5105 — 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:519 — 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 · git-handler.assertWorktreeHasNoBoundChats (cognitive 34) · ×1
  • git-handler.assertWorktreeHasNoBoundChats (cognitive 34) phodex-bridge/src/git-handler.js:2253 — 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:1037 — 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-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest (cognitive 33) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest (cognitive 33) phodex-bridge/src/desktop-ipc-action-follower.js:2448 — desktop-ipc-action-follower.createDesktopIpcActionFollower.submitDesktopFollowerRequest has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 12, if/else 9 (10 pts), ternaries 6 (9 pts), error handling 1 (2 pts) (nesting depth added 5). None of this is in the body itself: all 33 points belong to 3 function literals inside it that branch (lines 2512, 2486, 2456). 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-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:357 — 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:3793 — 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 · CodexService.checkMissingCatalogThreads (cognitive 32) · ×1
  • CodexService.checkMissingCatalogThreads (cognitive 32) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:373 — CodexService.checkMissingCatalogThreads has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 15, if/else 8 (12 pts), error handling 2 (4 pts), loops 1 (nesting depth added 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 · 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 · bridge.startBridge.handleApplicationMessage (cognitive 31) · ×1
  • bridge.startBridge.handleApplicationMessage (cognitive 31) phodex-bridge/src/bridge.js:1319 — bridge.startBridge.handleApplicationMessage has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23 (27 pts), boolean chains 4 (nesting depth added 4). Of this number, 26 points are the body's own statements and 5 belong to 4 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 · 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-shared.createFrameReader.push (cognitive 30) · ×1
  • desktop-ipc-shared.createFrameReader.push (cognitive 30) REDACTED:547 — desktop-ipc-shared.createFrameReader.push has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 5, 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.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:3618 — 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:5585 — 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 · createDesktopIpcLiveOwner.observeInbound (cognitive 30) · ×1
  • createDesktopIpcLiveOwner.observeInbound (cognitive 30) phodex-bridge/src/desktop-ipc-live-owner.js:250 — 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 · createFrameReader.push (cognitive 30) · ×1
  • createFrameReader.push (cognitive 30) REDACTED:547 — createFrameReader.push has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 5, 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 · 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:2365 — 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:690 — 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:250 — 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 · 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:2722 — 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 · GPTVoiceTranscriptionManager.startRecording (cognitive 28) · ×1
  • GPTVoiceTranscriptionManager.startRecording (cognitive 28) CodexMobile/CodexMobile/Services/GPTVoiceTranscriptionManager.swift:100 — 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 · 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:299 — 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:1805 — 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 1815, a function literal at line 1854, (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:3595 — 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 · 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:3490 — 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:497 — 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:982 — 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 · desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState (cognitive 26) · ×1
  • desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState (cognitive 26) phodex-bridge/src/desktop-ipc-action-follower.js:1979 — desktop-ipc-action-follower.createDesktopIpcActionFollower.syncProjectedConversationState has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (10 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). 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 · session-jsonl-history.readRecentSessionJsonlTurns (cognitive 26) · ×1
  • session-jsonl-history.readRecentSessionJsonlTurns (cognitive 26) phodex-bridge/src/session-jsonl-history.js:74 — 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 · createDesktopIpcActionFollower.syncProjectedConversationState (cognitive 26) · ×1
  • createDesktopIpcActionFollower.syncProjectedConversationState (cognitive 26) phodex-bridge/src/desktop-ipc-action-follower.js:1979 — createDesktopIpcActionFollower.syncProjectedConversationState has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (10 pts), loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 5). Of this number, 25 points are the body's own statements and 1 belongs to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · gitBranches (cognitive 26) · ×1
  • gitBranches (cognitive 26) phodex-bridge/src/git-handler.js:484 — 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:446 — 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:1076 — 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:709 — 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 · startBridge.rememberForwardedRequestMethod (cognitive 25) · ×1
  • startBridge.rememberForwardedRequestMethod (cognitive 25) phodex-bridge/src/bridge.js:1989 — startBridge.rememberForwardedRequestMethod has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 8, if/else 6 (7 pts), other 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 · createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cognitive 25) · ×1
  • createDesktopIpcActionFollower.emitNormalizedReviewOverlays (cognitive 25) phodex-bridge/src/desktop-ipc-action-follower.js:2120 — 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:2744 — 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 · PerFileDiffParser.singleChunkFallback (cognitive 24) · ×1
  • PerFileDiffParser.singleChunkFallback (cognitive 24) CodexMobile/CodexMobile/Views/Turn/Diff/TurnPerFileDiffParser.swift:120 — PerFileDiffParser.singleChunkFallback has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (4 pts), ternaries 1 (4 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 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 · 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 · fileChangePatchKey (cognitive 24) · ×1
  • fileChangePatchKey (cognitive 24) phodex-bridge/src/session-jsonl-history.js:706 — fileChangePatchKey has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, ternaries 3 (4 pts), loops 2 (3 pts), 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.existingMessagesForCanonicalSourceReplacement (cognitive 23) · ×1
  • CodexService.existingMessagesForCanonicalSourceReplacement (cognitive 23) CodexMobile/CodexMobile/Services/CodexService+History.swift:737 — 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:2120 — 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:1805 — 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 1815, 1820, 1863, …). 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.startBridge.sanitizeRelayBoundCodexMessage (cognitive 23) · ×1
  • bridge.startBridge.sanitizeRelayBoundCodexMessage (cognitive 23) phodex-bridge/src/bridge.js:2044 — bridge.startBridge.sanitizeRelayBoundCodexMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, ternaries 1 (nesting depth added 6). Of this number, 17 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 · bridge.areEquivalentRelayHistoryItems (cognitive 23) · ×1
  • bridge.areEquivalentRelayHistoryItems (cognitive 23) phodex-bridge/src/bridge.js:4482 — 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 · startBridge.sanitizeRelayBoundCodexMessage (cognitive 23) · ×1
  • startBridge.sanitizeRelayBoundCodexMessage (cognitive 23) phodex-bridge/src/bridge.js:2044 — startBridge.sanitizeRelayBoundCodexMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 3, ternaries 1 (nesting depth added 6). Of this number, 17 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 · 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 · createDesktopIpcLiveOwner.broadcastConversationState (cognitive 23) · ×1
  • createDesktopIpcLiveOwner.broadcastConversationState (cognitive 23) phodex-bridge/src/desktop-ipc-live-owner.js:1241 — createDesktopIpcLiveOwner.broadcastConversationState has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 9, other 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 · 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:436 — 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:896 — 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:195 — 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:28 — 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 129, a function literal at line 154, a function literal at line 97, …). 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.applyConversationStateChange (cognitive 22) · ×1
  • desktop-ipc-action-follower.applyConversationStateChange (cognitive 22) phodex-bridge/src/desktop-ipc-action-follower.js:3318 — 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 · desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState (cognitive 22) · ×1
  • desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState (cognitive 22) phodex-bridge/src/desktop-ipc-live-owner.js:1241 — desktop-ipc-live-owner.createDesktopIpcLiveOwner.broadcastConversationState has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 9 (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 · session-jsonl-history.shouldSkipResponseItemForHistory (cognitive 22) · ×1
  • session-jsonl-history.shouldSkipResponseItemForHistory (cognitive 22) phodex-bridge/src/session-jsonl-history.js:1444 — 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:1526 — 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:1526 — 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 · 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:910 — 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:3975 — 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:4555 — 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:1219 — 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:1687 — 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:3301 — 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:375 — 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 · bridge.startBridge.rememberForwardedRequestMethod (cognitive 21) · ×1
  • bridge.startBridge.rememberForwardedRequestMethod (cognitive 21) phodex-bridge/src/bridge.js:1989 — bridge.startBridge.rememberForwardedRequestMethod has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 7, if/else 6 (7 pts), ternaries 4 (7 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 · 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:375 — 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:2121 — 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:102 — 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 · openThreadOnDesktop (cognitive 21) · ×1
  • openThreadOnDesktop (cognitive 21) phodex-bridge/src/desktop-handler.js:160 — openThreadOnDesktop has cognitive complexity 21 (threshold 15). Drivers by points: error handling 4 (7 pts), if/else 5 (6 pts), ternaries 5, boolean chains 3 (nesting depth added 4). Of this number, 18 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · 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:886 — 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:2860 — 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:3110 — 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:4250 — 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:2662 — 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:950 — 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.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:1565 — 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:150 — 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:2121 — 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:2860 — 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:4661 — 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 4670, 4696). 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:3023 — 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:3995 — 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:2178 — 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:3103 — 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 · CodexService.classifyVoiceFailureMessage (cognitive 19) · ×1
  • CodexService.classifyVoiceFailureMessage (cognitive 19) CodexMobile/CodexMobile/Services/CodexService+VoiceCompatibility.swift:164 — CodexService.classifyVoiceFailureMessage 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 · TurnDiffRenderingPolicy.section (cognitive 19) · ×1
  • TurnDiffRenderingPolicy.section (cognitive 19) CodexMobile/CodexMobile/Views/Turn/Diff/TurnDiffSheet.swift:41 — TurnDiffRenderingPolicy.section has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2, loops 1, 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 · 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:3023 — 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:295 — 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:295 — 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 · sanitizeThreadHistoryImagesForRelay (cognitive 19) · ×1
  • sanitizeThreadHistoryImagesForRelay (cognitive 19) phodex-bridge/src/bridge.js:3723 — sanitizeThreadHistoryImagesForRelay has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, ternaries 5 (6 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 · trimTurnsListPayloadForRelay (cognitive 19) · ×1
  • trimTurnsListPayloadForRelay (cognitive 19) phodex-bridge/src/bridge.js:5230 — 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 · gitCreatePullRequest (cognitive 19) · ×1
  • gitCreatePullRequest (cognitive 19) phodex-bridge/src/git-handler.js:1145 — 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:790 — 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:4511 — 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:3028 — 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.migrateMacScopedState (cognitive 18) · ×1
  • CodexService.migrateMacScopedState (cognitive 18) CodexMobile/CodexMobile/Services/CodexService+MacContext.swift:461 — CodexService.migrateMacScopedState 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.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:3415 — 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 · 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 · 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 · 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:258 — 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:588 — 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:851 — 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:769 — 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:657 — 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:3299 — 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:4444 — 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:1353 — 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.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.setForegroundState (cognitive 17) · ×1
  • CodexService.setForegroundState (cognitive 17) CodexMobile/CodexMobile/Services/CodexService+Sync.swift:98 — CodexService.setForegroundState has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 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 · 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:2532 — 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 · 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.boundedIndexedDesktopLiveTurns (cognitive 17) · ×1
  • desktop-ipc-action-follower.boundedIndexedDesktopLiveTurns (cognitive 17) phodex-bridge/src/desktop-ipc-action-follower.js:3741 — 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:1874 — 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:392 — 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.startBridge.maybeBuildJsonlThreadTurnsListFallback (cognitive 17) · ×1
  • bridge.startBridge.maybeBuildJsonlThreadTurnsListFallback (cognitive 17) phodex-bridge/src/bridge.js:1755 — bridge.startBridge.maybeBuildJsonlThreadTurnsListFallback has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, ternaries 5 (6 pts), if/else 4, error handling 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 · bridge.sanitizeLiveUserNotification (cognitive 17) · ×1
  • bridge.sanitizeLiveUserNotification (cognitive 17) phodex-bridge/src/bridge.js:4755 — 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 · startBridge.maybeBuildJsonlThreadTurnsListFallback (cognitive 17) · ×1
  • startBridge.maybeBuildJsonlThreadTurnsListFallback (cognitive 17) phodex-bridge/src/bridge.js:1755 — startBridge.maybeBuildJsonlThreadTurnsListFallback has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, ternaries 5 (6 pts), if/else 4, error handling 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 · truncateHistoryItemTextForRelay (cognitive 17) · ×1
  • truncateHistoryItemTextForRelay (cognitive 17) phodex-bridge/src/bridge.js:5379 — 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:151 — 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 · handleDesktopMethod (cognitive 17) · ×1
  • handleDesktopMethod (cognitive 17) phodex-bridge/src/desktop-handler.js:62 — handleDesktopMethod has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, 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 · createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cognitive 17) · ×1
  • createDesktopIpcLiveOwner.mergeFollowerRuntimeOverrides (cognitive 17) phodex-bridge/src/desktop-ipc-live-owner.js:1874 — 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:622 — 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:292 — 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:631 — 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:1649 — 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:1971 — 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:2750 — 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:4482 — 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:2607 — 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:2452 — 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:940 — 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:1312 — 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 · 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 · createDesktopIpcActionFollower.buildDesktopFollowerRoute (cognitive 16) · ×1
  • createDesktopIpcActionFollower.buildDesktopFollowerRoute (cognitive 16) phodex-bridge/src/desktop-ipc-action-follower.js:2364 — createDesktopIpcActionFollower.buildDesktopFollowerRoute has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 2 (3 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 · desktopFollowerPayloadForResponse (cognitive 16) · ×1
  • desktopFollowerPayloadForResponse (cognitive 16) phodex-bridge/src/desktop-ipc-action-follower.js:3135 — 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:509 — 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:1312 — 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:822 — 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:913 — 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 · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (5 members, 50+ identical tokens) CodexMobile/CodexMobile/Services/CodexService+RuntimeCompatibility.swift:25 — CodexMobile/CodexMobile/Services/CodexService+RuntimeCompatibility.swift:25-44 | CodexMobile/CodexMobile/Services/CodexService+Status.swift:281-298 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3180-3197 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3294-3307 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3503-3516 — These 5 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 5 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 5 times.
D4 · Code Duplication · Edited copy of a member (60 corresponding lines) · ×1
  • Edited copy of a member (60 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:358 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:358-445 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:448-507 — These two members are one piece of code written twice and then edited apart: 60 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×1
  • Edited copy of a member (40 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:3975 — CodexMobile/CodexMobile/Services/CodexService+History.swift:3975-4014 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:549-588 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (57 corresponding lines) · ×1
  • Edited copy of a member (57 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1127 — CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1127-1194 | CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1261-1317 — These two members are one piece of code written twice and then edited apart: 57 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (45 corresponding lines) · ×1
  • Edited copy of a member (45 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionStatusCard.swift:74 — CodexMobile/CodexMobile/Views/Turn/Messages/CommandExecutionStatusCard.swift:74-123 | CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:253-297 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×1
  • Edited copy of a member (34 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4400 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4400-4435 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3177-3210 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×1
  • Edited copy of a member (36 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4250 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4250-4286 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3028-3063 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (49 corresponding lines) · ×1
  • Edited copy of a member (49 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2528 — CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2528-2588 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:2591-2639 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×1
  • Edited copy of a member (41 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:379 — CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:379-419 | CodexMobile/CodexMobile/Views/Turn/Messages/WorkspaceImagePreview.swift:1261-1316 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×1
  • Edited copy of a member (39 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:664 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:664-704 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:743-781 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:152 — CodexMobile/CodexMobile/Services/CodexService+Connection.swift:152-211 | CodexMobile/CodexMobile/Services/CodexService+Connection.swift:687-738 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×1
  • Edited copy of a member (31 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4555 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4555-4586 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3301-3331 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 29+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 29+ corresponding lines) CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:63 — CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:63-91 | CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:93-130 | CodexMobile/CodexMobile/Views/Turn/Messages/SkillReferenceFormatter.swift:132-170 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×1
  • Edited copy of a member (24 corresponding lines) CodexMobile/CodexMobile/Services/CodexService+History.swift:4482 — CodexMobile/CodexMobile/Services/CodexService+History.swift:4482-4509 | CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:374-397 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×1
  • Edited copy of a member (35 corresponding lines) CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:332 — CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:332-370 | CodexMobile/CodexMobile/Views/Turn/Core/TurnViewModel+GitBranchWorktree.swift:372-406 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 18+ corresponding lines) CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:588 — CodexMobile/CodexMobile/Models/AIChangeSetModels.swift:588-612 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeBlockPresentation.swift:374-393 | CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:446-463 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 14+ corresponding lines) CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:264 — CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:264-286 | CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:289-307 | CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:322-335 | CodexMobile/CodexMobile/Services/CodexService+WorkspaceCheckpoints.swift:337-353 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 7+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 7+ corresponding lines) CodexMobile/CodexMobile/Services/GitActionsService.swift:132 — CodexMobile/CodexMobile/Services/GitActionsService.swift:132-139 | CodexMobile/CodexMobile/Services/GitActionsService.swift:141-148 | CodexMobile/CodexMobile/Services/GitActionsService.swift:217-223 | CodexMobile/CodexMobile/Services/GitActionsService.swift:225-231 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 12+ corresponding lines) CodexMobile/CodexMobile/Views/Sidebar/SidebarContentScopePicker.swift:182 — CodexMobile/CodexMobile/Views/Sidebar/SidebarContentScopePicker.swift:182-193 | CodexMobile/CodexMobile/Views/Turn/Composer/TurnMentionChips.swift:672-685 | CodexMobile/CodexMobile/Views/Turn/Messages/UserMessageBubble.swift:579-592 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 11+ corresponding lines) CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:300 — CodexMobile/CodexMobile/Views/Turn/Composer/TurnComposerCommandState.swift:300-313 | REDACTED:2348-2358 | REDACTED:2503-2513 | REDACTED:2515-2525 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 6+ corresponding lines) CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:30 — CodexMobile/CodexMobile/Services/CodexService+IncomingSupport.swift:30-37 | CodexMobile/CodexMobile/Views/Turn/Messages/MarkdownTextFormatter.swift:245-250 | CodexMobile/CodexMobile/Views/Turn/Messages/UserBubbleInlineMarkdownText.swift:343-348 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 5+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 5+ corresponding lines) CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:361 — CodexMobile/CodexMobile/Views/Turn/Diff/TurnFileChangeSummaryParser.swift:361-367 | CodexMobile/CodexMobile/Views/Turn/Messages/CodeCommentDirectiveParser.swift:146-152 | CodexMobile/CodexMobile/Views/Turn/Messages/TurnMessageRegexCache.swift:76-80 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · 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 (30 lines × 2) · ×1
  • Duplicated block (30 lines × 2) CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:675 — CodexMobile/CodexMobile/Views/Turn/Core/NewChatDraftView.swift:675-704 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:752-781 — 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 (26 lines × 2) · ×1
  • 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.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:564 — CodexMobile/CodexMobile/Services/CodexService+History.swift:564-587 | CodexMobile/CodexMobile/Services/CodexService+History.swift:590-614 — 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:1300 — CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1300-1321 | CodexMobile/CodexMobile/Views/Turn/Core/TurnView.swift:1393-1414 — 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:1300` 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 (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 (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 (16–17 lines × 2) · ×1
  • Duplicated block (16–17 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:2883 — CodexMobile/CodexMobile/Services/CodexService+History.swift:2883-2899 | CodexMobile/CodexMobile/Services/CodexService+Messages.swift:6984-6999 — 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:2883` 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. ★ 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:2882` 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 (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:1200 — CodexMobile/CodexMobile/Services/CodexService+SecureTransport.swift:1200-1214 | 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:1200` 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:93 — CodexMobile/CodexMobile/Services/AIChangeSetPersistence.swift:93-107 | 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 (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1939 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1939-1952 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2002-2016 — 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:1939` 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 (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2525 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2525-2538 | REDACTED:3199-3210 — 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:2525` 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 (11–13 lines × 2) · ×1
  • Duplicated block (11–13 lines × 2) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:501 — CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:501-513 | CodexMobile/CodexMobile/Services/CodexService+Sync.swift:676-686 — 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:501` 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:420 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:420-431 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:488-499 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:1697-1708 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:2026-2037 — 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:420` 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 (10 lines × 5) · ×1
  • Duplicated block (10 lines × 5) CodexMobile/CodexMobile/Services/CodexService+RuntimeCompatibility.swift:26 — CodexMobile/CodexMobile/Services/CodexService+RuntimeCompatibility.swift:26-35 | CodexMobile/CodexMobile/Services/CodexService+Status.swift:282-291 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3181-3190 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3295-3304 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3504-3513 — there are 5 copies across 3 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.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) CodexMobile/CodexMobile/Services/CodexService+History.swift:381 — CodexMobile/CodexMobile/Services/CodexService+History.swift:381-390 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2477-2484 — 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:381` 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 (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) CodexMobile/CodexMobile/Services/CodexService+Connection.swift:913 — CodexMobile/CodexMobile/Services/CodexService+Connection.swift:913-921 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3025-3033 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3046-3054 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3079-3087 — 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:913` 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–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1765 — CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1765-1771 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:1943-1950 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:2007-2014 — 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:3028 — CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3028-3033 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3049-3054 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3082-3087 | 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 (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 (10 lines × 4) · ×1
  • 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 (5 lines × 9) · ×1
  • Duplicated block (5 lines × 9) CodexMobile/CodexMobile/Services/CodexService+AIChangeSets.swift:676 — CodexMobile/CodexMobile/Services/CodexService+AIChangeSets.swift:676-683 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3718-3725 | CodexMobile/CodexMobile/Services/CodexService+Incoming.swift:3887-3894 | 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:1080-1087 | CodexMobile/CodexMobile/Services/CodexService+ThreadsTurns.swift:3214-3218 — 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.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:515 — CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:515-522 | CodexMobile/CodexMobile/Services/CodexService+Helpers.swift:524-531 | 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.
R1 · Type Safety · Type Safety · ×1
  • Type Safety — 0 typed · 115 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 (+109 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:2867 — phodex-bridge/src/desktop-ipc-action-follower.js:2867 · phodex-bridge/src/desktop-ipc-owner-transport.js:72 — the two spans are one implementation copied and then locally edited — 621 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 × 2 locations) · ×1
  • Duplicated block (35 lines × 2 locations) phodex-bridge/src/pet-handler.js:17 — phodex-bridge/src/pet-handler.js:17 · phodex-bridge/src/workspace-handler.js:46 — 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 (32 lines × 2 locations) · ×1
  • Duplicated block (32 lines × 2 locations) phodex-bridge/src/desktop-handler.js:26 — phodex-bridge/src/desktop-handler.js:26 · phodex-bridge/src/workspace-handler.js:48 — 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.
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:862 — REDACTED:862 · 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:4216 — phodex-bridge/src/desktop-ipc-action-follower.js:4216 · 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 (22 lines × 2 locations) · ×1
  • Duplicated block (22 lines × 2 locations) phodex-bridge/src/git-handler.js:2981 — phodex-bridge/src/git-handler.js:2981 · phodex-bridge/src/workspace-handler.js:1333 — 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:4273 — phodex-bridge/src/bridge.js:4273 · phodex-bridge/src/bridge.js:4296 — 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:42 · 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:658 — phodex-bridge/src/codex-desktop-refresher.js:658 · phodex-bridge/src/desktop-ipc-live-owner.js:1154 — 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:475 — 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 76, cognitive 155) · ×1
  • Complex function parseSessionJsonlTurns (cyclomatic 76, cognitive 155) phodex-bridge/src/session-jsonl-history.js:442 — parseSessionJsonlTurns has cyclomatic complexity 76 and cognitive complexity 155; 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 observeOutbound (cyclomatic 45, cognitive 53) · ×1
  • Complex function observeOutbound (cyclomatic 45, cognitive 53) phodex-bridge/src/desktop-ipc-live-owner.js:334 — observeOutbound has cyclomatic complexity 45 and cognitive complexity 53; 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:3521 — 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 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:3618 — 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:1037 — 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:3396 — 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.
R2 · Cyclomatic Complexity · Complex function readDescendingTurnPage (cyclomatic 30, cognitive 48) · ×1
  • Complex function readDescendingTurnPage (cyclomatic 30, cognitive 48) phodex-bridge/src/opencode-runtime.js:1177 — readDescendingTurnPage has cyclomatic complexity 30 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 tick (cyclomatic 30, cognitive 39) · ×1
  • Complex function tick (cyclomatic 30, cognitive 39) phodex-bridge/src/rollout-live-mirror.js:201 — tick has cyclomatic complexity 30 and cognitive complexity 39; 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 main (cyclomatic 30, cognitive 37) · ×1
  • Complex function main (cyclomatic 30, cognitive 37) phodex-bridge/bin/remodex.js:67 — main has cyclomatic complexity 30 and cognitive complexity 37; 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 trimThreadPayloadForRelay (cyclomatic 30, cognitive 35) · ×1
  • Complex function trimThreadPayloadForRelay (cyclomatic 30, cognitive 35) phodex-bridge/src/bridge.js:5105 — trimThreadPayloadForRelay has cyclomatic complexity 30 and cognitive complexity 35; 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 handleApplicationMessage (cyclomatic 30, cognitive 33) · ×1
  • Complex function handleApplicationMessage (cyclomatic 30, cognitive 33) phodex-bridge/src/bridge.js:1319 — handleApplicationMessage has cyclomatic complexity 30 and cognitive complexity 33; 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 projectTurn (cyclomatic 30, cognitive 29) · ×1
  • Complex function projectTurn (cyclomatic 30, cognitive 29) phodex-bridge/src/desktop-ipc-conversation-projector.js:262 — projectTurn has cyclomatic complexity 30 and cognitive complexity 29; 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 runPendingRefresh (cyclomatic 29, cognitive 28) · ×1
  • Complex function runPendingRefresh (cyclomatic 29, cognitive 28) phodex-bridge/src/codex-desktop-refresher.js:299 — runPendingRefresh has cyclomatic complexity 29 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 mergeRelayHistoryItemsWithJsonlItems (cyclomatic 28, cognitive 43) · ×1
  • Complex function mergeRelayHistoryItemsWithJsonlItems (cyclomatic 28, cognitive 43) phodex-bridge/src/bridge.js:4208 — mergeRelayHistoryItemsWithJsonlItems has cyclomatic complexity 28 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 tryServeDesktopOwnedRead (cyclomatic 28, cognitive 30) · ×1
  • Complex function tryServeDesktopOwnedRead (cyclomatic 28, cognitive 30) phodex-bridge/src/desktop-ipc-action-follower.js:1654 — tryServeDesktopOwnedRead has cyclomatic complexity 28 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 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 applyImmerPatchCopyOnWrite (cyclomatic 27, cognitive 43) · ×1
  • Complex function applyImmerPatchCopyOnWrite (cyclomatic 27, cognitive 43) phodex-bridge/src/desktop-ipc-action-follower.js:4190 — applyImmerPatchCopyOnWrite has cyclomatic complexity 27 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 areEquivalentRelayHistoryItems (cyclomatic 27, cognitive 22) · ×1
  • Complex function areEquivalentRelayHistoryItems (cyclomatic 27, cognitive 22) phodex-bridge/src/bridge.js:4482 — areEquivalentRelayHistoryItems has cyclomatic complexity 27 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function backgroundRawTurn (cyclomatic 25, cognitive 14) · ×1
  • Complex function backgroundRawTurn (cyclomatic 25, cognitive 14) phodex-bridge/src/desktop-ipc-action-follower.js:3995 — backgroundRawTurn has cyclomatic complexity 25 and cognitive complexity 14; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function fetchAdaptiveThreadTurnsListForRelay (cyclomatic 24, cognitive 41) · ×1
  • Complex function fetchAdaptiveThreadTurnsListForRelay (cyclomatic 24, cognitive 41) phodex-bridge/src/bridge.js:3053 — fetchAdaptiveThreadTurnsListForRelay has cyclomatic complexity 24 and cognitive complexity 41; 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 applyPatchToBaselineNode (cyclomatic 24, cognitive 33) · ×1
  • Complex function applyPatchToBaselineNode (cyclomatic 24, cognitive 33) phodex-bridge/src/desktop-ipc-state-patches.js:146 — applyPatchToBaselineNode has cyclomatic complexity 24 and cognitive complexity 33; 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 backgroundHistoryTurns (cyclomatic 24, cognitive 28) · ×1
  • Complex function backgroundHistoryTurns (cyclomatic 24, cognitive 28) phodex-bridge/src/desktop-ipc-action-follower.js:3923 — backgroundHistoryTurns has cyclomatic complexity 24 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 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 handleGoalUpdated (cyclomatic 24, cognitive 22) · ×1
  • Complex function handleGoalUpdated (cyclomatic 24, cognitive 22) phodex-bridge/src/push-notification-tracker.js:170 — handleGoalUpdated has cyclomatic complexity 24 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function observeThreadListResponse (cyclomatic 23, cognitive 30) · ×1
  • Complex function observeThreadListResponse (cyclomatic 23, cognitive 30) phodex-bridge/src/desktop-ipc-action-follower.js:366 — observeThreadListResponse has cyclomatic complexity 23 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 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 workspaceReadImage (cyclomatic 23, cognitive 22) · ×1
  • Complex function workspaceReadImage (cyclomatic 23, cognitive 22) phodex-bridge/src/workspace-handler.js:176 — workspaceReadImage has cyclomatic complexity 23 and cognitive complexity 22; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function normalizePart (cyclomatic 23, cognitive 20) · ×1
  • Complex function normalizePart (cyclomatic 23, cognitive 20) phodex-bridge/src/opencode-runtime.js:117 — normalizePart has cyclomatic complexity 23 and cognitive complexity 20; 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 sanitizeThreadHistoryImagesForRelay (cyclomatic 23, cognitive 19) · ×1
  • Complex function sanitizeThreadHistoryImagesForRelay (cyclomatic 23, cognitive 19) phodex-bridge/src/bridge.js:3723 — sanitizeThreadHistoryImagesForRelay has cyclomatic complexity 23 and cognitive complexity 19; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive 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.
R3 · Large Files · phodex-bridge/src/bridge.js · ×1
  • phodex-bridge/src/bridge.js: 5206 lines of code phodex-bridge/src/bridge.js:1 — phodex-bridge/src/bridge.js has 5206 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: 4035 lines of code phodex-bridge/src/desktop-ipc-action-follower.js:1 — phodex-bridge/src/desktop-ipc-action-follower.js has 4035 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: 2700 lines of code phodex-bridge/src/git-handler.js:1 — phodex-bridge/src/git-handler.js has 2700 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: 2067 lines of code phodex-bridge/src/desktop-ipc-live-owner.js:1 — phodex-bridge/src/desktop-ipc-live-owner.js has 2067 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: 1486 lines of code phodex-bridge/src/session-jsonl-history.js:1 — phodex-bridge/src/session-jsonl-history.js has 1486 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: 1398 lines of code phodex-bridge/src/desktop-ipc-conversation-adapter.js:1 — phodex-bridge/src/desktop-ipc-conversation-adapter.js has 1398 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: 1220 lines of code phodex-bridge/src/workspace-handler.js:1 — phodex-bridge/src/workspace-handler.js has 1220 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 · REDACTED · ×1
  • REDACTED: 908 lines of code REDACTED:1 — REDACTED has 908 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 · phodex-bridge/src/codex-desktop-refresher.js · ×1
  • phodex-bridge/src/codex-desktop-refresher.js: 874 lines of code phodex-bridge/src/codex-desktop-refresher.js:1 — phodex-bridge/src/codex-desktop-refresher.js has 874 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: 709 lines of code REDACTED:1 — REDACTED has 709 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: 524 lines of code phodex-bridge/src/voice-handler.js:1 — phodex-bridge/src/voice-handler.js has 524 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: 505 lines of code phodex-bridge/src/desktop-handler.js:1 — phodex-bridge/src/desktop-handler.js has 505 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 (17 application, 6 tooling, 55 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 — 116 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×40
  • 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:3026 — `!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:3013 — `!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:4216 — `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:2902 — `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:2139 — `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:2627 — `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:2180 — `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.
  • + 15 more in this group — see findings.md.
P2 · Observability · Console output used as the logging channel · ×39
  • Console output used as the logging channel phodex-bridge/src/bridge.js:741 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 741 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:742 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 742 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:750 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 750 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:1014 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1014 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:1016 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1016 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:1017 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1017 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:1018 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1018 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:1020 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1020 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:1082 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1082 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:1111 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1111 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:1133 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1133 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:1303 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1303 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:1353 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1353 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:1811 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 1811 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:2386 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 2386 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:2606 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 2606 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:4070 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 4070 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:4107 — `phodex-bridge/src/bridge.js` reports through `console.*` at line 4107 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:580 — `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 580 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:585 — `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 585 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:616 — `phodex-bridge/src/codex-desktop-refresher.js` reports through `console.*` at line 616 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:2353 — `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2353 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:2516 — `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2516 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:2610 — `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2610 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:2708 — `phodex-bridge/src/desktop-ipc-action-follower.js` reports through `console.*` at line 2708 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.
X7 · Silent fallback defaults · Silent fallback default in catch · ×16
  • 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:1027 — `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:880 — `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/session-jsonl-history.js:241 — `readRecentSessionJsonlCwd` 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/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:3912 — `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:299 — `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:357 — `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:401 — 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 CodexMobile/CodexMobile.xcodeproj/project.pbxproj:1 — 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/`. ADRs are expected here because `CodexMobile/CodexMobile.xcodeproj/project.pbxproj` makes this repository a deployable product (line 1).
D21 · Naming Consistency · `hasInlineHistoryImageDataURL` spells `URL` where 22 names in the project spell it `Url` · ×1
  • `hasInlineHistoryImageDataURL` spells `URL` where 22 names in the project spell it `Url` phodex-bridge/src/bridge.js:5081 — 22 of 24 names in project repository spell the token `Url` (22 of 24; unit: names in project repository containing `Url`). Peers: CodexDesktopRefresher.pendingCompletionTargetUrl (phodex-bridge/src/codex-desktop-refresher.js:76); CodexDesktopRefresher.pendingTargetUrl (phodex-bridge/src/codex-desktop-refresher.js:78); CodexDesktopRefresher.executeRefresh(targetUrl) (phodex-bridge/src/codex-desktop-refresher.js:398); CodexDesktopRefresher.followActivationTargetUrl (phodex-bridge/src/codex-desktop-refresher.js:644); CodexDesktopRefresher.followActivationTargetUrl(targetUrl) (phodex-bridge/src/codex-desktop-refresher.js:644). Rename to `hasInlineHistoryImageDataUrl`. [rule N6]
D21 · Naming Consistency · `sessionID` spells `ID` where 225 names in the project spell it `Id` · ×1
  • `sessionID` spells `ID` where 225 names in the project spell it `Id` phodex-bridge/src/opencode-runtime.js:21 — 225 of 229 names in project repository spell the token `Id` (225 of 229; unit: names in project repository containing `Id`). Peers: remodex-jsonl-diagnose.ensureTurn(turnsById) (phodex-bridge/bin/remodex-jsonl-diagnose.js:292); remodex-jsonl-diagnose.ensureTurn(turnId) (phodex-bridge/bin/remodex-jsonl-diagnose.js:292); remodex-jsonl-diagnose.readTurnId (phodex-bridge/bin/remodex-jsonl-diagnose.js:434); bridge.annotateTurnStateProbeWithMirrorActiveTurn(getMirrorActiveTurnId) (phodex-bridge/src/bridge.js:568); bridge.rebindThreadTurnsListResponseId (phodex-bridge/src/bridge.js:624). Rename to `sessionId`. [rule N6]
D21 · Naming Consistency · `modelID` spells `ID` where 225 names in the project spell it `Id` · ×1
  • `modelID` spells `ID` where 225 names in the project spell it `Id` phodex-bridge/src/opencode-runtime.js:170 — 225 of 229 names in project repository spell the token `Id` (225 of 229; unit: names in project repository containing `Id`). Peers: remodex-jsonl-diagnose.ensureTurn(turnsById) (phodex-bridge/bin/remodex-jsonl-diagnose.js:292); remodex-jsonl-diagnose.ensureTurn(turnId) (phodex-bridge/bin/remodex-jsonl-diagnose.js:292); remodex-jsonl-diagnose.readTurnId (phodex-bridge/bin/remodex-jsonl-diagnose.js:434); bridge.annotateTurnStateProbeWithMirrorActiveTurn(getMirrorActiveTurnId) (phodex-bridge/src/bridge.js:568); bridge.rebindThreadTurnsListResponseId (phodex-bridge/src/bridge.js:624). Rename to `modelId`. [rule N6]
D21 · Naming Consistency · `petFolderNameFromID` spells `ID` where 225 names in the project spell it `Id` · ×1
  • `petFolderNameFromID` spells `ID` where 225 names in the project spell it `Id` phodex-bridge/src/pet-handler.js:133 — 225 of 229 names in project repository spell the token `Id` (225 of 229; unit: names in project repository containing `Id`). Peers: remodex-jsonl-diagnose.ensureTurn(turnsById) (phodex-bridge/bin/remodex-jsonl-diagnose.js:292); remodex-jsonl-diagnose.ensureTurn(turnId) (phodex-bridge/bin/remodex-jsonl-diagnose.js:292); remodex-jsonl-diagnose.readTurnId (phodex-bridge/bin/remodex-jsonl-diagnose.js:434); bridge.annotateTurnStateProbeWithMirrorActiveTurn(getMirrorActiveTurnId) (phodex-bridge/src/bridge.js:568); bridge.rebindThreadTurnsListResponseId (phodex-bridge/src/bridge.js:624). Rename to `petFolderNameFromId`. [rule N6]
D21 · Naming Consistency · `rawID` spells `ID` where 225 names in the project spell it `Id` · ×1
  • `rawID` spells `ID` where 225 names in the project spell it `Id` phodex-bridge/src/pet-handler.js:133 — 225 of 229 names in project repository spell the token `Id` (225 of 229; unit: names in project repository containing `Id`). Peers: remodex-jsonl-diagnose.ensureTurn(turnsById) (phodex-bridge/bin/remodex-jsonl-diagnose.js:292); remodex-jsonl-diagnose.ensureTurn(turnId) (phodex-bridge/bin/remodex-jsonl-diagnose.js:292); remodex-jsonl-diagnose.readTurnId (phodex-bridge/bin/remodex-jsonl-diagnose.js:434); bridge.annotateTurnStateProbeWithMirrorActiveTurn(getMirrorActiveTurnId) (phodex-bridge/src/bridge.js:568); bridge.rebindThreadTurnsListResponseId (phodex-bridge/src/bridge.js:624). Rename to `rawId`. [rule N6]
D21 · Naming Consistency · `containsInlineImageDataURL` spells `URL` where 22 names in the project spell it `Url` · ×1
  • `containsInlineImageDataURL` spells `URL` where 22 names in the project spell it `Url` phodex-bridge/src/session-jsonl-history.js:1161 — 22 of 24 names in project repository spell the token `Url` (22 of 24; unit: names in project repository containing `Url`). Peers: CodexDesktopRefresher.pendingCompletionTargetUrl (phodex-bridge/src/codex-desktop-refresher.js:76); CodexDesktopRefresher.pendingTargetUrl (phodex-bridge/src/codex-desktop-refresher.js:78); CodexDesktopRefresher.executeRefresh(targetUrl) (phodex-bridge/src/codex-desktop-refresher.js:398); CodexDesktopRefresher.followActivationTargetUrl (phodex-bridge/src/codex-desktop-refresher.js:644); CodexDesktopRefresher.followActivationTargetUrl(targetUrl) (phodex-bridge/src/codex-desktop-refresher.js:644). Rename to `containsInlineImageDataUrl`. [rule N6]
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` (106923 LoC, 882 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.
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 REDACTED:9 — 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 2 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation phodex-bridge/package.json:39 — `phodex-bridge/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
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:1529 — 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.23.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/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-0cebfe935ddb44308cd2c60a968b8cc8/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/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-0cebfe935ddb44308cd2c60a968b8cc8/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude 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/** .1artifacts/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 72 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`, … (+67 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1dc38-42af-7030-9229-a853dffa59b2 · 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