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

steipete/CodexBar

Measured 26 October 2026, 09:11 UTC, at code version d34fbb4

Regression: 2 dimensions fell since the last survey

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

CAI score 46out of 100 Adequate
CriticalWeakAdequateStrongExemplary
No change 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: 286,819 lines of product code in 11 projects, tests not counted · Estimated rebuild effort: about 4.7 person-years · Weakest lens: Code Health, 33

Findings by how serious they are

76 critical 2531 serious 84 minor

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

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
26 October 2026, 09:11 UTC

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

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

71of 71 dimensions measured by tools.
2671of 2691 findings point to an exact file and line, so you can open each one in the code. The other 20 concern the repository as a whole, such as missing documentation.
71dimensions across 7 lenses, read from 286,819 lines of product code in 11 projects.
Chapters

Executive summary

steipete/CodexBar falls short of our standard for a preview release, held back most by its Code Health lens, the quality of the code itself. It scores 46 out of 100 and is rated Adequate, and 32 of its 76 critical findings are security problems.

Code Health, at 33, is the weakest lens and counts most in the score. The best first step is replacing the 24 exposed passwords or keys and switching the old ones off, worth about 10 points. Simplifying the most tangled functions would lift Code Health itself, worth about 4 points. Raising Code Health to 67 would lift the score to about 55.

Twenty-four passwords or keys in the code and four in the code's history are open to anyone who can read the repository. Three pipeline steps run downloads nobody checks, and one weakness in the code could be used by an attacker. Replacing each exposed password or key, checking each download against a checksum and fixing the weaknesses the scanner points to would close these risks. Giving each kind of identifier a type of its own would take care of the 40 identifiers passed around as plain numbers or text.

The product code is 286,819 lines, about €690,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 33 · counts for 46%Production Readiness 36 · counts for 25%Security and Compliance 69 · counts for 14%Performance 72 · counts for 8%Domain Modelling 85 · counts for 4%Maturity 86 · counts for 2%Architecture 90 · counts for 1%

If Code Health rose from 33 to 67, the lowest score rated Strong, the score would rise from 46 to about 55.

Code composition: what the lines of code are
Product code 37%Tests 63%
New since the last survey: 208 findings

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

  • Cyclomatic Complexity · fetchUsage (cyclomatic 48) REDACTED
  • Cyclomatic Complexity · CodexRequestLedger.load (cyclomatic 37) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift
  • Cyclomatic Complexity · CodexBarCLI.topCostModelLines (cyclomatic 36) Sources/CodexBarCLI/CLICostCommand.swift
  • Cyclomatic Complexity · fetchUsage (cyclomatic 35) Sources/CodexBarCore/Resources/Plugins/flora.js
  • Cyclomatic Complexity · fetchUsage (cyclomatic 32) Sources/CodexBarCore/Resources/Plugins/traecn.js
  • Cyclomatic Complexity · CodexBarCLI.runStandardCost (cyclomatic 26) Sources/CodexBarCLI/CLICostCommand.swift
  • Cyclomatic Complexity · fetchUsage (cyclomatic 26) Sources/CodexBarCore/Resources/Plugins/fal.js
  • Cyclomatic Complexity · CodexBarCLI.runCodexIdentifiedUsage (cyclomatic 24) Sources/CodexBarCLI/CLICodexIdentifiedUsage.swift
  • Cyclomatic Complexity · CodexRequestLedger.validate (cyclomatic 24) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift
  • Cyclomatic Complexity · WidgetExtensionRecovery.launch (cyclomatic 23) Sources/CodexBarCore/WidgetExtensionRecovery.swift
  • Cyclomatic Complexity · CursorStatusSnapshot.toUsageSnapshot (cyclomatic 21) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift
  • Cyclomatic Complexity · SessionUsagePresentation.sessions (cyclomatic 19) Sources/CodexBar/SessionUsagePresentation.swift
  • Cyclomatic Complexity · ProviderIntentPayload.applying (cyclomatic 19) Sources/CodexBarCore/Sync/SyncModels.swift
  • Cyclomatic Complexity · Model.monthlyTargetMetrics (cyclomatic 18) Sources/CodexBar/MenuCardView+MonthlyTarget.swift
  • Cyclomatic Complexity · Model.applyingUsageItemVisibility (cyclomatic 18) Sources/CodexBar/ProviderUsageItemVisibility.swift
  • Cyclomatic Complexity · StatusItemController.addOverviewRows (cyclomatic 18) Sources/CodexBar/StatusItemController+Menu.swift
  • Cyclomatic Complexity · Model.usageItemDescriptors (cyclomatic 17) Sources/CodexBar/ProviderUsageItemVisibility.swift
  • Cyclomatic Complexity · ProviderPluginIconSVG.hasBoundedCanvas (cyclomatic 17) Sources/CodexBarCore/Plugins/ProviderPluginIconSVG.swift
  • Cyclomatic Complexity · UsageMenuCardUsageContentView.body (cyclomatic 16) Sources/CodexBar/MenuCardView.swift
  • Cyclomatic Complexity · OpenAILiveUsageModel.refresh (cyclomatic 16) Sources/CodexBar/Providers/OpenAI/OpenAILiveUsageModel.swift
  • Cyclomatic Complexity · CodexBarCLI.dailyCostLines (cyclomatic 16) Sources/CodexBarCLI/CLICostCommand.swift
  • Cyclomatic Complexity · UsageLimitsAvailability.resolve (cyclomatic 16) Sources/CodexBarCore/UsageFetcher.swift
  • Cyclomatic Complexity · OpenAIDashboardWebViewCache.acquire (cyclomatic 16) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardWebViewCache.swift
  • Cyclomatic Complexity · OpenAILiveUsageBuilder.build (cyclomatic 16) Sources/CodexBarCore/Providers/OpenAI/OpenAILiveUsageBuilder.swift
  • Cyclomatic Complexity · OpenAIOrgRateLimitsFetcher.pages (cyclomatic 16) Sources/CodexBarCore/Providers/OpenAI/OpenAIOrgRateLimitsFetcher.swift
  • Cyclomatic Complexity · OpenCodeGoLocalUsageReader.readRows (cyclomatic 16) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoLocalUsageReader.swift
  • Cyclomatic Complexity · acknowledgements.check (cyclomatic 16) Scripts/acknowledgements.py
  • Cognitive Complexity · CodexBarCLI.topCostModelLines (cognitive 62) Sources/CodexBarCLI/CLICostCommand.swift
  • Cognitive Complexity · CodexRequestLedger.load (cognitive 57) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift
  • Cognitive Complexity · fetchUsage (cognitive 57) REDACTED
  • Cognitive Complexity · fetchUsage (cognitive 36) Sources/CodexBarCore/Resources/Plugins/flora.js
  • Cognitive Complexity · SessionUsagePresentation.sessions (cognitive 35) Sources/CodexBar/SessionUsagePresentation.swift
  • Cognitive Complexity · StatusItemController.addOverviewRows (cognitive 35) Sources/CodexBar/StatusItemController+Menu.swift
  • Cognitive Complexity · fetchUsage (cognitive 35) Sources/CodexBarCore/Resources/Plugins/traecn.js
  • Cognitive Complexity · CodexBarCLI.runStandardCost (cognitive 34) Sources/CodexBarCLI/CLICostCommand.swift
  • Cognitive Complexity · fetchUsage (cognitive 28) Sources/CodexBarCore/Resources/Plugins/fal.js
  • Cognitive Complexity · UsageStore.emitUserPluginHooks (cognitive 27) Sources/CodexBar/UsageStore+UserPlugins.swift
  • Cognitive Complexity · CodexBarCLI.runCodexIdentifiedUsage (cognitive 27) Sources/CodexBarCLI/CLICodexIdentifiedUsage.swift
  • Cognitive Complexity · CodexRequestLedger.validate (cognitive 25) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift
  • Cognitive Complexity · OpenAILiveUsageFetcher.fetch (cognitive 25) Sources/CodexBarCore/Providers/OpenAI/OpenAILiveUsageFetcher.swift
  • Cognitive Complexity · UsageStore.providerWithHighestUsage (cognitive 24) Sources/CodexBar/UsageStore+HighestUsage.swift
  • Cognitive Complexity · CodexBarCLI.dailyCostLines (cognitive 24) Sources/CodexBarCLI/CLICostCommand.swift
  • Cognitive Complexity · acknowledgements.check (cognitive 24) Scripts/acknowledgements.py
  • Cognitive Complexity · OpenAILiveUsageBuilder.build (cognitive 23) Sources/CodexBarCore/Providers/OpenAI/OpenAILiveUsageBuilder.swift
  • Cognitive Complexity · OpenAIOrgRateLimitsFetcher.pages (cognitive 23) Sources/CodexBarCore/Providers/OpenAI/OpenAIOrgRateLimitsFetcher.swift
  • Cognitive Complexity · WidgetExtensionRecovery.launch (cognitive 22) Sources/CodexBarCore/WidgetExtensionRecovery.swift
  • Cognitive Complexity · ProviderPluginPersistentCookies.next (cognitive 22) Sources/CodexBarCore/Plugins/ProviderPluginPersistentCookies.swift
  • Cognitive Complexity · OpenAILiveUsageModel.refresh (cognitive 20) Sources/CodexBar/Providers/OpenAI/OpenAILiveUsageModel.swift
  • Cognitive Complexity · ClaudeDesktopProjectsLocator.roots (cognitive 20) Sources/CodexBarCore/Providers/Claude/ClaudeDesktopProjectsLocator.swift
  • Cognitive Complexity · Model.applyingUsageItemVisibility (cognitive 19) Sources/CodexBar/ProviderUsageItemVisibility.swift
  • Cognitive Complexity · OpenAIAPIProviderImplementation.throughputPresentation (cognitive 19) Sources/CodexBar/Providers/OpenAI/OpenAIAPIProviderImplementation.swift
  • Cognitive Complexity · ProviderPluginIconSVG.hasBoundedCanvas (cognitive 19) Sources/CodexBarCore/Plugins/ProviderPluginIconSVG.swift
  • Cognitive Complexity · CodexRequestLedger.merge (cognitive 18) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift
  • Cognitive Complexity · HTTPServerController.restart (cognitive 17) Sources/CodexBar/HTTPServerController.swift
  • Cognitive Complexity · ProviderPluginApprovalBinding.init (cognitive 17) Sources/CodexBarCore/Plugins/UserProviderPlugins.swift
  • Cognitive Complexity · Model.make (cognitive 16) Sources/CodexBar/MenuCardView.swift
  • Cognitive Complexity · Model.usageItemDescriptors (cognitive 16) Sources/CodexBar/ProviderUsageItemVisibility.swift
  • Cognitive Complexity · MenuBarLayoutPersistence.preferredLayout (cognitive 16) Sources/CodexBar/MenuBarLayout.swift
  • Cognitive Complexity · MenuBarPercentWindowPreference.applied (cognitive 16) Sources/CodexBar/MenuBarPercentWindowPreference.swift
  • Cognitive Complexity · UsageMenuCardHeaderView.body (cognitive 16) Sources/CodexBar/MenuCardView.swift
  • Cognitive Complexity · OpenAILiveUsageModel.refreshLimits (cognitive 16) Sources/CodexBar/Providers/OpenAI/OpenAILiveUsageModel.swift
  • Cognitive Complexity · UsageFormatter.countdownDescription (cognitive 16) Sources/CodexBarCore/UsageFormatter.swift
  • Cognitive Complexity · ClaudeConfigPaths.costProjectsRoots (cognitive 16) Sources/CodexBarCore/Providers/Claude/ClaudeConfigPaths.swift
  • Cognitive Complexity · ClaudeProviderDescriptor.resolveStrategies (cognitive 16) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift
  • Cognitive Complexity · OpenAIOrgRateLimitsFetcher.fetch (cognitive 16) Sources/CodexBarCore/Providers/OpenAI/OpenAIOrgRateLimitsFetcher.swift
  • God Classes · MethodTooLong: CodexBarCLI.runStandardCost Sources/CodexBarCLI/CLICostCommand.swift
  • God Classes · MethodTooLong: UsageStore.menuBarLayoutRenderData Sources/CodexBar/StatusItemController+MenuBarLayout.swift
  • God Classes · MethodTooLong: SpendDashboardModel.buildCurrencyGroup Sources/CodexBar/SpendDashboardModel.swift
  • God Classes · MethodTooLong: ClaudeProviderImplementation.settingsToggles Sources/CodexBar/Providers/Claude/ClaudeProviderImplementation.swift
  • God Classes · ClassTooLong: MenuBarLayoutEditor Sources/CodexBar/MenuBarLayoutEditor.swift
  • God Classes · MethodTooLong: CostUsageFetcher.loadLocalTokenScanResult Sources/CodexBarCore/CostUsageFetcher.swift
  • God Classes · MethodTooLong: CodexRequestLedger.load Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift
  • God Classes · ClassTooLong: ClaudeUsageFetcher Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift
  • God Classes · MethodTooLong: ProviderDetailView.body Sources/CodexBar/PreferencesProviderDetailView.swift
  • God Classes · MethodTooLong: UsageStore.handleSessionQuotaTransition Sources/CodexBar/UsageStore+SessionQuotaTransition.swift
  • Code Duplication · Near-duplicate member family (3 members, 12 shared lines) Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift
  • Code Duplication · Edited copy of a member (25 corresponding lines) Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift
  • Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) Sources/CodexBarCore/PathEnvironment.swift
  • Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/CodexBar/UsageStore+OpenAIWeb.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/CodexBarCore/CostUsageFetcher.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/CodexBarCore/Providers/Claude/ClaudeScopedWeeklyLimitMapper.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift
  • Code Duplication · Duplicated block (20 lines × 2) Sources/CodexBarCore/CostUsageFetcher.swift
  • Code Duplication · Duplicated block (15 lines × 2) Sources/CodexBarCore/CostUsageFetcher.swift
  • Code Duplication · Duplicated block (14 lines × 2) Sources/CodexBar/CostHistoryChartMenuView.swift
  • Code Duplication · Duplicated block (14 lines × 2) Sources/CodexBarCore/WidgetSnapshot.swift
  • Code Duplication · Duplicated block (13 lines × 2) Sources/CodexBar/SpendDashboardModel.swift
  • Code Duplication · Duplicated block (13 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift
  • Code Duplication · Duplicated block (12 lines × 20) Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift
  • Code Duplication · Duplicated block (12 lines × 4) Sources/CodexBar/MenuCardView.swift
  • Code Duplication · Duplicated block (10–12 lines × 3) Sources/CodexBar/UsageStore+OpenAIWeb.swift
  • Code Duplication · Duplicated block (12 lines × 3) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift
  • Code Duplication · Duplicated block (12 lines × 2) Sources/CodexBarCLI/CLICardsRenderer.swift
  • Code Duplication · Duplicated block (11 lines × 2) Sources/CodexBarCore/Providers/CommandCode/CommandCodeUsageFetcher.swift
  • Code Duplication · Duplicated block (10 lines × 2) Sources/CodexBarCore/Config/CodexBarConfig.swift
  • Code Duplication · Duplicated block (7–9 lines × 3) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift
  • Code Duplication · Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift

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

Fixed since the last survey: 856 findings

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

  • Cyclomatic Complexity · CodexBarCLI.claudeTopModelsLines (cyclomatic 36) Sources/CodexBarCLI/CLICostCommand.swift
  • Cyclomatic Complexity · StatusItemController.applyIcon (cyclomatic 35) Sources/CodexBar/StatusItemController+Animation.swift
  • Cyclomatic Complexity · CodexBarCLI.runCost (cyclomatic 26) Sources/CodexBarCLI/CLICostCommand.swift
  • Cyclomatic Complexity · MiniMaxUsageParser.normalizeCodingPlanPayload (cyclomatic 20) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift
  • Cyclomatic Complexity · MiniMaxUsageParser.parseMultiService (cyclomatic 17) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift
  • Cyclomatic Complexity · CodexBarCLI.claudeDailyLines (cyclomatic 16) Sources/CodexBarCLI/CLICostCommand.swift
  • Cyclomatic Complexity · MiniMaxCodingPlanFetchStrategy.fetch (cyclomatic 16) Sources/CodexBarCore/Providers/MiniMax/MiniMaxProviderDescriptor.swift
  • Cognitive Complexity · CodexBarCLI.claudeTopModelsLines (cognitive 62) Sources/CodexBarCLI/CLICostCommand.swift
  • Cognitive Complexity · StatusItemController.applyIcon (cognitive 55) Sources/CodexBar/StatusItemController+Animation.swift
  • Cognitive Complexity · CodexBarCLI.runCost (cognitive 34) Sources/CodexBarCLI/CLICostCommand.swift
  • Cognitive Complexity · MistralCookieImporter.importSessions (cognitive 25) Sources/CodexBarCore/Providers/Mistral/MistralCookieImporter.swift
  • Cognitive Complexity · CodexBarCLI.claudeDailyLines (cognitive 24) Sources/CodexBarCLI/CLICostCommand.swift
  • Cognitive Complexity · MiniMaxUsageParser.normalizeCodingPlanPayload (cognitive 19) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift
  • Cognitive Complexity · StatusItemController.defaultProviderForUnifiedIcon (cognitive 18) Sources/CodexBar/StatusItemController+Animation.swift
  • Cognitive Complexity · UsageFormatter.resetLine (cognitive 17) Sources/CodexBarCore/UsageFormatter.swift
  • Cognitive Complexity · KimiUsageSnapshot.toUsageSnapshot (cognitive 17) Sources/CodexBarCore/Providers/Kimi/KimiUsageSnapshot.swift
  • Cognitive Complexity · MiMoCookieImporter.importSessions (cognitive 17) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift
  • Cognitive Complexity · CodexThreadMetadataReader.metadata (cognitive 16) Sources/CodexBarCore/CodexThreadMetadataReader.swift
  • God Classes · MethodTooLong: StatusItemController.applyIcon Sources/CodexBar/StatusItemController+Animation.swift
  • God Classes · MethodTooLong: CodexBarCLI.runCost Sources/CodexBarCLI/CLICostCommand.swift
  • God Classes · TooManyMethods: MiniMaxUsageFetcher Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift
  • God Classes · FileTooLong: Antigravity/AntigravityLocalSQLite.swift Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift
  • Code Duplication · Near-duplicate member pair (85 shared lines) Sources/CodexBar/StatusItemController+Animation.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift
  • Code Duplication · Members sharing a duplicated core (62 members, 50+ identical tokens) Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift
  • Code Duplication · Members sharing a duplicated core (11 members, 50+ identical tokens) Sources/CodexBarCore/PathEnvironment.swift
  • Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift
  • Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/CodexBar/CostHistoryChartMenuView.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/CodexBarCore/CostUsageFetcher.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/CodexBarCore/Providers/Claude/ClaudeScopedWeeklyLimitMapper.swift
  • Code Duplication · Duplicated block (20 lines × 2) Sources/CodexBarCore/CostUsageFetcher.swift
  • Code Duplication · Duplicated block (18–19 lines × 2) Sources/CodexBar/StatusItemController+Animation.swift
  • Code Duplication · Duplicated block (19 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift
  • Code Duplication · Duplicated block (18 lines × 2) Sources/CodexBar/StatusItemController+Animation.swift
  • Code Duplication · Duplicated block (17 lines × 2) Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift
  • Code Duplication · Duplicated block (16–17 lines × 2) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift
  • Code Duplication · Duplicated block (16 lines × 2) Sources/CodexBar/Config/CodexBarConfigMigrator.swift
  • Code Duplication · Duplicated block (14 lines × 2) Sources/CodexBar/SettingsStore+TokenAccounts.swift
  • Code Duplication · Duplicated block (14 lines × 2) Sources/CodexBar/StatusItemController+Animation.swift
  • Code Duplication · Duplicated block (13 lines × 3) Sources/CodexBar/MenuBarLayoutRenderer.swift
  • Code Duplication · Duplicated block (13 lines × 2) Sources/CodexBarCore/BrowserCookieAccessGate.swift
  • Code Duplication · Duplicated block (13 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift
  • Code Duplication · Duplicated block (13 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeUsageSnapshot+WebExtras.swift
  • Code Duplication · Duplicated block (13 lines × 2) Sources/CodexBarCore/WidgetSnapshot.swift
  • Code Duplication · Duplicated block (12 lines × 20) Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift
  • Code Duplication · Duplicated block (12 lines × 4) Sources/CodexBar/MenuBarLayoutRenderer.swift
  • Code Duplication · Duplicated block (12 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeDesktopProjectsLocator.swift
  • Code Duplication · Duplicated block (12 lines × 2) Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift
  • Code Duplication · Duplicated block (11 lines × 3) Sources/CodexBarCore/DarwinProcessEnumerator.swift
  • Code Duplication · Duplicated block (10–11 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift
  • Code Duplication · Duplicated block (10 lines × 2) Sources/CodexBar/UsagePaceText.swift
  • Code Duplication · Duplicated block (9 lines × 2) Sources/CodexBar/StatusItemController+Animation.swift
  • Code Duplication · Duplicated block (8 lines × 2) Sources/CodexBar/MenuCardView+Costs.swift
  • Code Duplication · Duplicated block (8 lines × 2) Sources/CodexBar/StatusItemController+Animation.swift
  • Code Duplication · Duplicated block (8 lines × 2) Sources/CodexBar/StatusItemController+Animation.swift
  • Code Duplication · Duplicated block (8 lines × 2) Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift
  • Code Duplication · Duplicated block (7 lines × 2) Sources/CodexBar/MenuCardView+Costs.swift
  • Code Duplication · Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift
  • Code Duplication · Duplicated block (6 lines × 3) Sources/CodexBar/StatusItemController+Animation.swift
  • Code Duplication · Duplicated block (3–6 lines × 3) Sources/CodexBar/StatusItemController+Animation.swift
  • Code Duplication · Duplicated block (6 lines × 2) Sources/CodexBar/UsageStore+Hooks.swift
  • Code Duplication · Duplicated block (6 lines × 2) Sources/CodexBarCore/Providers/Amp/AmpCLIProbe.swift
  • Code Duplication · Duplicated block (5 lines × 3) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift
  • Code Duplication · Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift
  • Code Duplication · Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift
  • Code Duplication · Duplicated block (12 lines × 2) Sources/CodexBarCore/Providers/Replicate/ReplicateWebFetchStrategy.swift
  • Code Duplication · Duplicated block (7 lines × 2) Sources/CodexBar/Providers/OpenCode/OpenCodeSettingsStore.swift
  • Code Duplication · Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift
  • Code Duplication · Duplicated block (10 lines × 2) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift
  • Code Duplication · Duplicated block (9 lines × 2) Sources/CodexBar/StatusItemController+Animation.swift
  • Test Quality · Skipped test: Tests/CodexBarTests/BrowserDetectionTests.swift
  • Test Quality · No assertions: Tests/CodexBarTests/ClaudeMenuCardCostTests.swift
  • Test Quality · No assertions: Tests/CodexBarTests/CopilotDeviceFlowTests.swift
  • Test Quality · No assertions: Tests/CodexBarTests/MuseKeychainAccessTests.swift
  • Test Quality · No assertions: Tests/CodexBarTests/OpenAIDashboardWebViewCacheTests.swift
  • Test Quality · No assertions: Tests/CodexBarTests/SettingsStoreKeychainPreferenceTests.swift
  • Test Quality · No assertions: Tests/CodexBarTests/TypeSafePluginTests.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/CodexBar/SessionEquivalentForecast.swift Sources/CodexBar/SessionEquivalentForecast.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/CodexBar/CursorLoginRunner.swift Sources/CodexBar/CursorLoginRunner.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/CodexBarCore/RemoteSessionFetcher.swift Sources/CodexBarCore/RemoteSessionFetcher.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/CodexBarCore/Providers/DeepSeek/DeepSeekPlatformTokenImporter.swift Sources/CodexBarCore/Providers/DeepSeek/DeepSeekPlatformTokenImporter.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/CodexBarCLI/CLILocalHTTPServer.swift Sources/CodexBarCLI/CLILocalHTTPServer.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/CodexBarCore/Hooks/HookRule.swift Sources/CodexBarCore/Hooks/HookRule.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBarCore/Providers/Grok/GrokStatusProbe.swift Sources/CodexBarCore/Providers/Grok/GrokStatusProbe.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBarCore/BrowserCookieAccessGate.swift Sources/CodexBarCore/BrowserCookieAccessGate.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBar/StatusItemController+MenuPresentation.swift Sources/CodexBar/StatusItemController+MenuPresentation.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBar/MenuBarPercentWindowPreference.swift Sources/CodexBar/MenuBarPercentWindowPreference.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBar/PlanUtilizationHistoryStore.swift Sources/CodexBar/PlanUtilizationHistoryStore.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBar/ShareStatsCardView.swift Sources/CodexBar/ShareStatsCardView.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBar/UsageStore+Hooks.swift Sources/CodexBar/UsageStore+Hooks.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoLocalUsageReader.swift Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoLocalUsageReader.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBar/ShareStatsRenderer.swift Sources/CodexBar/ShareStatsRenderer.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBarCore/KeychainAccessGate.swift Sources/CodexBarCore/KeychainAccessGate.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBar/StatusItemController+CodexStackedMenu.swift Sources/CodexBar/StatusItemController+CodexStackedMenu.swift
  • Churn × Complexity Hotspots · Repeated repair: Sources/CodexBarCLI/CLIGuardCommand.swift Sources/CodexBarCLI/CLIGuardCommand.swift
  • Change Coupling · Change coupling: MenuBarLayoutEditor.swift ↔ StatusItemController+IconObservation.swift Sources/CodexBar/MenuBarLayoutEditor.swift
Rebuild cost: about €690,000 · Estimate
Cost to rebuild€230,000 to €1,100,000, for 3,807 to 12,077 hours of work, about 4.7 person-years for 2 to 9 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 46. 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: 286,819 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Resolve the 24 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED, REDACTED.
Raises the score by about 10 points · Medium effort · REDACTED Scanning
2
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
Raises the score by about 4 points · Medium effort · Cyclomatic Complexity
3
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.
Raises the score by about 4 points · Medium effort · Dead Code

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 €690,000 to build again, about 4.7 person-years of work. Its weakest lens is Code Health, at 33 (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.
One cause behind 43 Domain Modelling findings · Common cause
43 findings in the Domain Modelling lens come from the same cause. The code models the business as objects, such as an order or a customer, and each object should guard its own rules: an order, for example, should refuse to be shipped before it has been paid. Here the objects don't do that. Some objects only hold data, while the rules that should keep that data valid sit elsewhere in the code. Identifiers, such as order numbers and customer numbers, are passed around as plain numbers or text, so nothing stops the code from using one kind where another belongs. Because all of these findings have the same cause, fixing it once, in the business objects themselves, deals with them together.
Based on: Rich vs anemic domain model (3 findings) · Strongly-typed ids (40 findings)
What to do: Give each business object the methods that enforce its rules, such as a method for shipping an order that first checks it has been paid, and let only those methods change its data. Give each kind of identifier a type of its own, so an order number can't be used where a customer number belongs.
If you do one thing first · First action
Resolve the 24 Leaked secret finding(s) in REDACTED Scanning. Of all the actions in this report, it raises the score most for the work it takes: about 10 points for medium effort, because it clears the 24 REDACTED 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 7.0 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 3% to 6% on every change. The history of the code shows how much it changes: about 772,538 lines over the last 90 days, which is about 3,133,071 lines a year. At that pace, the extra work comes to an estimated 201.6 to 1209.6 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — module dependency graph

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

arch AdaptiveRefreshCore AdaptiveRefreshCore AdaptiveReplayCLI AdaptiveReplayCLI AdaptiveReplayKit AdaptiveReplayKit AdaptiveReplayCLI->AdaptiveReplayKit AdaptiveReplayKit->AdaptiveRefreshCore CQuickJS CQuickJS CodexBar CodexBar CodexBar->AdaptiveRefreshCore CodexBarCore CodexBarCore CodexBar->CodexBarCore CodexBarCLI CodexBarCLI CodexBarCLI->CodexBarCore CodexBarClaudeWatchdog CodexBarClaudeWatchdog CodexBarClaudeWebProbe CodexBarClaudeWebProbe CodexBarClaudeWebProbe->CodexBarCore CodexBarCore->CQuickJS CodexBarCostStoreCrashProbe CodexBarCostStoreCrashProbe CodexBarCostStoreCrashProbe->CodexBarCore CodexBarWidget CodexBarWidget CodexBarWidget->CodexBarCore

Architecture: which parts of the code depend on which

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

20 modules, with 23 dependencies between them. One loop runs through 5 of the modules, marked above the diagonal.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 .github.scripts2 CodexBarClaudeWatchdog3 CodexBarCostStoreCrashProbe4 Integrations.Linux5 Integrations.Linux.Shared6 Integrations.Omarchy7 Scripts.ci_swift_test_by_suite8 Scripts.direct_swift_test_groups9 Sources.CodexBarCore.Resources.Plugins10 docs11 Scripts12 repository13 CodexBarCore14 CodexBarCLI15 CodexBar16 AdaptiveRefreshCore17 AdaptiveReplayKit18 CodexBarClaudeWebProbe19 CodexBarWidget20 AdaptiveReplayCLI
1 .github.scripts
2 CodexBarClaudeWatchdog
3 CodexBarCostStoreCrashProbe
4 Integrations.Linux
5 Integrations.Linux.Shared
6 Integrations.Omarchy
7 Scripts.ci_swift_test_by_suite
8 Scripts.direct_swift_test_groups
9 Sources.CodexBarCore.Resources.Plugins
10 docs
11 Scripts2
12 repository1012
13 CodexBarCore1621521111
14 CodexBarCLI4222152
15 CodexBar131212439
16 AdaptiveRefreshCore2
17 AdaptiveReplayKit1821
18 CodexBarClaudeWebProbe11
19 CodexBarWidget101128
20 AdaptiveReplayCLI34
Uses a module listed above itPart of a loopThe module itself
1 .github.scripts2 CodexBarClaudeWatchdog3 CodexBarCostStoreCrashProbe4 Integrations.Linux5 Integrations.Linux.Shared6 Integrations.Omarchy7 Scripts.ci_swift_test_by_suite8 Scripts.direct_swift_test_groups9 Sources.CodexBarCore.Resources.Plugins10 docs11 Scripts12 repository13 CodexBarCore14 CodexBarCLI15 CodexBar16 AdaptiveRefreshCore17 AdaptiveReplayKit18 CodexBarClaudeWebProbe19 CodexBarWidget20 AdaptiveReplayCLI.github.scripts1CodexBarClaudeWatchdog2CodexBarCostStoreCrashProbe3Integrations.Linux4Integrations.Linux.Shared5Integrations.Omarchy6Scripts.ci_swift_test_by_suite7Scripts.direct_swift_test_groups8Sources.CodexBarCore.Resources.Plugins9docs10Scripts11repository12CodexBarCore13CodexBarCLI14CodexBar15AdaptiveRefreshCore16AdaptiveReplayKit17CodexBarClaudeWebProbe18CodexBarWidget19AdaptiveReplayCLI202101216215211114222152131212439218211110112834

At a glance — Code Health · 33% · Weak · gated by D2, R1, R2, R7 ·

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

At a glance — Maturity · 86% · Exemplary ·

At a glance — Readiness · 36% · Weak · gated by D13, R4, P3 ·

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

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

At a glance — Performance · 72% · Strong ·

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
A07:2025 — Authentication Failures29High / Critical
A05:2025 — Injection12High / Critical
A03:2025 — Software Supply Chain Failures5Medium

Roadmap

First, resolve the 24 leaked secrets in key configuration and source files to eliminate immediate security risks. Next, reduce cyclomatic complexity in branch-heavy functions to improve maintainability and delete the significant amount of dead code to lower maintenance costs. Then, integrate automated security scanning into the CI pipeline to prevent future regressions. Finally, increase test coverage by adding tests for currently unreached production modules.

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

Do thisHelpsEffortDimension
Resolve the 24 Leaked secret finding(s) in REDACTED Scanning — start with REDACTED, REDACTED, REDACTED.+9.8 ptsMediumREDACTED Scanning
Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.+3.8 ptsMediumCyclomatic Complexity
Delete the dead files and unused exports — every line is maintenance cost and rebuild-estimate inflation with zero runtime value.+3.8 ptsMediumDead Code
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.+3.7 ptsMediumSecurity & performance tooling
Add tests that import the unreached modules (directly or through their public entry).+3.4 ptsMediumTest Coverage
Bring the 2 bodies over 120 down to 120 or less in Cognitive Complexity — start with fetchUsage (cognitive 222), TTYCommandRunner.run (cognitive 141).+1.1 ptsMediumCognitive Complexity
Migrate the remaining .js/.jsx files to TypeScript.+2.2 ptsMediumType Safety
Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED, REDACTED.+0.7 ptsLowStatic Analysis (SAST)

File quality

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

FileScoreBandWorst signal
REDACTED2.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED4.4MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED4.4MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED4.6MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED4.6MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): Medium: REDACTED
Sources/CodexBar/UsageStore.swift4.8MixedCyclomatic Complexity: UsageStore.refreshTokenUsage (cyclomatic 27)
REDACTED5.0MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED5.0MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED5.0MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED5.0MixedREDACTED Scanning: Leaked secret: REDACTED
REDACTED5.3MixedStatic Analysis (SAST): Medium: REDACTED
Sources/CodexBarCore/CostUsageFetcher.swift5.5MixedCyclomatic Complexity: CostUsageFetcher.loadTokenResult (cyclomatic 56)
Sources/CodexBar/StatusItemController+Menu.swift5.5MixedCyclomatic Complexity: StatusItemController.populateMenu (cyclomatic 45)
Sources/CodexBar/MenuCardView.swift5.5MixedCyclomatic Complexity: Model.secondaryMetric (cyclomatic 30)
Sources/CodexBar/StatusItemController+Animation.swift5.5MixedCyclomatic Complexity: StatusItemController.applyIcon (cyclomatic 48)
Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift5.5MixedCyclomatic Complexity: AntigravityCLISession.ensureStartedLocked (cyclomatic 22)
Sources/CodexBar/StatusItemController+SwitcherViews.swift5.5MixedCyclomatic Complexity: ProviderSwitcherView.init (cyclomatic 16)

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

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

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

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

Could not be resolved — 20

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

Methodology & how to trust this report

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

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

What we checked — 71 dimensions across the health lenses
D1D2D3D4D5D6D7D9D10D12D13D14D15D16D17D20D26D28D29D30D34D35D36D43AX10AX3AX4AX8AX9DM2DM4DM5M1M2M3M4P1P2P3P4P6PF2PF3R1R10R2R3R4R7R9X1X12X13X14X15X16X17X18X19X21X22X23X24X25X26X27X28X29X3X30X5

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a1777a-92eb-75d5-8052-d8aedb8284b3.

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

Run transparency — what happened this run

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

  • D8 Code Coverage — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the Swift half could not be measured — the Swift suite in . produced no coverage export. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo. In the meantime, commit (or publish into the working tree) the lcov/Cobertura report your CI produces and the real number is read on the next scan. You can widen what we reach: optional: commit the lcov/Cobertura report your CI produces, and the real number is read on the next scan.
  • D10 Test Quality — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 1,983 test(s) behind this row are the ones the code-model census could read, and this repository also carries at least 23 test source file(s) (.py, .mjs) that it cannot: it reads the test types the .swift frontend declared, so a suite in any other language is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.swift, .py, .mjs) and this repository declares a SwiftPM test suite (CodexBar), but it was not re-run: the analyzer environment could not run it. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is a COLLECTOR gap, not an environment fault: no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
  • D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `Package.swift`, `Scripts/cost_jsonl_shape_survey.swift`, `Sources/AdaptiveRefreshCore/AdaptiveRefreshPolicyCore.swift`, `Sources/CodexBar/AgentSessionsStore.swift`, `Sources/CodexBar/ChartBarHoverSelection.swift`, … (+361 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • D44 Platform End-of-Life — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
  • AX1 Captive dependencies — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in Sources/CodexBar/CodexAppServerDaemon.swift, whose lifetimes are not modelled 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.
  • AXB1 Runtime evidence locked — no reproducible boot — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Subject: a native UI project (WidgetExtension/CodexBarWidgetExtension.xcodeproj/project.pbxproj). The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. Watchdog then boots it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
  • C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'SQLite3' is imported (Sources/CodexBarCore/CodexThreadCatalogReader.swift:3), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
  • C5 Data-Subject Rights — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'SQLite3' is imported (Sources/CodexBarCore/CodexThreadCatalogReader.swift:3), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
  • DM2 Strongly-typed ids — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 465 further occurrence(s) are not listed individually; the score already reflects all 505.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and this repository's Python, Swift, c, cpp is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and this repository's Python, Swift, c, cpp is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • M4 Documentation accuracy — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9). Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
  • R10 Code Duplication — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 106 further occurrence(s) are not listed individually; the score already reflects all 146.
  • R4 Test Coverage — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 88 further occurrence(s) are not listed individually; the score already reflects all 128.
  • R7 Dead Code — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 81 further occurrence(s) are not listed individually; the score already reflects all 121.
  • S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Go, PHP, Dart, Kotlin, Ruby, Scala, Java, Python and Rust source only, and no C# was loaded, and no named async function in this repository's JavaScript/TypeScript, nor any Go, PHP or Dart function or Kotlin suspend function, makes a request that can be cancelled (fetch, axios, ky, ofetch; net/http, net.Dial; amphp; Dio; Ktor, OkHttp), so there is nothing to judge, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X3 Exception handling — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 56 further occurrence(s) are not listed individually; the score already reflects all 96.
  • X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP make no call through a named logger, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D7 Architectural Integrity: Layering is checked against detected/declared rules — an architecture whose boundaries live in convention or in code review, not in a rule a scanner can read, is not enforced here.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • DM4 Rich vs anemic domain model: Behaviour is detected as state mutation inside a method body — a method that enforces an invariant by validating-and-throwing without mutating reads as a query, and mutation delegated through an interface the scan can't resolve isn't credited; entities with zero public properties still drop out of the population. It detects that state changes, not whether the rule is correct.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity5.7 / 10Adequate✓ 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 5.7 / 10 · rule-coverage 100% · ceiling Prevented

387 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was fetchUsage at 135. A further 13 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 MenuBarLayoutToken.defaultEditorLabel at 35 — they are counted neither in the figure above nor in this dimension's score. 10 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: Sources/CodexBar/MenuBarLayoutEditor.swift (MenuBarLayoutToken.defaultEditorLabel at 35), Sources/CodexBar/PreferencesGeneralPane.swift (AppLanguage.labelKey at 25), Sources/CodexBar/MenuBarLayoutConditionalEditor.swift (MenuBarConditionalMetric.editorLabel at 23), Sources/CodexBar/StatusItemController+MenuActionMapping.swift (StatusItemController.selector at 21), Sources/CodexBar/StatusItemController+MenuWidthCache.swift (StatusItemController.measuredStandardMenuWidthCacheToken at 21), and 5 more not listed here. 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.

fetchUsage::parseQuota (cyclomatic 26) · ×7REDACTED:241
fetchUsage (cyclomatic 34) · ×3REDACTED:15
fetchUsage (cyclomatic 16) · ×3REDACTED:8
fetchUsage (cyclomatic 35) · ×2Sources/CodexBarCore/Resources/Plugins/flora.js:11
fetchUsage (cyclomatic 26) · ×2Sources/CodexBarCore/Resources/Plugins/fal.js:8

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

What to do

  1. Bring the 1 body over 120 down to 120 or less in Cyclomatic Complexity — start with fetchUsage (cyclomatic 135). — Refactoring it lifts Cyclomatic Complexity from 5.7 to about 5.8/10.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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

598 method(s) exceeded the cognitive complexity threshold of 15; the worst was fetchUsage at 222.

fetchUsage::accounts (cognitive 36) · ×10REDACTED:38
fetchUsage (cognitive 36) · ×3Sources/CodexBarCore/Resources/Plugins/flora.js:11
fetchUsage (cognitive 62) · ×2Sources/CodexBarCore/Resources/Plugins/t3chat.js:12
fetchUsage (cognitive 37) · ×2Sources/CodexBarCore/Resources/Plugins/sakana.js:12
fetchUsage (cognitive 34) · ×2Sources/CodexBarCore/Resources/Plugins/manus.js:8

+ 574 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 Cognitive Complexity — start with fetchUsage (cognitive 222), TTYCommandRunner.run (cognitive 141). — 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 Cognitive Complexity from 3.6 to about 4.6/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes7.7 / 10Strong✓ Tool-verified

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

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

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

263 god class(es) detected.

FileTooLong: ClaudeOAuth/ClaudeOAuthCredentials.swift · ×98Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift
MethodTooLong: IconRenderer.makeIcon · ×73Sources/CodexBar/IconRenderer.swift:142
ClassTooLong: ClaudeOAuthCredentialsStore · ×56Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:14
TooManyMethods: UsageStore · ×36Sources/CodexBar/UsageStore.swift:121

What to do

  1. Resolve the 98 FileTooLong finding(s) in God Classes — start with ClaudeOAuthCredentials.swift, CostUsageFetcher.swift, SpendDashboardController.swift. — One of this dimension's main actionable groups (98 warning-level).
  2. Resolve the 73 MethodTooLong finding(s) in God Classes — start with UsageStore+Refresh.swift (4), CostUsageFetcher.swift (3), KiroStatusProbe.swift (3). — One of this dimension's main actionable groups (73 warning-level).
  3. Resolve the 56 ClassTooLong finding(s) in God Classes — start with SpendDashboardController.swift (2), AntigravityStatusProbe.swift (2), MiniMaxUsageFetcher.swift (2). — One of this dimension's main actionable groups (56 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.1 / 10Stronggated by 527 serious findings✓ Tool-verified

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

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

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

506 duplicated block group(s) detected. A further 21 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 1 of the 527 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (5 lines × 2) · ×53Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:165
Duplicated block (9 lines × 2) · ×42Scripts/StoreStress/main.swift:324
Duplicated block (6 lines × 2) · ×38Sources/CodexBar/CodexAccountSwitcherView.swift:51
Duplicated block (7 lines × 2) · ×35Sources/CodexBar/CostHistoryChartMenuView.swift:571
Duplicated block (8 lines × 2) · ×31Sources/CodexBar/MenuBarLayout.swift:1223

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

What to do

  1. Resolve the 53 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with CostHistoryChartMenuView.swift (3), SpendDashboardModel.swift (2), ProviderPluginSnapshotMapper.swift (2). — One of this dimension's main actionable groups (53 warning-level).
  2. Resolve the 42 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with AmpUsageFetcher.swift (3), ClaudeAdminAPIUsageSnapshot.swift (2), ClaudeCredentialRouting.swift (2). — One of this dimension's main actionable groups (42 warning-level).
  3. Resolve the 38 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with CreditsHistoryChartMenuView.swift (4), MiMoCookieImporter.swift (3), CodexManagedAccounts.swift (2). — One of this dimension's main actionable groups (38 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

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

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

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

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

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

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

Off the main sequence: AdaptiveRefreshCore · ×2

What to do

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

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

D6 · Cohesion (LCOM4)9.6 / 10Stronggated by 7 serious findings✓ 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 9.6 / 10 · rule-coverage 100% · ceiling Verified

7 of 190 classes have LCOM4 above 3.

Low cohesion: SettingsStore (LCOM4 16) · ×7Sources/CodexBar/SettingsStore.swift:244

What to do

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

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

D7 · Architectural Integrity6.0 / 10Adequate✓ Tool-verified

What it measures: Whether the code respects its intended layering / architecture rules.

Method: Enforcement rung (Prevented/Verified/Documented) per checkable ADR via Roslyn, plus dependency cycles via the engine shared with D5/AX3. Deterministic, exact.

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

No mechanizable ADR was identified, so enforcement is not measured. Dependency cycles not checked (no project-reference graph; where this repository's language has an import-cycle lens, cycles are reported there).

What to do

  1. Enforce Architectural Integrity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

Detailed fixes: d7_recommendation.md.

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

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

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

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

2235 test methods: 2235 unit, 0 integration, 0 BDD, 0 e2e. The JavaScript/TypeScript suite contributes 10 `it`/`test` case(s) across 1 test file(s) declaring at least one beside 1983 .NET test method(s); its tier split is read from package names and paths only. The Python suite contributes 242 test function(s) across 15 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality7.3 / 10Strong✓ 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 7.3 / 10 · rule-coverage 100% · ceiling Prevented

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

No assertions: · ×194TestsLinux/AntigravityJSONLNumberTests.swift:6
Skipped test: test_renderSyntheticBalances · ×120Tests/CodexBarTests/APIBalanceScreenshotRenderTests.swift:9
Skipped (documented): · ×7Tests/CodexBarTests/CodexDayAttributionTests.swift:6

What to do

  1. Resolve the 194 No assertions finding(s) in Test Quality — start with CLIEntryTests.swift (5), CodexWorkspacesConfigurationTests.swift (3), ProviderPluginDetailsParityTests.swift (2). — One of this dimension's main actionable groups (194 warning-level).
  2. Resolve the 120 Skipped test finding(s) in Test Quality — start with MenuLayoutScreenshotRenderTests.swift (15), SpendDashboardScreenshotRenderTests.swift (8), OpenRouterNativeProofTests.swift (4). — One of this dimension's main actionable groups (120 warning-level).
  3. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D12 · Dependency Hygiene9.8 8.4 / 10Strong✓ Tool-verified

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

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

Maturity: Documented → Verified → Prevented · effective 8.4 / 10 · rule-coverage 86% · ceiling Verified

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

Outdated: commander · ×4

What to do

  1. Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D13 · REDACTED Scanning0.0 / 10Critical✓ 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 0.0 / 10 · rule-coverage 100% · ceiling Prevented

24 secret(s) detected.

REDACTED

What to do

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

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

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

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

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

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

0 of 8 SwiftPM package(s) use a banned license. SwiftPM has no package registry, so each package's licence is the one its repository declares: 7 of them read from the licence file the repository carries at the revision Package.resolved pins, and 1 — unpinned, or whose licence file could not be read or named — from api.deps.dev, which reports the licence the repository declares today. Graded: every package a committed Package.resolved pins, direct and transitive, and every declared dependency none pins. 1 of them declare no licence that matches a known SPDX licence; that is missing data, not a violation, and none of them is charged.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

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

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

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

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

Top hotspots: Sources/CodexBarCore/CostUsageFetcher.swift (55×56=3080); Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift (19×129=2451); Sources/CodexBar/UsageStore+Refresh.swift (49×46=2254) Repeated repair below the complexity floor: Sources/CodexBar/CodexbarApp.swift (20 of 34 changes were fixes); Sources/CodexBar/StatusItemController.swift (17 of 32 changes were fixes); Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift (15 of 26 changes were fixes)

Hotspot: Sources/CodexBarCore/CostUsageFetcher.swift · ×155Sources/CodexBarCore/CostUsageFetcher.swift:466
Repeated repair: Sources/CodexBar/CodexbarApp.swift · ×62Sources/CodexBar/CodexbarApp.swift:668

What to do

  1. Resolve the 155 Hotspot finding(s) in Churn × Complexity Hotspots — start with CostUsageFetcher.swift, TTYCommandRunner.swift, UsageStore+Refresh.swift. — One of this dimension's main actionable groups (155 warning-level).
  2. Resolve the 62 Repeated repair finding(s) in Churn × Complexity Hotspots — start with CodexbarApp.swift, StatusItemController.swift, ProviderUsagePresentation.swift. — One of this dimension's main actionable groups (62 warning-level).

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

D16 · Bus Factor9.1 / 10Exemplary✓ Tool-verified

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

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

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

86 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is Sources/CodexBarCore/Plugins/QuickJSProviderPluginEngine.swift. Counted over 975 of the 1436 production source files in this repository: 460 are under the ~2,400-byte size floor this dimension measures over, and the remaining 1 have no attributable history left to measure.

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

✓ On the Gold path — maintain.

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

TodoCommentSources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:567

What to do

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

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

D20 · ADR Quality6.0 / 10Adequate✓ Tool-verified

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

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

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

1 of 1 evaluated ADRs have a defect readable from the log itself (a missing or empty section, no title, a single option, consequences with no cost, no status, a missing enforcement field, a status the log contradicts, a dangling link, an unlinked second decision on one question). How well each record argues its case is not measured.

ADR has no Context sectiondocs/predictive-refresh-policy.md:9detected by adr-integrity

What to do

  1. Resolve the 1 ADR has no Context section finding(s) in ADR Quality — start with predictive-refresh-policy.md. — One of this dimension's main actionable groups (1 recommendation-level).

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

D26 · Project Cohesion0.0 / 10Critical✓ Tool-verified

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

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

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

1 of 2 build units (SwiftPM) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

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

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

D28 · Secrets (history)6.0 / 10Adequate✓ Tool-verified

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

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

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

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

REDACTED
REDACTED
REDACTED

What to do

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

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

D29 · Static Analysis (SAST)3.3 / 10Weak✓ Tool-verified

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

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

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

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

12 finding(s): 0 critical, 4 high, 8 medium, 0 low. semgrep hit a parse error in 46 file(s) — `.agents/skills/qa-test/scripts/live_provider_matrix.sh` (lines 56–66), `Scripts/analyze_quotio.sh` (lines 97–109), `Scripts/check-linux-cli-codex-cost-smoke.sh` (line 5), `Scripts/check-linux-cli-linkage.sh` (line 5), `Scripts/ci_linux_musl_build_gate.sh`, … (+41 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. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (6 warning-level).
  2. Resolve the 3 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2), REDACTED. — One of this dimension's main actionable groups (3 issue-level).
  3. Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).

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

D30 · Dependency Vulnerabilities10.0 / 10Exemplary○ Nothing flagged

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

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

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

No known-vulnerable dependencies in any ecosystem this repository declares.

✓ On the Gold path — maintain.

Detailed fixes: d30_recommendation.md.

D34 · Knowledge Freshness9.9 / 10Adequategated by 1 critical finding✓ 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 9.9 / 10 · rule-coverage 100% · ceiling Documented

12 of 976 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is Sources/CodexBar/StatusItemController+MenuViewportRestore.swift. Counted over 976 of the 1436 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledgeSources/CodexBar/StatusItemController+MenuViewportRestore.swift:1
Orphaned file · ×11Sources/CodexBarCore/Providers/Shared/CurlCaptureParser.swift:1
Further orphaned files (smaller)

What to do

  1. Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with StatusItemController+MenuViewportRestore.swift. — One of this dimension's main actionable groups (1 issue-level).
  2. Resolve the 11 Orphaned file finding(s) in Knowledge Freshness — start with CurlCaptureParser.swift, AbacusCookieImporter.swift, PerplexityCookieHeader.swift. — One of this dimension's main actionable groups (11 recommendation-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling9.3 / 10Stronggated by 27 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.3 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: ClaudeProviderImplementation.swift↔CursorProviderImplementation.swift 100%; CursorProviderImplementation.swift↔MiniMaxProviderImplementation.swift 90%; CursorProviderImplementation.swift↔FactoryProviderImplementation.swift 90%

Change coupling: StatusItemController+Actions.swift ↔ StatusItemController+PersistentMenuActions.swift · ×20Sources/CodexBar/StatusItemController+Actions.swift:1
Change-coupling hub: CursorProviderImplementation.swift → ProviderRegistry.swift, ClaudeProviderImplementation.swift, CodexProviderImplementation.swift, FactoryProviderImplementation.swift, MiniMaxProviderImplementation.swift, OpenCodeProviderImplementation.swift · ×7Sources/CodexBar/Providers/Cursor/CursorProviderImplementation.swift

What to do

  1. Resolve the 20 Change coupling finding(s) in Change Coupling — start with KeychainPromptCoordinator.swift (2), ProviderTokenResolver.swift (2), ProviderRegistry.swift (2). — One of this dimension's main actionable groups (20 warning-level).
  2. Resolve the 7 Change-coupling hub finding(s) in Change Coupling — start with CursorProviderImplementation.swift, LogCategories.swift, StatusItemController+Menu.swift. — One of this dimension's main actionable groups (7 warning-level).

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

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

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

Frontend & cross-cutting dimensions

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

AX10 · Code composition9.9 / 10Exemplary✓ Tool-verified

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

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

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

What to do

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

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

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

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

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

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

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

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

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

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

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

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

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

DM2 · Strongly-typed ids8.5 / 10Exemplary✓ Tool-verified

Other · Domain Modelling — Whether domain identifiers are strongly typed (a typed-id struct) rather than raw primitives — consistency once an idiom exists.

Method: Roslyn (DDD-gated): strongly-typed id adoption on domain entities/events; raw Guid/int/string ids counted versus wrapped types. An id wrapper is recognised by VALUE SEMANTICS, not by being a struct — a record struct, a record class (`record ApartmentId(Guid Value)`) or a class declared by a typed-id base (`class MemberId : TypedIdValueBase`) all count, while a plain mutable class (reference equality) and a verb-phrase query record (`GetCustomerById`) do not. Deterministic, adoption percentage.

Coverage: Population: id-like members by *Id/*Key NAME suffix; strongly-typed-ID shape then checked semantically — non-suffixed identifiers are not seen.

  • `CodexAccountSwitcherView.selectedAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CodexAccountSwitcherView.swift:10
  • `CodexAccountSwitcherView.pressedAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CodexAccountSwitcherView.swift:11
  • `CodexAccountUsageSnapshot.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:5
  • `Record.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:116
  • `AccountIdentity.workspaceAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:127
  • `AccountIdentity.storedAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:129
  • `CodexWorkspacesProjectRow.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CodexWorkspacesInspectorPresentation.swift:57
  • `CodexWorkspacesSessionRow.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CodexWorkspacesInspectorPresentation.swift:88
  • `CodexWorkspacesInspectorPresentation.selectedProjectID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CodexWorkspacesInspectorPresentation.swift:115
  • `Point.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. (×3) — Sources/CodexBar/CostHistoryChartMenuView.swift:24, Sources/CodexBar/CreditsHistoryChartMenuView.swift:8, Sources/CodexBar/InlineUsageDashboardContent.swift:32
  • `DetailRow.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CostHistoryChartMenuView.swift:51
  • `Candidate.selectionID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CursorLoginAccountSelector.swift:7
  • `Choice.selectionID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CursorLoginAccountSelector.swift:14
  • `AccountIdentity.accountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/CursorLoginRunner.swift:27
  • `DockIconPresentationAttemptTracker.nextRawID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/DockIconController.swift:109
  • `Attempt.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/HomebrewUpdateNotifier.swift:16
  • `QuotaWindow.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/InlineUsageDashboardContent.swift:47
  • `MenuBarLayoutConditional.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/MenuBarLayout.swift:287
  • `MenuBarLayoutConditionalDraft.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/MenuBarLayoutConditionalEditor.swift:11
  • `MenuBarLayoutPaletteGroup.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/MenuBarLayoutEditor.swift:255
  • `MenuBarLayoutRenderExtra.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/MenuBarLayoutRenderer.swift:117
  • `Metric.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/MenuCardView.swift:34
  • `MenuUsageBarPoint.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/MenuUsageBarStrip.swift:10
  • `SeriesSelection.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:20
  • `VisibleSeries.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:30
  • `Acknowledgement.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesAcknowledgements.swift:25
  • `CodexAccountsSectionState.activeVisibleAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesCodexAccountsSection.swift:26
  • `CodexAccountsSectionState.liveVisibleAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesCodexAccountsSection.swift:27
  • `CodexAccountsSectionState.authenticatingManagedAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesCodexAccountsSection.swift:30
  • `ArgumentRow.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesHooksPane.swift:198
  • `PendingPluginApproval.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesPluginsPane.swift:323
  • `ModelLimitsIdentity.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesProviderDetailView.swift:12
  • `ProviderModelLimitDraft.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesProviderModelLimits.swift:5
  • `TeamAccountDraft.organizationID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesProviderSettingsRows.swift:222
  • `TeamAccountDraft.projectID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesProviderSettingsRows.swift:223
  • `ProviderSettingsConfirmationState.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesProvidersPane.swift:660
  • `Provider.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/PreferencesSpendDashboardPane.swift:1242
  • `Row.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value. — Sources/CodexBar/ProviderAccountUsageOverview.swift:6

What to do

  • Adopt the repo's typed-id idiom consistently — wrap every entity identity in its own typed id.
DM4 · Rich vs anemic domain model7.6 / 10Strong✓ Tool-verified

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

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

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

  • `Entry` is a data-only reference entity whose behaviour is DELEGATED to a foreign utility (static methods that take it as their first parameter and hold its logic) — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants rather than being driven from outside. — Sources/CodexBar/Providers/Codex/CodexSettingsStore.swift:475
  • `String` is a data-only reference entity whose behaviour is DELEGATED to a foreign utility (static methods that take it as their first parameter and hold its logic) — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants rather than being driven from outside. — Sources/CodexBar/PreferencesPluginsPane.swift:411
  • `MetadataReadRecorder` is a data-only reference entity whose behaviour is DELEGATED to a foreign utility (static methods that take it as their first parameter and hold its logic) — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants rather than being driven from outside. — Sources/CodexBarCore/Vendored/CostUsage/ModelsDevPricing.swift:505

What to do

  • Move delegated behaviour onto the domain entity (or make it a value object); keep invariants inside the type.
DM5 · Encapsulated state10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

What to do

  • Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
M2 · Architecture documentation7.0 / 10Strong✓ 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.

  • 1 ADR-shaped document(s) detected by content — `docs/predictive-refresh-policy.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.

What to do

  • Move ADRs under docs/adr/ (or docs/adrs/) and name them NNNN-title.md so they're easy to find.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

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

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

P2 · Observability6.5 / 10Strong✓ Tool-verified

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

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

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

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
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 65256 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.

What to do

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

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

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

What to do

  • Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
P6 · Release Hygiene10.0 / 10Exemplary✓ Tool-verified

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

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

PF2 · Allocation hygiene6.2 / 10Adequate✓ Tool-verified

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

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

What to do

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

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

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

  • `sleep` is async and calls sleep — 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. — Sources/CodexBarCore/Providers/ProviderFetchPlan.swift:511

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.
R1 · Type Safety3.1 / 10Weak✓ 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.

  • 43 typed · 95 plain JS — the untyped files are Integrations/Linux/Shared/Notifications.js, Integrations/Linux/Shared/Usage.js, Integrations/Omarchy/notifications.test.mjs, Integrations/Omarchy/test.mjs, REDACTED, REDACTED (+89 more).

What to do

  • Migrate the remaining .js/.jsx files to TypeScript.
R10 · Code Duplication6.7 / 10Strong✓ Tool-verified

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

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

  • Sources/CodexBarCore/Resources/Plugins/chutes.js:90 · Sources/CodexBarCore/Resources/Plugins/chutes.ts:63 — the two spans are one implementation copied and then locally edited — 2370 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. — Sources/CodexBarCore/Resources/Plugins/chutes.js:90
  • Sources/CodexBarCore/Resources/Plugins/muse.js:39 · Sources/CodexBarCore/Resources/Plugins/muse.ts:11 — the two spans are one implementation copied and then locally edited — 2198 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. — Sources/CodexBarCore/Resources/Plugins/muse.js:39
  • Sources/CodexBarCore/Resources/Plugins/huggingface.js:37 · Sources/CodexBarCore/Resources/Plugins/huggingface.ts:16 — the two spans are one implementation copied and then locally edited — 1862 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. — Sources/CodexBarCore/Resources/Plugins/huggingface.js:37
  • Sources/CodexBarCore/Resources/Plugins/litellm.js:40 · Sources/CodexBarCore/Resources/Plugins/litellm.ts:12 — the two spans are one implementation copied and then locally edited — 1932 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. — Sources/CodexBarCore/Resources/Plugins/litellm.js:40
  • Sources/CodexBarCore/Resources/Plugins/aixy.js:22 · Sources/CodexBarCore/Resources/Plugins/aixy.ts:1 — these 2 files are line-for-line copies of one another — 166 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — Sources/CodexBarCore/Resources/Plugins/aixy.js:22
  • Sources/CodexBarCore/Resources/Plugins/workbuddy.js:24 · Sources/CodexBarCore/Resources/Plugins/workbuddy.ts:17 — the two spans are one implementation copied and then locally edited — 1313 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. — Sources/CodexBarCore/Resources/Plugins/workbuddy.js:24
  • REDACTED:40 · REDACTED:12 — the two spans are one implementation copied and then locally edited — 1301 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:40
  • Sources/CodexBarCore/Resources/Plugins/bifrost.js:39 · Sources/CodexBarCore/Resources/Plugins/bifrost.ts:11 — the two spans are one implementation copied and then locally edited — 1403 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. — Sources/CodexBarCore/Resources/Plugins/bifrost.js:39
  • Sources/CodexBarCore/Resources/Plugins/typesafe.js:23 · Sources/CodexBarCore/Resources/Plugins/typesafe.ts:3 — the two spans are one implementation copied and then locally edited — 1311 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. — Sources/CodexBarCore/Resources/Plugins/typesafe.js:23
  • Sources/CodexBarCore/Resources/Plugins/munito.js:15 · Sources/CodexBarCore/Resources/Plugins/munito.ts:8 — the two spans are one implementation copied and then locally edited — 1200 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. — Sources/CodexBarCore/Resources/Plugins/munito.js:15
  • Sources/CodexBarCore/Resources/Plugins/claudeplatform.js:8 · Sources/CodexBarCore/Resources/Plugins/claudeplatform.ts:1 — these 2 files are line-for-line copies of one another — 138 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — Sources/CodexBarCore/Resources/Plugins/claudeplatform.js:8
  • Sources/CodexBarCore/Resources/Plugins/qwencloud-team.js:37 · Sources/CodexBarCore/Resources/Plugins/qwencloud-team.ts:9 — the two spans are one implementation copied and then locally edited — 1160 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. — Sources/CodexBarCore/Resources/Plugins/qwencloud-team.js:37
  • Sources/CodexBarCore/Resources/Plugins/v0.js:52 · Sources/CodexBarCore/Resources/Plugins/v0.ts:24 — the two spans are one implementation copied and then locally edited — 1111 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. — Sources/CodexBarCore/Resources/Plugins/v0.js:52
  • Sources/CodexBarCore/Resources/Plugins/helmcode.js:58 · Sources/CodexBarCore/Resources/Plugins/helmcode.ts:32 — the two spans are one implementation copied and then locally edited — 1176 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. — Sources/CodexBarCore/Resources/Plugins/helmcode.js:58
  • Sources/CodexBarCore/Resources/Plugins/raycast.js:8 · Sources/CodexBarCore/Resources/Plugins/raycast.ts:1 — these 2 files are line-for-line copies of one another — 104 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — Sources/CodexBarCore/Resources/Plugins/raycast.js:8
  • Sources/CodexBarCore/Resources/Plugins/clinepass.js:33 · Sources/CodexBarCore/Resources/Plugins/clinepass.ts:22 — the two spans are one implementation copied and then locally edited — 624 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. — Sources/CodexBarCore/Resources/Plugins/clinepass.js:33
  • Sources/CodexBarCore/Resources/Plugins/llmproxy.js:8 · Sources/CodexBarCore/Resources/Plugins/llmproxy.ts:1 — these 2 files are line-for-line copies of one another — 93 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — Sources/CodexBarCore/Resources/Plugins/llmproxy.js:8
  • REDACTED:18 · REDACTED:11 — the two spans are one implementation copied and then locally edited — 945 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:18
  • Sources/CodexBarCore/Resources/Plugins/gitkraken.js:41 · Sources/CodexBarCore/Resources/Plugins/gitkraken.ts:14 — the two spans are one implementation copied and then locally edited — 809 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. — Sources/CodexBarCore/Resources/Plugins/gitkraken.js:41
  • Sources/CodexBarCore/Resources/Plugins/abacus.js:8 · Sources/CodexBarCore/Resources/Plugins/abacus.ts:1 — these 2 files are line-for-line copies of one another — 89 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — Sources/CodexBarCore/Resources/Plugins/abacus.js:8
  • Sources/CodexBarCore/Resources/Plugins/futureagi.js:39 · Sources/CodexBarCore/Resources/Plugins/futureagi.ts:11 — the two spans are one implementation copied and then locally edited — 675 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. — Sources/CodexBarCore/Resources/Plugins/futureagi.js:39
  • Sources/CodexBarCore/Resources/Plugins/lithosai.js:8 · Sources/CodexBarCore/Resources/Plugins/lithosai.ts:1 — these 2 files are line-for-line copies of one another — 85 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — Sources/CodexBarCore/Resources/Plugins/lithosai.js:8
  • Sources/CodexBarCore/Resources/Plugins/llmman.js:31 · Sources/CodexBarCore/Resources/Plugins/llmman.ts:10 — the two spans are one implementation copied and then locally edited — 863 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. — Sources/CodexBarCore/Resources/Plugins/llmman.js:31
  • Sources/CodexBarCore/Resources/Plugins/bifrost.js:276 · Sources/CodexBarCore/Resources/Plugins/bifrost.ts:237 — 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. — Sources/CodexBarCore/Resources/Plugins/bifrost.js:276
  • Sources/CodexBarCore/Resources/Plugins/devpass.js:36 · Sources/CodexBarCore/Resources/Plugins/devpass.ts:8 — 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. — Sources/CodexBarCore/Resources/Plugins/devpass.js:36
  • Sources/CodexBarCore/Resources/Plugins/gemini-web.js:47 · Sources/CodexBarCore/Resources/Plugins/gemini-web.ts:28 — the two spans are one implementation copied and then locally edited — 643 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. — Sources/CodexBarCore/Resources/Plugins/gemini-web.js:47
  • REDACTED:1 · REDACTED:1 — these 2 files are line-for-line copies of one another — 73 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — REDACTED:1
  • Sources/CodexBarCore/Resources/Plugins/langdock.js:1 · Sources/CodexBarCore/Resources/Plugins/langdock.ts:1 — these 2 files are line-for-line copies of one another — 69 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — Sources/CodexBarCore/Resources/Plugins/langdock.js:1
  • Sources/CodexBarCore/Resources/Plugins/parallel.js:15 · Sources/CodexBarCore/Resources/Plugins/parallel.ts:8 — the two spans are one implementation copied and then locally edited — 522 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. — Sources/CodexBarCore/Resources/Plugins/parallel.js:15
  • Sources/CodexBarCore/Resources/Plugins/sofya.js:8 · Sources/CodexBarCore/Resources/Plugins/sofya.ts:1 — these 2 files are line-for-line copies of one another — 58 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — Sources/CodexBarCore/Resources/Plugins/sofya.js:8
  • REDACTED:1 · REDACTED:1 — these 2 files are line-for-line copies of one another — 57 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done. — REDACTED:1
  • Sources/CodexBarCore/Resources/Plugins/xkiro.js:36 · Sources/CodexBarCore/Resources/Plugins/xkiro.ts:8 — the two spans are one implementation copied and then locally edited — 549 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — Sources/CodexBarCore/Resources/Plugins/xkiro.js:36
  • REDACTED:11 · REDACTED:11 — the two spans are one implementation copied and then locally edited — 438 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:11
  • Sources/CodexBarCore/Resources/Plugins/ollama-api.js:37 · Sources/CodexBarCore/Resources/Plugins/ollama-api.ts:16 — the two spans are one implementation copied and then locally edited — 464 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. — Sources/CodexBarCore/Resources/Plugins/ollama-api.js:37
  • Sources/CodexBarCore/Resources/Plugins/hyper.js:46 · Sources/CodexBarCore/Resources/Plugins/hyper.ts:25 — 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. — Sources/CodexBarCore/Resources/Plugins/hyper.js:46
  • Sources/CodexBarCore/Resources/Plugins/zoommate.js:261 · Sources/CodexBarCore/Resources/Plugins/zoommate.ts:204 — 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. — Sources/CodexBarCore/Resources/Plugins/zoommate.js:261
  • Sources/CodexBarCore/Resources/Plugins/aiand.js:67 · Sources/CodexBarCore/Resources/Plugins/aiand.ts:27 — 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. — Sources/CodexBarCore/Resources/Plugins/aiand.js:67
  • REDACTED:24 · Sources/CodexBarCore/Resources/Plugins/raycast.ts:74 — the two spans are one implementation copied and then locally edited — 340 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:24
  • Sources/CodexBarCore/Resources/Plugins/sailresearch.js:65 · Sources/CodexBarCore/Resources/Plugins/sailresearch.ts:33 — 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. — Sources/CodexBarCore/Resources/Plugins/sailresearch.js:65
  • Sources/CodexBarCore/Resources/Plugins/bifrost.js:234 · Sources/CodexBarCore/Resources/Plugins/bifrost.ts:195 — 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. — Sources/CodexBarCore/Resources/Plugins/bifrost.js:234

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 Complexity0.0 / 10Critical✓ 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.

  • fetchUsage has cyclomatic complexity 116 and cognitive complexity 202; 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. — Sources/CodexBarCore/Resources/Plugins/openrouter.js:24
  • fetchUsage has cyclomatic complexity 66 and cognitive complexity 89; 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. — Sources/CodexBarCore/Resources/Plugins/zai.js:24
  • fetchUsage has cyclomatic complexity 62 and cognitive complexity 87; 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. — Sources/CodexBarCore/Resources/Plugins/openai.js:14
  • fetchUsage has cyclomatic complexity 60 and cognitive complexity 114; 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. — Sources/CodexBarCore/Resources/Plugins/zoommate.ts:18
  • fetchUsage has cyclomatic complexity 59 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. — REDACTED:11
  • fetchUsage has cyclomatic complexity 58 and cognitive complexity 87; 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. — Sources/CodexBarCore/Resources/Plugins/huggingface.ts:16
  • fetchUsage has cyclomatic complexity 57 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — Sources/CodexBarCore/Resources/Plugins/poe.js:15
  • fetchUsage has cyclomatic complexity 55 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:39
  • fetchUsage has cyclomatic complexity 54 and cognitive complexity 108; 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. — Sources/CodexBarCore/Resources/Plugins/zoommate.js:53
  • fetchUsage has cyclomatic complexity 54 and cognitive complexity 84; 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. — Sources/CodexBarCore/Resources/Plugins/huggingface.js:37
  • fetchUsage has cyclomatic complexity 52 and cognitive complexity 55; 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. — Sources/CodexBarCore/Resources/Plugins/sub2api.js:10
  • fetchUsage has cyclomatic complexity 50 and cognitive complexity 58; 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. — Sources/CodexBarCore/Resources/Plugins/munito.ts:8
  • fetchUsage has cyclomatic complexity 45 and cognitive complexity 54; 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. — Sources/CodexBarCore/Resources/Plugins/munito.js:15
  • fetchUsage has cyclomatic complexity 44 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. (×2) — REDACTED:11, REDACTED:11
  • fetchUsage has cyclomatic complexity 44 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:10
  • fetchUsage has cyclomatic complexity 43 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — REDACTED:11
  • fetchUsage has cyclomatic complexity 41 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — Sources/CodexBarCore/Resources/Plugins/t3chat.js:12
  • fetchUsage has cyclomatic complexity 39 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. (×2) — Sources/CodexBarCore/Resources/Plugins/qwencloud-team.ts:9, Sources/CodexBarCore/Resources/Plugins/zed.js:12

What to do

  • Break down the listed branch-heavy functions; aim P95 cyclomatic ≤ 5.
R3 · Large Files9.1 / 10Exemplary✓ Tool-verified

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

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

  • Integrations/Omarchy/test.mjs has 771 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — Integrations/Omarchy/test.mjs:1
  • Sources/CodexBarCore/Resources/Plugins/openrouter.js has 431 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — Sources/CodexBarCore/Resources/Plugins/openrouter.js:1
  • Sources/CodexBarCore/Resources/Plugins/openai.js has 409 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — Sources/CodexBarCore/Resources/Plugins/openai.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 Coverage0.4 / 10Critical✓ 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. (×40) — Sources/CodexBarCore/Resources/Plugins/chutes.js:1, Sources/CodexBarCore/Resources/Plugins/openrouter.js:1, Sources/CodexBarCore/Resources/Plugins/openai.js:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R7 · Dead Code0.0 / 10Critical✓ 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 11 application, 14 tooling and 6 test entry point(s) detected in this repo. This repository declares no build, type-check or test script, so nothing here would fail on a wrong deletion — confirm by hand that nothing loads each file (including by a path built at runtime) before removing it. An undetected custom entry would make these reachable.
  • no import path from any entry point (11 application, 14 tooling, 6 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 (×39) — Sources/CodexBarCore/Resources/Plugins/chutes.js, Sources/CodexBarCore/Resources/Plugins/openrouter.js, Sources/CodexBarCore/Resources/Plugins/openai.js, …

What to do

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

X3 · Exception handling5.9 / 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.

  • `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×35) — Sources/CodexBarCore/AppGroupSupport.swift:173, Sources/CodexBarCore/CodexLaunchPreflight+SignatureIdentity.swift:20, Sources/CodexBarCore/CopilotUsageModels.swift:258, …
  • 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. (×5) — REDACTED:119, Sources/CodexBarCore/Resources/Plugins/poe.js:106, Sources/CodexBarCore/Resources/Plugins/t3chat.js:70, …

What to do

  • Swallowed exception (caught, then discarded)
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

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

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

X5 · Nullable reference types9.1 / 10Exemplary✓ Tool-verified

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

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

  • ~2.4 `!` null assertions per 1k TypeScript source lines — 15 assertion(s) across the 6315 source line(s) of the 43 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: Sources/CodexBarCore/Resources/Plugins/aixy.ts (7), Sources/CodexBarCore/Resources/Plugins/litellm.ts (3), Sources/CodexBarCore/Resources/Plugins/bifrost.ts (2). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.

What to do

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

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 Health33%Weak — gated by D2, R1, R2, R7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture90%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity86%ExemplaryStrongest area.
Readiness36%Weak — gated by D13, R4, P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security69%Adequate — gated by D29Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Domain Modelling85%ExemplarySolid.
Performance72%StrongSolid.
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.

  • X10 Duplicated predicate — 25 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X6 Hand-rolled structured-format parsing — 1 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 22 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.
  • C4 Data Retention — Not assessed: this repository stores data through 'SQLite3' (Sources/CodexBarCore/CodexThreadCatalogReader.swift:3) but declares no persisted model this check reads (SwiftData @Model, Core Data, Realm, GRDB and Fluent types, GRDB and SQLite.swift columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL migrations). Personal data may be written through raw SQL or a hosted backend, so whether a retention limit applies here could not be established, and its absence is not scored.
  • C5 Data-Subject Rights — Not assessed: this repository stores data through 'SQLite3' (Sources/CodexBarCore/CodexThreadCatalogReader.swift:3) but declares no persisted model this check reads (SwiftData @Model, Core Data NSManagedObject, Realm Object, GRDB record and Fluent Model properties, GRDB and SQLite.swift columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether data-subject rights apply here could not be established, and their absence is not scored.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 57 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 — Frontend below the scale floor (3 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC2 Forms & labels — Frontend below the scale floor (3 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC3 Page structure — Frontend below the scale floor (3 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC4 Keyboard semantics — Frontend below the scale floor (3 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC5 ARIA correctness — Frontend below the scale floor (3 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC6 Visual & motion safety — Frontend below the scale floor (3 DOM element(s) < 25) — too little surface to assess accessibility.
  • AC7 A11y enforcement — Frontend below the scale floor (3 DOM element(s) < 25) — too little surface to assess accessibility.
  • AX1 Captive dependencies — 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
  • AX2 Stateful singletons — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. 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 — no exported interface declares behaviour
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • 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.
  • D11 Test Reliability — Test reliability not included — the .swift suite was found but not re-run
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D19 Documentation Quality — No runnable or published unit to look for an example in, and no multi-project root README to look for a map in; the other documentation kinds are withheld (see the gaps), so documentation quality is not applicable here.
  • D21 Naming Consistency — Naming consistency is measured on C# only; JavaScript, Python, Swift, TypeScript not measured.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ projects each declaring an entity of their own. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C# and Visual Basic comments only — this repository's production source is .py, .swift, .ts, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D25 ADR Conformance — None of 0 binding record(s) states a rule in checkable form (a backticked element with a prohibition, or an `adr-rules` block), so conformance cannot be read from the code. Write the rule as an `adr-rules` block (`forbid:` a symbol, a package or a dependency) to make it checkable.
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.swift), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 366 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
  • D8 Code Coverage — Coverage not measured — Swift suite
  • DM1 Aggregate boundaries — not scored for Swift: the sidecar flattens array/collection types (a child COLLECTION = legitimate membership vs a single embedded aggregate is indistinguishable), and aggregate-vs-value-object classification cannot be told apart in source (every struct-holding-struct reads alike) — reported as guidance rather than measured
  • DM3 Integration-event coupling — not scored for Swift: a cross-SwiftPM-target domain leak cannot be told apart in source from a legitimate shared-kernel/contracts module, and most repositories ship a single module — reported as guidance rather than measured
  • DM6 Domain ↔ infrastructure boundary — this Swift package maps no type to a persistence framework and declares no domain-model type carrying a method of its own, so DM6's domain↔infrastructure boundary read has no population to be taken over
  • DM7 Repository granularity — not scored for Swift: 'a repository per CHILD entity' needs the aggregate-root structure, which is not source-resolvable — reported as guidance rather than measured
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • 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 — not applicable — no HTTP server, API framework or worker entry point was found in the JavaScript/TypeScript, Python, Swift source, so there is no service whose uptime a failing dependency could take down
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `swift test --enable-code-coverage` (SwiftPM) or `xcodebuild test -scheme <YourScheme> -enableCodeCoverage YES` (an .xcodeproj/.xcworkspace suite), then `xcrun llvm-cov export -format=lcov`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `Benchmark("…")` in a file importing package-benchmark, or package-benchmark in Package.swift, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
  • R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
  • R6 Tooling — no package.json in the repository — test/lint/typecheck wiring is read from package.json scripts (corroborated against CI), so this project's own toolchain isn't measured here
  • R8 Dependency Hygiene — Not measured — no package.json declares any dependency, so there is nothing to check imports against (imports may resolve through a host runtime rather than node).
  • 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.
  • X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • 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 — 76 finding(s)
DM2 · Strongly-typed ids · Raw-primitive id despite a typed-id idiom · ×40
  • Raw-primitive id despite a typed-id idiom: CodexAccountSwitcherView.selectedAccountID Sources/CodexBar/CodexAccountSwitcherView.swift:10 — `CodexAccountSwitcherView.selectedAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: CodexAccountSwitcherView.pressedAccountID Sources/CodexBar/CodexAccountSwitcherView.swift:11 — `CodexAccountSwitcherView.pressedAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: CodexAccountUsageSnapshot.id Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:5 — `CodexAccountUsageSnapshot.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: Record.id Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:116 — `Record.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: AccountIdentity.workspaceAccountID Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:127 — `AccountIdentity.workspaceAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: AccountIdentity.storedAccountID Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:129 — `AccountIdentity.storedAccountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: CodexWorkspacesProjectRow.id Sources/CodexBar/CodexWorkspacesInspectorPresentation.swift:57 — `CodexWorkspacesProjectRow.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: CodexWorkspacesSessionRow.id Sources/CodexBar/CodexWorkspacesInspectorPresentation.swift:88 — `CodexWorkspacesSessionRow.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: CodexWorkspacesInspectorPresentation.selectedProjectID Sources/CodexBar/CodexWorkspacesInspectorPresentation.swift:115 — `CodexWorkspacesInspectorPresentation.selectedProjectID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: Point.id Sources/CodexBar/CostHistoryChartMenuView.swift:24 — `Point.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: DetailRow.id Sources/CodexBar/CostHistoryChartMenuView.swift:51 — `DetailRow.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: Point.id Sources/CodexBar/CreditsHistoryChartMenuView.swift:8 — `Point.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: Candidate.selectionID Sources/CodexBar/CursorLoginAccountSelector.swift:7 — `Candidate.selectionID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: Choice.selectionID Sources/CodexBar/CursorLoginAccountSelector.swift:14 — `Choice.selectionID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: AccountIdentity.accountID Sources/CodexBar/CursorLoginRunner.swift:27 — `AccountIdentity.accountID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: DockIconPresentationAttemptTracker.nextRawID Sources/CodexBar/DockIconController.swift:109 — `DockIconPresentationAttemptTracker.nextRawID` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: Attempt.id Sources/CodexBar/HomebrewUpdateNotifier.swift:16 — `Attempt.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: Point.id Sources/CodexBar/InlineUsageDashboardContent.swift:32 — `Point.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: QuotaWindow.id Sources/CodexBar/InlineUsageDashboardContent.swift:47 — `QuotaWindow.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: MenuBarLayoutConditional.id Sources/CodexBar/MenuBarLayout.swift:287 — `MenuBarLayoutConditional.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: MenuBarLayoutConditionalDraft.id Sources/CodexBar/MenuBarLayoutConditionalEditor.swift:11 — `MenuBarLayoutConditionalDraft.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: MenuBarLayoutPaletteGroup.id Sources/CodexBar/MenuBarLayoutEditor.swift:255 — `MenuBarLayoutPaletteGroup.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: MenuBarLayoutRenderExtra.id Sources/CodexBar/MenuBarLayoutRenderer.swift:117 — `MenuBarLayoutRenderExtra.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: Metric.id Sources/CodexBar/MenuCardView.swift:34 — `Metric.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • Raw-primitive id despite a typed-id idiom: MenuUsageBarPoint.id Sources/CodexBar/MenuUsageBarStrip.swift:10 — `MenuUsageBarPoint.id` is a raw primitive id while the repo already defines typed-id wrappers — an inconsistently-adopted typed-id idiom. Give this identity its own typed id so it can't be confused with another entity's id or a plain value.
  • + 15 more in this group — see findings.md.
D13 · REDACTED Scanning · Leaked secret · ×24
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D28 · Secrets (history) · High secret · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
DM4 · Rich vs anemic domain model · Anemic domain model · ×3
  • Anemic domain model: Entry Sources/CodexBar/Providers/Codex/CodexSettingsStore.swift:475 — `Entry` is a data-only reference entity whose behaviour is DELEGATED to a foreign utility (static methods that take it as their first parameter and hold its logic) — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants rather than being driven from outside.
  • Anemic domain model: String Sources/CodexBar/PreferencesPluginsPane.swift:411 — `String` is a data-only reference entity whose behaviour is DELEGATED to a foreign utility (static methods that take it as their first parameter and hold its logic) — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants rather than being driven from outside.
  • Anemic domain model: MetadataReadRecorder Sources/CodexBarCore/Vendored/CostUsage/ModelsDevPricing.swift:505 — `MetadataReadRecorder` is a data-only reference entity whose behaviour is DELEGATED to a foreign utility (static methods that take it as their first parameter and hold its logic) — the anemic domain model. Move the behaviour onto the entity so it enforces its own invariants rather than being driven from outside.
D28 · Secrets (history) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×1
  • Orphaned knowledge Sources/CodexBar/StatusItemController+MenuViewportRestore.swift:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
Serious — 2531 finding(s)
D10 · Test Quality · No assertions · ×194
  • No assertions: TestsLinux/AntigravityJSONLNumberTests.swift:6 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsLinux/CLIHooksWatchSleepLinuxTests.swift:7 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsLinux/CostUsageJsonlDifferentialTests.swift:58 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsLinux/DashboardAccountInventoryTests.swift:7 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsLinux/DashboardClaudeSwapCollectionTests.swift:7 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsLinux/KimiDesktopDispatchTests.swift:23 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsLinux/OpenAIDashboardImportModelsTests.swift:7 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsLinux/PerplexityCreditFormattingTests.swift:9 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsLinux/ProviderNumericBoundaryTests.swift:6 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/AbliterationPluginTests.swift:9 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/AixyPluginTests.swift:165 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/GeminiWebPluginTests.swift:19 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/GitKrakenPluginTests.swift:19 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/HostResultProviderTests.swift:14 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/HyperPluginTests.swift:49 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/LithosAIPluginTests.swift:11 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/NotionPluginTests.swift:24 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/ProviderPluginCookieHeaderEchoTests.swift:9 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/ProviderPluginCookieJarTests.swift:12 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/ProviderPluginCurrencyTests.swift:6 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/ProviderPluginDetailsParityTests.swift:15 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/ProviderPluginEngineBenchmarkTests.swift:16 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/ProviderPluginOptionalAdmissionTests.swift:9 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/ProviderPluginOptionalPOSTTests.swift:9 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: TestsPlugin/ProviderPluginPersistentCookieSecurityTests.swift:6 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • + 169 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×155
  • Hotspot: Sources/CodexBarCore/CostUsageFetcher.swift Sources/CodexBarCore/CostUsageFetcher.swift:466 — Sources/CodexBarCore/CostUsageFetcher.swift changed 55 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 56 in CostUsageFetcher.loadTokenResult at line 466. 26 of those changes were fix/bug commits, and the other 29 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/CostUsageFetcher.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:455 — Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 129 in TTYCommandRunner.run at line 455. 12 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-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/UsageStore+Refresh.swift Sources/CodexBar/UsageStore+Refresh.swift:1304 — Sources/CodexBar/UsageStore+Refresh.swift changed 49 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in UsageStore.handleProviderFetchFailure at line 1304. 20 of those changes were fix/bug commits, and the other 29 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/UsageStore+Refresh.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/StatusItemController+Menu.swift Sources/CodexBar/StatusItemController+Menu.swift:221 — Sources/CodexBar/StatusItemController+Menu.swift changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in StatusItemController.populateMenu at line 221. 17 of those changes were fix/bug commits, and the other 28 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/StatusItemController+Menu.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBarCore/Resources/Plugins/openrouter.js Sources/CodexBarCore/Resources/Plugins/openrouter.js:24 — Sources/CodexBarCore/Resources/Plugins/openrouter.js changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 116 in fetchUsage at line 24. 10 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Resources/Plugins/openrouter.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: Sources/CodexBar/MenuCardView.swift Sources/CodexBar/MenuCardView.swift:1382 — Sources/CodexBar/MenuCardView.swift changed 64 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in Model.secondaryMetric at line 1382. 32 of those changes were fix/bug commits, and the other 32 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/MenuCardView.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/MenuCardView+ModelHelpers.swift Sources/CodexBar/MenuCardView+ModelHelpers.swift:945 — Sources/CodexBar/MenuCardView+ModelHelpers.swift changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in Model.extraRateWindowMetrics at line 945. 26 of those changes were fix/bug commits, and the other 31 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/MenuCardView+ModelHelpers.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/MenuBarLayoutRenderer.swift Sources/CodexBar/MenuBarLayoutRenderer.swift:422 — Sources/CodexBar/MenuBarLayoutRenderer.swift changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in MenuBarLayoutRenderer.renderUncached at line 422. 16 of those changes were fix/bug commits, and the other 25 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/MenuBarLayoutRenderer.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/UsageStore.swift Sources/CodexBar/UsageStore.swift:1447 — Sources/CodexBar/UsageStore.swift changed 64 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in UsageStore.refreshTokenUsage at line 1447. 25 of those changes were fix/bug commits, and the other 39 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/UsageStore.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/StatusItemController+Animation.swift Sources/CodexBar/StatusItemController+Animation.swift:340 — Sources/CodexBar/StatusItemController+Animation.swift changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in StatusItemController.applyIcon at line 340. 16 of those changes were fix/bug commits, and the other 19 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/StatusItemController+Animation.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/MenuBarLayoutEditor.swift Sources/CodexBar/MenuBarLayoutEditor.swift:1187 — Sources/CodexBar/MenuBarLayoutEditor.swift changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in MenuBarLayoutToken.defaultEditorLabel at line 1187. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/MenuBarLayoutEditor.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: REDACTED REDACTED:127 — REDACTED changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 80 in ProviderPluginManifest.init at line 127. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/SpendDashboardModel.swift Sources/CodexBar/SpendDashboardModel.swift:588 — Sources/CodexBar/SpendDashboardModel.swift changed 46 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in SpendDashboardModel.buildCurrencyGroup at line 588. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/SpendDashboardModel.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/UsageStore+WidgetSnapshot.swift Sources/CodexBar/UsageStore+WidgetSnapshot.swift:235 — Sources/CodexBar/UsageStore+WidgetSnapshot.swift changed 53 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in UsageStore.makeWidgetEntry at line 235. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/UsageStore+WidgetSnapshot.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:88 — Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift changed 57 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in ClaudeProviderDescriptor.makeDescriptor at line 88. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBarCLI/CLICostCommand.swift Sources/CodexBarCLI/CLICostCommand.swift:363 — Sources/CodexBarCLI/CLICostCommand.swift changed 29 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in CodexBarCLI.topCostModelLines at line 363. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCLI/CLICostCommand.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/UsageStore+TokenAccounts.swift Sources/CodexBar/UsageStore+TokenAccounts.swift:150 — Sources/CodexBar/UsageStore+TokenAccounts.swift changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in UsageStore.refreshCodexVisibleAccountsForMenu at line 150. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/UsageStore+TokenAccounts.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:639 — Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in JavaScriptCoreProviderPluginEngine.makeContext at line 639. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBar/MenuDescriptor.swift Sources/CodexBar/MenuDescriptor.swift:250 — Sources/CodexBar/MenuDescriptor.swift changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in MenuDescriptor.usageSection at line 250. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/MenuDescriptor.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: Integrations/Linux/Shared/Usage.js Integrations/Linux/Shared/Usage.js:39 — Integrations/Linux/Shared/Usage.js changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in Usage.rows at line 39. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Integrations/Linux/Shared/Usage.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: Sources/CodexBar/SpendDashboardController.swift Sources/CodexBar/SpendDashboardController.swift:223 — Sources/CodexBar/SpendDashboardController.swift changed 35 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in SpendDashboardSource.makeRequest at line 223. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/SpendDashboardController.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:336 — Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift changed 34 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in Repository.loadRecord at line 336. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBarCore/Resources/Plugins/zai.js Sources/CodexBarCore/Resources/Plugins/zai.js:24 — Sources/CodexBarCore/Resources/Plugins/zai.js changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in fetchUsage at line 24. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Resources/Plugins/zai.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: Sources/CodexBar/CostHistoryChartMenuView.swift Sources/CodexBar/CostHistoryChartMenuView.swift:119 — Sources/CodexBar/CostHistoryChartMenuView.swift changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in CostHistoryChartMenuView.body at line 119. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/CostHistoryChartMenuView.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:143 — Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift changed 19 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 43 in ClaudeCLISession.captureExclusive at line 143. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.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.
  • + 130 more in this group — see findings.md.
D10 · Test Quality · Skipped test · ×120
  • Skipped test: test_renderSyntheticBalances Tests/CodexBarTests/APIBalanceScreenshotRenderTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_renderUnavailableUpdateRow Tests/CodexBarTests/AboutUpdateCommandProofTests.swift:8 — Skipped — throws XCTSkip
  • Skipped test: test_renderSyntheticUsage Tests/CodexBarTests/AccountAPIProviderScreenshotRenderTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_visibilityToggleInSignedHost Tests/CodexBarTests/AgentSessionVisibilityNativeProofTests.swift:10 — Skipped — throws XCTSkip
  • Skipped test: Tests/CodexBarTests/AlibabaCodingPlanCookieImporterTests.swift:11 — Skipped — 1
  • Skipped test: test_renderSyntheticLocalCostCards Tests/CodexBarTests/AntigravityCostScreenshotTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_renderSyntheticCards Tests/CodexBarTests/BifrostPresentationTests.swift:17 — Skipped — throws XCTSkip
  • Skipped test: test_syntheticBurnDowns Tests/CodexBarTests/BurnDownRenderProofTests.swift:10 — Skipped — throws XCTSkip
  • Skipped test: test_renderIncompleteUsage Tests/CodexBarTests/ClaudeIncompleteScreenshotRenderTests.swift:10 — Skipped — throws XCTSkip
  • Skipped test: test_accountProgressRemainsVisibleDuringNativeMenuTracking Tests/CodexBarTests/ClaudeSwapProgressNativeProofTests.swift:10 — Skipped — throws XCTSkip
  • Skipped test: test_renderActiveRepair Tests/CodexBarTests/ClaudeSwapRichUsageNativeProofTests.swift:10 — Skipped — throws XCTSkip
  • Skipped test: test_renderAccountCards Tests/CodexBarTests/ClaudeSwapRichUsageNativeProofTests.swift:36 — Skipped — throws XCTSkip
  • Skipped test: test_weeklyLabelsInProductionMenuCard Tests/CodexBarTests/ClaudeWeeklyLabelsNativeProofTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_renderSyntheticReportCards Tests/CodexBarTests/CodeRabbitScreenshotRenderTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_dashboardBalanceFreshnessInNativeCards Tests/CodexBarTests/CodexExtraUsageNativeProofTests.swift:10 — Skipped — throws XCTSkip
  • Skipped test: test_systemReauthenticationProgress Tests/CodexBarTests/CodexReauthenticationNativeProofTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_sharedCostPresentation Tests/CodexBarTests/CodexSharedCostNativeProofTests.swift:8 — Skipped — throws XCTSkip
  • Skipped test: test_privateAccountSwitcher Tests/CodexBarTests/CodexSwitcherPrivacyNativeProofTests.swift:8 — Skipped — throws XCTSkip
  • Skipped test: test_syntheticSystemAccountMenu Tests/CodexBarTests/CodexSystemAccountPrivacyProofTests.swift:12 — Skipped — throws XCTSkip
  • Skipped test: test_workspaceObservationsInCardsAndBalanceTokens Tests/CodexBarTests/CodexWorkspaceBalanceNativeProofTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_renderSyntheticWorkspaceLabels Tests/CodexBarTests/CodexWorkspaceDisplayScreenshotTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_offlineAllowanceEditing Tests/CodexBarTests/CopilotAllowanceNativeProofTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_metricSwitchDoesNotScrollNativeMenus Tests/CodexBarTests/CostHistoryMetricNativeProofTests.swift:12 — Skipped — throws XCTSkip
  • Skipped test: test_renderSyntheticConversationTitles Tests/CodexBarTests/CostHistoryModelNamesRenderTests.swift:9 — Skipped — throws XCTSkip
  • Skipped test: test_renderSyntheticNames Tests/CodexBarTests/CostHistoryModelNamesRenderTests.swift:55 — Skipped — throws XCTSkip
  • + 95 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×98
  • FileTooLong: ClaudeOAuth/ClaudeOAuthCredentials.swift Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift — FileTooLong — 2386 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: ClaudeOAuthCredentialsStore (14-3208). The bar is 500 significant lines; this is 1886 over it, 4.77× 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: CodexBarCore/CostUsageFetcher.swift Sources/CodexBarCore/CostUsageFetcher.swift — FileTooLong — 1665 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: CostUsageFetcher (31-1986). The bar is 500 significant lines; this is 1165 over it, 3.33× 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: CodexBar/SpendDashboardController.swift Sources/CodexBar/SpendDashboardController.swift — FileTooLong — 1471 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 971 over it, 2.94× 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: CodexBar/SpendDashboardModel.swift Sources/CodexBar/SpendDashboardModel.swift — FileTooLong — 1275 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: SpendDashboardModel (22-1636). The bar is 500 significant lines; this is 775 over it, 2.55× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: CodexBar/StatusItemController+Menu.swift Sources/CodexBar/StatusItemController+Menu.swift — FileTooLong — 1258 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 758 over it, 2.52× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: CodexBar/UsageStore.swift Sources/CodexBar/UsageStore.swift — FileTooLong — 1253 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 753 over it, 2.51× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: CodexBar/UsageStore+TokenAccounts.swift Sources/CodexBar/UsageStore+TokenAccounts.swift — FileTooLong — 1248 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 748 over it, 2.50× 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: CodexBar/UsageStore+OpenAIWeb.swift Sources/CodexBar/UsageStore+OpenAIWeb.swift — FileTooLong — 1234 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 734 over it, 2.47× 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: CodexBarCore/CostUsageModels.swift Sources/CodexBarCore/CostUsageModels.swift — FileTooLong — 1234 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 734 over it, 2.47× 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: CodexBar/UsageStore+Refresh.swift Sources/CodexBar/UsageStore+Refresh.swift — FileTooLong — 1223 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 723 over it, 2.45× 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: Antigravity/AntigravityStatusProbe.swift Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift — FileTooLong — 1217 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 717 over it, 2.43× 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: CodexBarCLI/CLIServeCommand.swift Sources/CodexBarCLI/CLIServeCommand.swift — FileTooLong — 1207 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 707 over it, 2.41× 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: CodexBar/MenuBarLayoutRenderer.swift Sources/CodexBar/MenuBarLayoutRenderer.swift — FileTooLong — 1177 significant lines (blank, comment-only and punctuation-only lines excluded), about 65% of them inside a single declaration: MenuBarLayoutRenderer (305-1299). The bar is 500 significant lines; this is 677 over it, 2.35× 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: CodexBar/MenuCardView.swift Sources/CodexBar/MenuCardView.swift — FileTooLong — 1173 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 673 over it, 2.35× 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: CodexBarCore/UsageFetcher.swift Sources/CodexBarCore/UsageFetcher.swift — FileTooLong — 1163 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 663 over it, 2.33× 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: CodexBar/UsageStore+PlanUtilization.swift Sources/CodexBar/UsageStore+PlanUtilization.swift — FileTooLong — 1139 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 639 over it, 2.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: Claude/ClaudeStatusProbe.swift Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift — FileTooLong — 1118 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 618 over it, 2.24× 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: Kiro/KiroStatusProbe.swift Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift — FileTooLong — 1106 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 606 over it, 2.21× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Sync/CloudSyncEngine.swift Sources/CodexBar/Sync/CloudSyncEngine.swift — FileTooLong — 1100 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 600 over it, 2.20× 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: Claude/ClaudeUsageFetcher.swift Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift — FileTooLong — 1087 significant lines (blank, comment-only and punctuation-only lines excluded). 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: MiniMax/MiniMaxUsageFetcher.swift Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift — FileTooLong — 1076 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 576 over it, 2.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Cursor/CursorStatusProbe.swift Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift — FileTooLong — 1066 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 566 over it, 2.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: CodexBarCore/PiSessionCostScanner.swift Sources/CodexBarCore/PiSessionCostScanner.swift — FileTooLong — 1063 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: PiSessionCostScanner (20-1306). The bar is 500 significant lines; this is 563 over it, 2.13× 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: ClaudeWeb/ClaudeWebAPIFetcher.swift Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift — FileTooLong — 1063 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 563 over it, 2.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: CodexBar/PreferencesSpendDashboardPane.swift Sources/CodexBar/PreferencesSpendDashboardPane.swift — FileTooLong — 1059 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 559 over it, 2.12× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • + 73 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×73
  • MethodTooLong: IconRenderer.makeIcon Sources/CodexBar/IconRenderer.swift:142 — MethodTooLong — makeIcon runs 585 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 485 over it, 5.85× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TTYCommandRunner.run Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:455 — MethodTooLong — run runs 433 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 333 over it, 4.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: CostUsageFetcher.loadTokenResult Sources/CodexBarCore/CostUsageFetcher.swift:466 — MethodTooLong — loadTokenResult runs 308 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 208 over it, 3.08× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: DebugPane.body Sources/CodexBar/PreferencesDebugPane.swift:30 — MethodTooLong — body runs 274 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 174 over it, 2.74× 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: CostHistoryChartMenuView.body Sources/CodexBar/CostHistoryChartMenuView.swift:119 — MethodTooLong — body runs 237 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 137 over it, 2.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: SettingsStore.loadDefaultsState Sources/CodexBar/SettingsStore.swift:520 — MethodTooLong — loadDefaultsState runs 198 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 98 over it, 1.98× 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: CodexBarCLI.fetchUsageOutput Sources/CodexBarCLI/CLIUsageCommand.swift:423 — MethodTooLong — fetchUsageOutput runs 174 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 74 over it, 1.74× 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: ProviderSettingsTokenAccountsRowView.body Sources/CodexBar/PreferencesProviderSettingsRows.swift:248 — MethodTooLong — body runs 161 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 61 over it, 1.61× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ProviderPluginManifest.init REDACTED:127 — MethodTooLong — init runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54× 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: StatusItemController.applyIcon Sources/CodexBar/StatusItemController+Animation.swift:340 — MethodTooLong — applyIcon runs 151 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 51 over it, 1.51× 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: CodexLocalProjectUsageIndexer.buildSnapshotFromCostCache Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:152 — MethodTooLong — buildSnapshotFromCostCache runs 149 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× 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: CostUsageFetcher.loadCachedCodexTokenSnapshotResult Sources/CodexBarCore/CostUsageFetcher.swift:1369 — MethodTooLong — loadCachedCodexTokenSnapshotResult runs 144 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 44 over it, 1.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: UsageStore.codexOutcomeAdmittedForPublication Sources/CodexBar/Providers/Codex/UsageStore+CodexWeeklyResetConfirmation.swift:31 — MethodTooLong — codexOutcomeAdmittedForPublication 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: StatusItemController.populateMenu Sources/CodexBar/StatusItemController+Menu.swift:221 — MethodTooLong — populateMenu runs 139 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 39 over it, 1.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: UsageStore.refreshCodexVisibleAccountsForMenu Sources/CodexBar/UsageStore+TokenAccounts.swift:150 — MethodTooLong — refreshCodexVisibleAccountsForMenu 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: JavaScriptCoreProviderPluginEngine.makeContext Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:639 — MethodTooLong — makeContext runs 134 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 34 over it, 1.34× 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: ClaudeProviderDescriptor.makeDescriptor Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:88 — MethodTooLong — makeDescriptor runs 134 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 34 over it, 1.34× 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: PiFamilySessionScanner.costSessionRoots Sources/CodexBarCore/PiFamilySessionScanner.swift:391 — MethodTooLong — costSessionRoots runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× 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: BurnChartCanvas.body Sources/CodexBarWidget/BurnDownWidgetViews.swift:320 — MethodTooLong — body runs 131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× 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: AmpUsageParser.parse Sources/CodexBarCore/Providers/Amp/AmpUsageParser.swift:20 — MethodTooLong — parse runs 130 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 30 over it, 1.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: CodexBarCLI.commandDescriptors Sources/CodexBarCLI/CLIEntry.swift:165 — MethodTooLong — commandDescriptors 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: PiSessionCostScanner.loadDailyReportResultCancellable Sources/CodexBarCore/PiSessionCostScanner.swift:155 — MethodTooLong — loadDailyReportResultCancellable 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: PiSessionCostScanner.parsePiSessionFile Sources/CodexBarCore/PiSessionCostScanner.swift:832 — MethodTooLong — parsePiSessionFile 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: UsageStore.refreshProviderPass Sources/CodexBar/UsageStore+Refresh.swift:293 — MethodTooLong — refreshProviderPass runs 128 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 28 over it, 1.28× 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: UsageStore.handleProviderFetchFailure Sources/CodexBar/UsageStore+Refresh.swift:1304 — MethodTooLong — handleProviderFetchFailure runs 127 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× 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.
  • + 48 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Repeated repair · ×62
  • Repeated repair: Sources/CodexBar/CodexbarApp.swift Sources/CodexBar/CodexbarApp.swift:668 — Sources/CodexBar/CodexbarApp.swift changed 34 times in last 90 days and 20 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is AppDelegate.ensureSingleSettingsApplicationMenuItem at line 668), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(widgets): replace a stale widget extension after an update (#4663)”; “fix(dock): stop rescanning windows on every update pass (#4524)”; “fix(menu-bar): defer placeholder Settings window dismissal until presentation finishes (#4415)”; “Fix Homebrew updates for homebrew/cask installs”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/CodexbarApp.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.
  • Repeated repair: Sources/CodexBar/StatusItemController.swift Sources/CodexBar/StatusItemController.swift:834 — Sources/CodexBar/StatusItemController.swift changed 32 times in last 90 days and 17 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is StatusItemController.attachMenus at line 834), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(sessions): never run the Tailscale app binary for discovery; add local-only mode (#4636)”; “fix(menu): preserve keyboard selection with hover opt-out”; “fix(menu): keep blink scheduling aligned with visible critters”; “fix: correct Cursor sessions, provider order, and Pi costs (#4148)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/StatusItemController.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.
  • Repeated repair: Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift:654 — Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift changed 26 times in last 90 days and 15 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is ProviderUsagePresentation.window at line 654), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(claude): show prepaid usage credits in menu bar Balance layouts”; “fix(menu): map Nous Portal credit rows to the menu bar balance (#4319)”; “fix(providers): clarify Kimi and z.ai quota availability (#4091)”; “fix(mistral): keep widget selection provider-owned”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/ProviderUsagePresentation.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.
  • Repeated repair: Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:37 — Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift changed 11 times in last 90 days and 9 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is OllamaUsageFetcher.swift.normalizedOllamaTokenAccountHeader at line 37), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(ollama): simplify free usage parsing and regression coverage”; “fix(ollama): parse the Free usage meter on free-plan settings pages”; “fix(ollama): explain empty manual cookie setup”; “fix: retain provider data across transient transport failures (#3672)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.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.
  • Repeated repair: Sources/CodexBar/SpendActivityHeatmap.swift Sources/CodexBar/SpendActivityHeatmap.swift:768 — Sources/CodexBar/SpendActivityHeatmap.swift changed 12 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is SpendActivityWeekGrid.body at line 768), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(spend): keep activity navigation aligned in RTL layouts”; “fix: expose activity navigation to accessibility”; “fix(spend): preserve calendar days across midnight DST (#3565)”; “fix(spend): keep heatmap tooltips within the grid (#3407)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/SpendActivityHeatmap.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.
  • Repeated repair: Sources/CodexBar/MenuCardView+ProviderDetailLocalization.swift Sources/CodexBar/MenuCardView+ProviderDetailLocalization.swift:206 — Sources/CodexBar/MenuCardView+ProviderDetailLocalization.swift changed 10 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is Model.localizedZaiCountdown at line 206), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(kimi): show gift credit balances with their expiry (#4691)”; “fix(plugins): retain selected quotas and support row severity (#4627)”; “fix(amp): restore Tier usage and billing-period pacing”; “fix(openrouter): distinguish key limits from account balance (#3231)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/MenuCardView+ProviderDetailLocalization.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.
  • Repeated repair: Sources/CodexBar/ProviderMenuBarPercentWindowSettingsView.swift Sources/CodexBar/ProviderMenuBarPercentWindowSettingsView.swift:75 — Sources/CodexBar/ProviderMenuBarPercentWindowSettingsView.swift changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is ProviderMenuBarPercentWindowPicker.selectionBinding at line 75), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mistral): preserve explicit Monthly Plan picker choices”; “fix(mistral): keep metric-only picker choices valid without a percentage”; “fix(mistral): keep the shared picker footer”; “fix(mistral): show the metric picker in every menu bar style”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/ProviderMenuBarPercentWindowSettingsView.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.
  • Repeated repair: Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountProjection.swift Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountProjection.swift:334 — Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountProjection.swift changed 9 times in last 90 days and 7 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is ClaudeSwapAccountProjection.errorText at line 334), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(claude): show session forecasts on claude-swap cards (#4566)”; “fix(claude): honor read-only account adapters (#3846)”; “fix(claude): preserve historical account usage and explicit repair (#3452)”; “fix(claude): preserve claude-swap measurement timestamps”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountProjection.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.
  • Repeated repair: Sources/CodexBar/Providers/Claude/StatusItemController+ClaudeSwapMenu.swift Sources/CodexBar/Providers/Claude/StatusItemController+ClaudeSwapMenu.swift:107 — Sources/CodexBar/Providers/Claude/StatusItemController+ClaudeSwapMenu.swift changed 11 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is StatusItemController.startClaudeSwapAccountSwitch at line 107), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(claude): show session forecasts on claude-swap cards (#4566)”; “fix(claude): clarify account switching and await reconciliation (#3740)”; “fix(claude): distinguish accounts in privacy mode (#3495)”; “fix(claude): preserve historical account usage and explicit repair (#3452)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/Providers/Claude/StatusItemController+ClaudeSwapMenu.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.
  • Repeated repair: Sources/CodexBar/DockIconController.swift Sources/CodexBar/DockIconController.swift:244 — Sources/CodexBar/DockIconController.swift changed 7 times in last 90 days and 6 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is DockIconController.reevaluatePolicy at line 244), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(dock): stop rescanning windows on every update pass (#4524)”; “fix(menu): hide the Dock icon on macOS 27 and pick the most constrained OpenCode Go quota (#4335)”; “Fix Settings window opening”; “fix: remove lifecycle keepalive window”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/DockIconController.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.
  • Repeated repair: Sources/CodexBar/StatusItemController+MenuTypes.swift Sources/CodexBar/StatusItemController+MenuTypes.swift:44 — Sources/CodexBar/StatusItemController+MenuTypes.swift changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is OverviewMenuCardRowView.body at line 44), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(claude): preserve enterprise spend and CLI failures (#4332)”; “fix: refresh Codex usage cards without mixing account identities (#3189)”; “fix(codex): show Business monthly credit on stacked cards (#3112)”; “fix: align Overview spend with spend dashboard”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/StatusItemController+MenuTypes.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.
  • Repeated repair: Sources/CodexBar/StatusItemController+Shutdown.swift Sources/CodexBar/StatusItemController+Shutdown.swift:24 — Sources/CodexBar/StatusItemController+Shutdown.swift changed 9 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is StatusItemController.cancelShutdownTasks at line 24), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(menu): preserve keyboard selection with hover opt-out”; “fix(menu): verify stable identities during shutdown teardown”; “Fix status item teardown on quit”; “fix(menu): preserve placement through status item teardown (#3723)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/StatusItemController+Shutdown.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.
  • Repeated repair: Sources/CodexBarCore/Providers/Kimi/KimiUsageFetcher.swift Sources/CodexBarCore/Providers/Kimi/KimiUsageFetcher.swift:30 — Sources/CodexBarCore/Providers/Kimi/KimiUsageFetcher.swift changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is KimiUsageFetcher.fetchCodeAPIUsage at line 30), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(kimi): keep web usage when a lapsed plan has no Code pools (#4700)”; “fix(kimi): show gift credit balances with their expiry (#4691)”; “fix(kimi): support regional usage and dashboard hosts (#3826)”; “fix(kimi): decode Code API ratio quota pools (#3697)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Kimi/KimiUsageFetcher.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.
  • Repeated repair: Sources/CodexBar/UsageStore+ClaudeHistoryFallback.swift Sources/CodexBar/UsageStore+ClaudeHistoryFallback.swift:100 — Sources/CodexBar/UsageStore+ClaudeHistoryFallback.swift changed 8 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is UsageStore.shouldPreservePriorSnapshot at line 100), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(plugins): harden selected-profile result handling”; “fix(deepseek): retain balances only for matching live sessions (#3680)”; “fix: retain provider data across transient transport failures (#3672)”; “fix(codex): preserve usage through wrapped transport failures (#3667)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/UsageStore+ClaudeHistoryFallback.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.
  • Repeated repair: Sources/CodexBarCore/Resources/Plugins/muse.js Sources/CodexBarCore/Resources/Plugins/muse.js:8 — Sources/CodexBarCore/Resources/Plugins/muse.js changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is muse._optionalChain at line 8), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(muse): try email-matched sessions before blank-email membership checks”; “fix(muse): keep searching after an unbound session's team list fails”; “fix(muse): match blank dev.meta.ai session emails through team membership”; “fix(muse): harden explicit browser team quotas”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Resources/Plugins/muse.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Repeated repair: Sources/CodexBarCore/Providers/Cursor/CursorUsageEventsFetcher.swift Sources/CodexBarCore/Providers/Cursor/CursorUsageEventsFetcher.swift:392 — Sources/CodexBarCore/Providers/Cursor/CursorUsageEventsFetcher.swift changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is CursorUsageEventsFetcher.fetchAllEvents at line 392), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cursor): harden all-history request regression coverage”; “Fix Cursor all-history cost refresh dates”; “fix(cursor): back off forbidden cost refreshes for six hours (#3924)”; “fix(cursor): handle empty cost history responses”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Cursor/CursorUsageEventsFetcher.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.
  • Repeated repair: Sources/CodexBar/StatusItemController+StatusItemVending.swift Sources/CodexBar/StatusItemController+StatusItemVending.swift:14 — Sources/CodexBar/StatusItemController+StatusItemVending.swift changed 7 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is StatusItemController.makeStatusItem at line 14), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(menu): retain status item identities during recovery removal (#4033)”; “fix(menu): verify stable identities during shutdown teardown”; “Fix status item teardown on quit”; “fix(menu): name status items before sizing and bound saved positions (#3825)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/StatusItemController+StatusItemVending.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.
  • Repeated repair: Sources/CodexBarCore/Providers/Kimi/KimiModels.swift Sources/CodexBarCore/Providers/Kimi/KimiModels.swift:41 — Sources/CodexBarCore/Providers/Kimi/KimiModels.swift changed 6 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 12 (its worst body is KimiCodeAPIUsageResponse.planName at line 41), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(kimi): keep web usage when a lapsed plan has no Code pools (#4700)”; “fix(kimi): show gift credit balances with their expiry (#4691)”; “fix(providers): avoid crashes on oversized usage values (#3758)”; “fix(kimi): decode Code API ratio quota pools (#3697)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Kimi/KimiModels.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.
  • Repeated repair: Sources/CodexBar/PredictivePaceWarnings.swift Sources/CodexBar/PredictivePaceWarnings.swift:215 — Sources/CodexBar/PredictivePaceWarnings.swift changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is UsageStore.warningClaudeAccountDiscriminators at line 215), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(l10n): correct Ukrainian strings and localize countdown units (#4676)”; “fix(claude): preserve quota warnings across identity gaps”; “fix(claude): keep warnings for unresolved accounts (#3813)”; “fix(claude): preserve verified quota warning history (#3813)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/PredictivePaceWarnings.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.
  • Repeated repair: Sources/CodexBarCore/BrowserCookieImportOrder.swift Sources/CodexBarCore/BrowserCookieImportOrder.swift:21 — Sources/CodexBarCore/BrowserCookieImportOrder.swift changed 5 times in last 90 days and 5 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is Browser.lazyCookieImportCandidates at line 21), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cookies): explain Files & Folders denial instead of Sign in (#4482)”; “fix(lithosai): restore cookie retries and menu bar balance (#4240)”; “fix(cookies): explain supported automatic browser sources (#4219)”; “Fix Claude web cookie refresh (#3162)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/BrowserCookieImportOrder.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.
  • Repeated repair: Sources/CodexBar/ManagedCodexAccountService.swift Sources/CodexBar/ManagedCodexAccountService.swift:410 — Sources/CodexBar/ManagedCodexAccountService.swift changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is ManagedCodexAccountService.replacedAccountIDs at line 410), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(codex): retain shared managed homes through cleanup”; “fix(codex): guard managed home deletion when another record references the path”; “fix: share CLI login lifecycle and honor cancellation (#3484)”; “fix(codex): preserve selected workspace ownership (#3386)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/ManagedCodexAccountService.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.
  • Repeated repair: Sources/CodexBar/StatusItemController+MenuCardItems.swift Sources/CodexBar/StatusItemController+MenuCardItems.swift:13 — Sources/CodexBar/StatusItemController+MenuCardItems.swift changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is StatusItemController.refreshMenuCardHeights at line 13), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(menu): preserve keyboard selection with hover opt-out”; “fix: preserve cached menu card heights”; “fix: prevent native menu card highlighting”; “fix: unify menu card row containers”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBar/StatusItemController+MenuCardItems.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.
  • Repeated repair: Sources/CodexBarCore/Providers/CommandCode/CommandCodeUsageFetcher.swift Sources/CodexBarCore/Providers/CommandCode/CommandCodeUsageFetcher.swift:270 — Sources/CodexBarCore/Providers/CommandCode/CommandCodeUsageFetcher.swift changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is CommandCodeUsageFetcher.send at line 270), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(providers): preserve unknown plans and mark estimated quota (#4423)”; “fix(providers): recover Command Code grants and Kimi web sessions (#3941)”; “fix(commandcode): preserve monthly usage during subscription timeouts”; “fix: parse Command Code usage windows (#2630)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/CommandCode/CommandCodeUsageFetcher.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.
  • Repeated repair: Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift:233 — Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift changed 7 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 9 (its worst body is MistralUsageFetcher.parseResponse at line 233), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(mistral): verify billing price dimensions and share aggregation”; “fix(mistral): price billing usage by event type, zone, and tier”; “fix(usage): retain partial history and plan-covered tokens (#3963)”; “fix(mistral): check billing token arithmetic (#3612)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.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.
  • Repeated repair: Sources/CodexBarCore/Providers/Devin/DevinSessionImporter.swift Sources/CodexBarCore/Providers/Devin/DevinSessionImporter.swift:368 — Sources/CodexBarCore/Providers/Devin/DevinSessionImporter.swift changed 6 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is DevinSessionImporter.organizationCandidates at line 368), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(devin): share Chromium browser session discovery (#3883)”; “fix(devin): distinguish unreadable browser sessions (#3814)”; “fix(providers): preserve organization and account identity (#3760)”; “fix(devin): isolate browser sessions and honor organization selection (#3735)”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-26..2026-10-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-26 03:29:13 -07:00' --until='2026-10-24 03:29:13 -07:00' --full-history --no-merges -- Sources/CodexBarCore/Providers/Devin/DevinSessionImporter.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.
  • + 37 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×56
  • ClassTooLong: ClaudeOAuthCredentialsStore Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:14 — ClassTooLong — 2315 significant lines (blank, comment-only and punctuation-only lines excluded), 146 methods. The bar is 400 significant lines; this is 1915 over it, 5.79× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CostUsageFetcher Sources/CodexBarCore/CostUsageFetcher.swift:31 — ClassTooLong — 1560 significant lines (blank, comment-only and punctuation-only lines excluded), 54 methods. The bar is 400 significant lines; this is 1160 over it, 3.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SpendDashboardModel Sources/CodexBar/SpendDashboardModel.swift:22 — ClassTooLong — 1246 significant lines (blank, comment-only and punctuation-only lines excluded), 57 methods. The bar is 400 significant lines; this is 846 over it, 3.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: PiSessionCostScanner Sources/CodexBarCore/PiSessionCostScanner.swift:20 — ClassTooLong — 993 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 593 over it, 2.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: IconRenderer Sources/CodexBar/IconRenderer.swift:5 — ClassTooLong — 885 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods. The bar is 400 significant lines; this is 485 over it, 2.21× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: PiFamilySessionScanner Sources/CodexBarCore/PiFamilySessionScanner.swift:156 — ClassTooLong — 879 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods. The bar is 400 significant lines; this is 479 over it, 2.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.
  • ClassTooLong: AlibabaTokenPlanUsageFetcher Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:35 — ClassTooLong — 848 significant lines (blank, comment-only and punctuation-only lines excluded), 48 methods. The bar is 400 significant lines; this is 448 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: CostHistoryChartMenuView Sources/CodexBar/CostHistoryChartMenuView.swift:6 — ClassTooLong — 822 significant lines (blank, comment-only and punctuation-only lines excluded), 66 methods. The bar is 400 significant lines; this is 422 over it, 2.06× 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: CLIRenderer Sources/CodexBarCLI/CLIRenderer.swift:5 — ClassTooLong — 807 significant lines (blank, comment-only and punctuation-only lines excluded), 75 methods. The bar is 400 significant lines; this is 407 over it, 2.02× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: CodexWorkspaceUsageSidecar Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:13 — ClassTooLong — 805 significant lines (blank, comment-only and punctuation-only lines excluded), 37 methods. The bar is 400 significant lines; this is 405 over it, 2.01× 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: MenuBarLayoutRenderer Sources/CodexBar/MenuBarLayoutRenderer.swift:303 — ClassTooLong — 769 significant lines (blank, comment-only and punctuation-only lines excluded), 47 methods. The bar is 400 significant lines; this is 369 over it, 1.92× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: OpenAIDashboardBrowserCookieImporter Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:7 — ClassTooLong — 746 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 346 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: UsageStore Sources/CodexBar/UsageStore.swift:121 — ClassTooLong — 711 significant lines (blank, comment-only and punctuation-only lines excluded), 833 methods. The bar is 400 significant lines; this is 311 over it, 1.78× 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: StatusItemController Sources/CodexBar/StatusItemController.swift:41 — ClassTooLong — 684 significant lines (blank, comment-only and punctuation-only lines excluded), 595 methods. The bar is 400 significant lines; this is 284 over it, 1.71× 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: SpendDashboardSource Sources/CodexBar/SpendDashboardController.swift:166 — ClassTooLong — 664 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods. The bar is 400 significant lines; this is 264 over it, 1.66× 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: KiroStatusProbe Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:302 — ClassTooLong — 657 significant lines (blank, comment-only and punctuation-only lines excluded), 39 methods. The bar is 400 significant lines; this is 257 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: ProviderSwitcherView Sources/CodexBar/StatusItemController+SwitcherViews.swift:10 — ClassTooLong — 655 significant lines (blank, comment-only and punctuation-only lines excluded), 68 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: KiloUsageFetcher Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:200 — ClassTooLong — 653 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods. The bar is 400 significant lines; this is 253 over it, 1.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.
  • ClassTooLong: OpenAIDashboardFetcher Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:6 — ClassTooLong — 652 significant lines (blank, comment-only and punctuation-only lines excluded), 72 methods, 2 blocks, lines 7-1292. The bar is 400 significant lines; this is 252 over it, 1.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.
  • ClassTooLong: CloudSyncEngine Sources/CodexBar/Sync/CloudSyncEngine.swift:432 — ClassTooLong — 649 significant lines (blank, comment-only and punctuation-only lines excluded), 59 methods. The bar is 400 significant lines; this is 249 over it, 1.62× 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: SpendDashboardController Sources/CodexBar/SpendDashboardController.swift:1087 — ClassTooLong — 644 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 244 over it, 1.61× 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: FactoryStatusProbe Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:588 — ClassTooLong — 638 significant lines (blank, comment-only and punctuation-only lines excluded), 33 methods. The bar is 400 significant lines; this is 238 over it, 1.60× 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: AntigravityStatusProbe Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:831 — ClassTooLong — 621 significant lines (blank, comment-only and punctuation-only lines excluded), 67 methods. The bar is 400 significant lines; this is 221 over it, 1.55× 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: CookieHeaderCache Sources/CodexBarCore/CookieHeaderCache.swift:60 — ClassTooLong — 617 significant lines (blank, comment-only and punctuation-only lines excluded), 80 methods. The bar is 400 significant lines; this is 217 over it, 1.54× 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: QuickJSProviderPluginEngine Sources/CodexBarCore/Plugins/QuickJSProviderPluginEngine.swift:197 — ClassTooLong — 614 significant lines (blank, comment-only and punctuation-only lines excluded), 39 methods. The bar is 400 significant lines; this is 214 over it, 1.54× 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.
  • + 31 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×53
  • Duplicated block (5 lines × 2) Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:165 — Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:165-169 | Sources/CodexBarCore/Providers/Codex/CodexOpenAIWorkspaceIdentityCache.swift:61-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/CodexAccountUsageSnapshotStore.swift:165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/CodexBar/CostHistoryChartMenuView.swift:705 — Sources/CodexBar/CostHistoryChartMenuView.swift:705-709 | Sources/CodexBarCore/PiSessionCostScanner.swift:1354-1358 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The `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 (5 lines × 2) Sources/CodexBar/CostHistoryChartMenuView.swift:905 — Sources/CodexBar/CostHistoryChartMenuView.swift:905-909 | Sources/CodexBar/CostHistoryChartMenuView.swift:967-971 — both copies are in the same file, so extract the 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 (5 lines × 2) Sources/CodexBar/MenuBarLayout.swift:1098 — Sources/CodexBar/MenuBarLayout.swift:1098-1102 | Sources/CodexBar/MenuBarLayout.swift:1244-1248 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) Sources/CodexBar/MenuBarLayoutRenderer.swift:1197 — Sources/CodexBar/MenuBarLayoutRenderer.swift:1197-1201 | Sources/CodexBarWidget/WidgetDesignSystem.swift:157-161 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/MenuBarLayoutRenderer.swift:1197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:689 — Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:689-693 | Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:719-723 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:689` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/CodexBar/PreferencesCodexAccountsSection.swift:129 — Sources/CodexBar/PreferencesCodexAccountsSection.swift:129-133 | Sources/CodexBar/PreferencesCodexAccountsSection.swift:159-163 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/PreferencesCodexAccountsSection.swift:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/CodexBar/Providers/Claude/ClaudeSwapAccountSwitcherView.swift:63 — Sources/CodexBar/Providers/Claude/ClaudeSwapAccountSwitcherView.swift:63-67 | Sources/CodexBar/StatusItemController+SwitcherViews.swift:1278-1282 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Claude/ClaudeSwapAccountSwitcherView.swift:63` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/CodexBar/SessionUsageBrowser.swift:240 — Sources/CodexBar/SessionUsageBrowser.swift:240-244 | Sources/CodexBar/SessionUsageBrowser.swift:342-346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/SessionUsageBrowser.swift:240` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/CodexBar/SpendActivityHeatmap.swift:524 — Sources/CodexBar/SpendActivityHeatmap.swift:524-531 | Sources/CodexBar/SpendActivityHeatmap.swift:796-800 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/SpendActivityHeatmap.swift:524` 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 (5 lines × 2) Sources/CodexBar/SpendDashboardModel.swift:213 — Sources/CodexBar/SpendDashboardModel.swift:213-217 | Sources/CodexBar/SpendDashboardModel.swift:1648-1652 — both copies are in the same file, so extract the 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 (5 lines × 2) Sources/CodexBar/StatusItemController+SwitcherViews.swift:372 — Sources/CodexBar/StatusItemController+SwitcherViews.swift:372-376 | Sources/CodexBar/StatusItemController+SwitcherViews.swift:391-398 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/StatusItemController+SwitcherViews.swift:372` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/CodexBarCore/CookieHeaderCache.swift:308 — Sources/CodexBarCore/CookieHeaderCache.swift:308-312 | Sources/CodexBarCore/CookieHeaderCache.swift:967-971 — both copies are in the same file, so extract the 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 `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. 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 (5 lines × 2) Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:212 — Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:212-216 | Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:1146-1150 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1072 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1072-1076 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1082-1086 — both copies are in the same file, so extract the 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 `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 (5 lines × 2) Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:130 — Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:130-134 | Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:192-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalReader.swift:151 — Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalReader.swift:151-155 | Sources/CodexBarCore/Providers/Muse/MuseLocalUsageReader.swift:186-190 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalReader.swift:151` 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 (5 lines × 2) Sources/CodexBarCore/Providers/Augment/AugmentSessionKeepalive.swift:491 — Sources/CodexBarCore/Providers/Augment/AugmentSessionKeepalive.swift:491-495 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageSnapshot.swift:253-257 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Augment/AugmentSessionKeepalive.swift:491` 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 (5 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthDelegatedRefreshCoordinator.swift:340 — Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthDelegatedRefreshCoordinator.swift:340-344 | Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthDelegatedRefreshCoordinator.swift:354-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (5 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:601 — Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:601-605 | Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:664-668 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:601 — Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:601-605 | Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:887-891 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:450 — Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:450-454 | Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:488-492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) Sources/CodexBarCore/Providers/Factory/FactoryLocalStorageImporter.swift:19 — Sources/CodexBarCore/Providers/Factory/FactoryLocalStorageImporter.swift:19-23 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:15-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Factory/FactoryLocalStorageImporter.swift:19` 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 (5 lines × 2) Sources/CodexBarCore/Providers/Groq/GroqConsoleFetcher.swift:179 — Sources/CodexBarCore/Providers/Groq/GroqConsoleFetcher.swift:179-183 | Sources/CodexBarCore/Providers/Groq/GroqUsageFetcher.swift:196-200 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Groq/GroqConsoleFetcher.swift:179` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:56 — Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:56-60 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieHeaders.swift:108-112 — before extracting anything, compare `Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift` and `Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieHeaders.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:56` 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.
  • + 28 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×42
  • Duplicated block (9 lines × 2) Scripts/StoreStress/main.swift:324 — Scripts/StoreStress/main.swift:324-332 | Scripts/StoreStress/main.swift:360-368 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) Sources/CodexBar/CostHistoryChartMenuView.swift:714 — Sources/CodexBar/CostHistoryChartMenuView.swift:714-722 | Sources/CodexBar/SpendDashboardModel.swift:1421-1429 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/CostHistoryChartMenuView.swift:714` 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) Sources/CodexBar/MenuCardMetricRow.swift:31 — Sources/CodexBar/MenuCardMetricRow.swift:31-39 | Sources/CodexBar/PreferencesProviderDetailView.swift:669-677 — 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) Sources/CodexBar/PreferencesDebugPane.swift:221 — Sources/CodexBar/PreferencesDebugPane.swift:221-229 | Sources/CodexBar/PreferencesDebugPane.swift:410-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/PreferencesDebugPane.swift:221` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Sources/CodexBar/ProviderSwitcherButtons.swift:44 — Sources/CodexBar/ProviderSwitcherButtons.swift:44-52 | Sources/CodexBar/ProviderSwitcherButtons.swift:168-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) Sources/CodexBar/StatusItemController+SwitcherViews.swift:418 — Sources/CodexBar/StatusItemController+SwitcherViews.swift:418-426 | Sources/CodexBar/StatusItemController+SwitcherViews.swift:471-479 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/StatusItemController+SwitcherViews.swift:418` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Sources/CodexBar/UsageProgressBar.swift:250 — Sources/CodexBar/UsageProgressBar.swift:250-258 | Sources/CodexBar/UsageProgressBar.swift:262-270 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) Sources/CodexBar/UsageStore+Refresh.swift:1133 — Sources/CodexBar/UsageStore+Refresh.swift:1133-1141 | Sources/CodexBar/UsageStore+Refresh.swift:1159-1167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBar/UsageStore+Refresh.swift:1132` calls `invalidateCacheIfCredentialsFileChanged` and `Sources/CodexBar/UsageStore+Refresh.swift:1158` 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 (9 lines × 2) Sources/CodexBarCore/CodexThreadCatalogReader.swift:93 — Sources/CodexBarCore/CodexThreadCatalogReader.swift:93-101 | Sources/CodexBarCore/CodexThreadCatalogReader.swift:109-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CodexThreadCatalogReader.swift:93` 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) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:416 — Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:416-424 | Sources/CodexBarCore/CostUsageModels.swift:348-356 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:416` 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) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:599 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:599-607 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:626-634 — both copies are in the same file, so extract the 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 (9 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1146 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1146-1154 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1162-1170 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1146` 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) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanSettingsReader.swift:44 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanSettingsReader.swift:44-52 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxSettingsReader.swift:45-53 — 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) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:756 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:756-764 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:1115-1123 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:756` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:242 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:242-250 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:168-176 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:242` 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) Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:37 — Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:37-45 | Sources/CodexBarCore/Providers/Zai/ZaiProviderDescriptor.swift:87-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:37` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:71 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:71-79 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeCookieImporter.swift:37-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:71` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:260 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:260-268 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:670-678 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:260` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:394 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:394-402 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:724-732 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:394` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:272 — Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:272-280 | Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:612-620 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:142 — Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:142-150 | Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift:152-160 — before extracting anything, compare `Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift` and `Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:142` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeCredentialRouting.swift:9 — Sources/CodexBarCore/Providers/Claude/ClaudeCredentialRouting.swift:9-20 | Sources/CodexBarCore/Providers/Grok/GrokCredentialRouting.swift:8-16 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/Providers/Claude/ClaudeCredentialRouting.swift:7` calls `adminAPIKey` and `Sources/CodexBarCore/Providers/Grok/GrokCredentialRouting.swift:6` 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 (9 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeCredentialRouting.swift:56 — Sources/CodexBarCore/Providers/Claude/ClaudeCredentialRouting.swift:56-64 | Sources/CodexBarCore/Providers/Claude/ClaudeCredentialRouting.swift:72-80 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeCredentialRouting.swift:56` 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 (9 lines × 2) REDACTED:244 — REDACTED:244-252 | REDACTED:265-273 — both copies are in the same file, so extract the 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:244` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:86 — Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:86-94 | Sources/CodexBarCore/Providers/HuggingFace/HuggingFaceProviderDescriptor.swift:77-85 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:86` 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.
  • + 17 more in this group — see findings.md.
R4 · Test Coverage · No test reaches this file · ×40
  • No test reaches this file Sources/CodexBarCore/Resources/Plugins/chutes.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 Sources/CodexBarCore/Resources/Plugins/openrouter.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 Sources/CodexBarCore/Resources/Plugins/openai.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 Sources/CodexBarCore/Resources/Plugins/chutes.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file Sources/CodexBarCore/Resources/Plugins/bifrost.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 REDACTED: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 REDACTED: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 Sources/CodexBarCore/Resources/Plugins/zai.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 Sources/CodexBarCore/Resources/Plugins/bifrost.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file Sources/CodexBarCore/Resources/Plugins/zoommate.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 REDACTED: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 Sources/CodexBarCore/Resources/Plugins/huggingface.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 Sources/CodexBarCore/Resources/Plugins/muse.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 Sources/CodexBarCore/Resources/Plugins/notion.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 Sources/CodexBarCore/Resources/Plugins/aixy.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 Sources/CodexBarCore/Resources/Plugins/muse.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file Sources/CodexBarCore/Resources/Plugins/zoommate.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file Sources/CodexBarCore/Resources/Plugins/huggingface.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file Sources/CodexBarCore/Resources/Plugins/litellm.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 Sources/CodexBarCore/Resources/Plugins/aixy.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file REDACTED: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 Sources/CodexBarCore/Resources/Plugins/claudeplatform.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 Sources/CodexBarCore/Resources/Plugins/claudeplatform.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file Sources/CodexBarCore/Resources/Plugins/workbuddy.ts:1 — No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
  • No test reaches this file Sources/CodexBarCore/Resources/Plugins/longcat.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.
  • + 15 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×38
  • Duplicated block (6 lines × 2) Sources/CodexBar/CodexAccountSwitcherView.swift:51 — Sources/CodexBar/CodexAccountSwitcherView.swift:51-56 | Sources/CodexBar/StatusItemController+SwitcherViews.swift:1210-1215 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/CodexAccountSwitcherView.swift:51` 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) Sources/CodexBar/CreditsHistoryChartMenuView.swift:37 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:37-42 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:71-76 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 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 `Sources/CodexBar/CreditsHistoryChartMenuView.swift:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/CodexBar/CreditsHistoryChartMenuView.swift:49 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:49-54 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:83-88 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 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 `Sources/CodexBar/CreditsHistoryChartMenuView.swift:49` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBar/UsageBreakdownChartMenuView.swift:89` calls `chartForegroundStyleScale` and `Sources/CodexBar/CreditsHistoryChartMenuView.swift:55` 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 (6 lines × 2) Sources/CodexBar/CreditsHistoryChartMenuView.swift:292 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:292-297 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:422-429 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 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 (6 lines × 2) Sources/CodexBar/Providers/Codex/CodexConsumerProjection.swift:123 — Sources/CodexBar/Providers/Codex/CodexConsumerProjection.swift:123-128 | Sources/CodexBar/Providers/Codex/CodexConsumerProjection.swift:139-144 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Codex/CodexConsumerProjection.swift:123` 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) Sources/CodexBar/ShareStatsCardView.swift:261 — Sources/CodexBar/ShareStatsCardView.swift:261-266 | Sources/CodexBar/ShareStatsCardView.swift:313-318 — both copies are in the same file, so extract the 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, `Sources/CodexBar/ShareStatsCardView.swift:319` calls `minimumScaleFactor` and `Sources/CodexBar/ShareStatsCardView.swift:267` 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 (6 lines × 2) Sources/CodexBar/SpendDashboardModel+ModelBreakdown.swift:110 — Sources/CodexBar/SpendDashboardModel+ModelBreakdown.swift:110-115 | Sources/CodexBar/SpendDashboardModel.swift:931-936 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/SpendDashboardModel+ModelBreakdown.swift:110` 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 (6 lines × 2) Sources/CodexBarCLI/CLICostCommand.swift:101 — Sources/CodexBarCLI/CLICostCommand.swift:101-106 | Sources/CodexBarCLI/CLICostCommand.swift:145-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:521 — Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:521-526 | Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:566-571 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:577 — Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:577-582 | Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:623-628 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:577` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:758 — Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:758-763 | Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:769-774 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:758` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:353 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:353-358 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:727-732 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:353` 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 (6 lines × 2) Sources/CodexBarCore/Providers/Antigravity/AntigravityOfflineStore.swift:89 — Sources/CodexBarCore/Providers/Antigravity/AntigravityOfflineStore.swift:89-94 | Sources/CodexBarCore/Providers/Antigravity/AntigravityOfflineStore.swift:97-102 — both copies are in the same file, so extract the 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) Sources/CodexBarCore/Providers/Codex/CodexStatusProbe.swift:185 — Sources/CodexBarCore/Providers/Codex/CodexStatusProbe.swift:185-190 | Sources/CodexBarCore/Providers/Codex/CodexStatusProbe.swift:193-198 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexStatusProbe.swift:185` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:781 — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:781-786 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxBillingHistory.swift:324-329 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:328 — Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:328-333 | Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:340-345 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:328` 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, `Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:348` calls `response`, `statusError` and `Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:335` 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) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:91 — Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:91-96 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieHeaders.swift:143-148 — before extracting anything, compare `Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift` and `Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieHeaders.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 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. 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) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:145 — Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:145-150 | Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieImporter.swift:75-80 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:145` 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 (6 lines × 2) Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:51 — Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:51-56 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:70-75 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:51` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:405 — Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:405-410 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:830-835 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleSECTokenResolver.swift:110 — Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleSECTokenResolver.swift:110-115 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleSECTokenResolver.swift:204-209 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/CodexManagedAccounts.swift:48 — Sources/CodexBarCore/CodexManagedAccounts.swift:48-53 | Sources/CodexBarCore/Providers/Codex/CodexOpenAIWorkspaceResolver.swift:19-24 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/CodexManagedAccounts.swift:55 — Sources/CodexBarCore/CodexManagedAccounts.swift:55-60 | Sources/CodexBarCore/Providers/Codex/CodexOpenAIWorkspaceResolver.swift:98-103 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/PiSessionCostCache.swift:14 — Sources/CodexBarCore/PiSessionCostCache.swift:14-19 | Sources/CodexBarCore/Providers/Muse/MuseLocalUsageCache.swift:136-141 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:315 — Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:315-320 | Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:653-659 — 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.
  • + 13 more in this group — see findings.md.
D3 · God Classes · TooManyMethods · ×36
  • TooManyMethods: UsageStore Sources/CodexBar/UsageStore.swift:121 — TooManyMethods — 833 methods, declared across 85 files: CodexBar/UsageStore+OpenAIWeb.swift (62), CodexBar/UsageStore+PlanUtilization.swift (62), CodexBar/UsageStore+TokenAccounts.swift (53), CodexBar/UsageStore+TokenCost.swift (51), +81 more file(s). The bar is 30 methods; this is 803 over it, 27.77× 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: StatusItemController Sources/CodexBar/StatusItemController.swift:41 — TooManyMethods — 595 methods, declared across 64 files: CodexBar/StatusItemController+Actions.swift (67), CodexBar/StatusItemController+Animation.swift (62), CodexBar/StatusItemController+Menu.swift (53), CodexBar/StatusItemController+MenuTracking.swift (45), +60 more file(s). The bar is 30 methods; this is 565 over it, 19.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: SettingsStore Sources/CodexBar/SettingsStore.swift:244 — TooManyMethods — 244 methods, declared across 37 files: CodexBar/SettingsStore.swift (48), Codex/CodexSettingsStore.swift (25), CodexBar/SettingsStore+Config.swift (25), CodexBar/SettingsStore+Defaults.swift (25), +33 more file(s). The bar is 30 methods; this is 214 over it, 8.13× 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: Model Sources/CodexBar/CostHistoryChartMenuView.swift:427 — TooManyMethods — 157 methods, declared across 13 files: CodexBar/MenuCardView+ModelHelpers.swift (63), CodexBar/InlineUsageDashboardContent.swift (28), CodexBar/MenuCardView+Costs.swift (25), CodexBar/MenuCardView.swift (17), +9 more file(s). The bar is 30 methods; this is 127 over it, 5.23× 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: OpenAIDashboardFetcher Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:6 — TooManyMethods — 72 methods, declared across 4 files: OpenAIWeb/OpenAIDashboardFetcher.swift (55), OpenAIWeb/OpenAIDashboardFetcher+ReturnableData.swift (9), OpenAIWeb/OpenAIDashboardFetcher+PageScrape.swift (5), OpenAIWeb/OpenAIDashboardFetcher+SessionAuthorization.swift (3). The bar is 30 methods; this is 42 over it, 2.40× 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: ClaudeStatusProbe Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:76 — TooManyMethods — 70 methods. The bar is 30 methods; this is 40 over it, 2.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ProviderSwitcherView Sources/CodexBar/StatusItemController+SwitcherViews.swift:10 — TooManyMethods — 68 methods, declared across 2 files: CodexBar/StatusItemController+SwitcherViews.swift (67), CodexBar/StatusItemController+UserPlugins.swift (1). The bar is 30 methods; this is 38 over it, 2.27× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. 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: AntigravityStatusProbe Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:831 — TooManyMethods — 67 methods, declared across 6 files: Antigravity/AntigravityStatusProbe.swift (49), Antigravity/AntigravityQuotaSummaryParser.swift (6), Antigravity/AntigravityStatusProbe+PortDetection.swift (6), Antigravity/AntigravityStatusProbe+Deadline.swift (3), +2 more file(s). The bar is 30 methods; this is 37 over it, 2.23× 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: CostHistoryChartMenuView Sources/CodexBar/CostHistoryChartMenuView.swift:6 — TooManyMethods — 66 methods. The bar is 30 methods; this is 36 over it, 2.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: CloudSyncEngine Sources/CodexBar/Sync/CloudSyncEngine.swift:432 — TooManyMethods — 59 methods. The bar is 30 methods; this is 29 over it, 1.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: SpendDashboardModel Sources/CodexBar/SpendDashboardModel.swift:22 — TooManyMethods — 57 methods, declared across 2 files: CodexBar/SpendDashboardModel.swift (47), CodexBar/SpendDashboardModel+ModelBreakdown.swift (10). The bar is 30 methods; this is 27 over it, 1.90× 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: CostUsageFetcher Sources/CodexBarCore/CostUsageFetcher.swift:31 — TooManyMethods — 54 methods, declared across 4 files: CodexBarCore/CostUsageFetcher.swift (50), CodexBarCore/CostUsageFetcher+Projectless.swift (2), Antigravity/AntigravityLocalScan.swift (1), Muse/CostUsageFetcher+Muse.swift (1). The bar is 30 methods; this is 24 over it, 1.80× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ProvidersPane Sources/CodexBar/PreferencesProvidersPane.swift:16 — TooManyMethods — 48 methods, declared across 2 files: CodexBar/PreferencesProvidersPane.swift (34), CodexBar/PreferencesProvidersPane+Testing.swift (14). The bar is 30 methods; this is 18 over it, 1.60× 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: AlibabaTokenPlanUsageFetcher Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:35 — TooManyMethods — 48 methods. The bar is 30 methods; this is 18 over it, 1.60× 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: MenuBarLayoutRenderer Sources/CodexBar/MenuBarLayoutRenderer.swift:303 — 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: ProviderSettingsSnapshot Sources/CodexBarCore/Providers/ProviderSettingsSnapshot.swift:10 — TooManyMethods — 46 methods, declared across 41 files: Providers/ProviderSettingsSnapshot.swift (5), Alibaba/AlibabaProviderSettings.swift (2), Abacus/AbacusProviderSettings.swift (1), Amp/AmpProviderSettings.swift (1), +37 more file(s). The bar is 30 methods; this is 16 over it, 1.53× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SpawnedProcessGroup Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:19 — TooManyMethods — 44 methods. The bar is 30 methods; this is 14 over it, 1.47× 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: GeminiStatusProbe Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:177 — TooManyMethods — 43 methods, declared across 2 files: Gemini/GeminiStatusProbe.swift (36), Gemini/GeminiStatusProbe+DataLoader.swift (7). The bar is 30 methods; this is 13 over it, 1.43× 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: KiloUsageFetcher Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:200 — TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ProviderSettingsSnapshotContribution Sources/CodexBarCore/Providers/ProviderSettingsSnapshot.swift:62 — TooManyMethods — 42 methods, declared across 40 files: Alibaba/AlibabaProviderSettings.swift (2), Providers/ProviderSettingsSnapshot.swift (2), Abacus/AbacusProviderSettings.swift (1), Amp/AmpProviderSettings.swift (1), +36 more file(s). The bar is 30 methods; this is 12 over it, 1.40× 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: ClaudeUsageFetcher Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:108 — TooManyMethods — 41 methods, declared across 2 files: Claude/ClaudeUsageFetcher.swift (38), Claude/ClaudeUsageFetcher+DelegatedRefreshMessages.swift (3). The bar is 30 methods; this is 11 over it, 1.37× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: PlanUtilizationHistoryChartMenuView Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:5 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: CursorStatusProbe Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:722 — TooManyMethods — 40 methods, declared across 7 files: Cursor/CursorStatusProbe.swift (22), Cursor/CursorStatusProbe+SessionResolution.swift (7), Cursor/CursorStatusProbe+AppAuth.swift (4), Cursor/CursorInteractiveLoginBrowser.swift (3), +3 more file(s). The bar is 30 methods; this is 10 over it, 1.33× 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: QuickJSProviderPluginEngine Sources/CodexBarCore/Plugins/QuickJSProviderPluginEngine.swift:197 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: KiroStatusProbe Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:302 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • + 11 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×35
  • Duplicated block (7 lines × 2) Sources/CodexBar/CostHistoryChartMenuView.swift:571 — Sources/CodexBar/CostHistoryChartMenuView.swift:571-577 | Sources/CodexBarCLI/CLICostCommand.swift:555-561 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/CostHistoryChartMenuView.swift:571` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Sources/CodexBar/CreditsHistoryChartMenuView.swift:154 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:154-160 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:231-237 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 2) Sources/CodexBar/MenuDescriptor+ProviderUsage.swift:45 — Sources/CodexBar/MenuDescriptor+ProviderUsage.swift:45-51 | Sources/CodexBar/MenuDescriptor+ProviderUsage.swift:53-59 — both copies are in the same file, so extract the 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 (7 lines × 2) Sources/CodexBar/PreferencesProvidersPane.swift:199 — Sources/CodexBar/PreferencesProvidersPane.swift:199-205 | Sources/CodexBar/PreferencesSidebar.swift:170-176 — 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 (7 lines × 2) Sources/CodexBar/SessionQuotaNotifications.swift:574 — Sources/CodexBar/SessionQuotaNotifications.swift:574-580 | Sources/CodexBar/SessionQuotaNotifications.swift:604-610 — both copies are in the same file, so extract the 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 (7 lines × 2) Sources/CodexBar/ShareStatsPayload.swift:287 — Sources/CodexBar/ShareStatsPayload.swift:287-293 | Sources/CodexBar/SpendDashboardModel+ModelBreakdown.swift:112-118 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/ShareStatsPayload.swift:287` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) Sources/CodexBar/StatusItemController+CompactAccountMenu.swift:193 — Sources/CodexBar/StatusItemController+CompactAccountMenu.swift:193-199 | Sources/CodexBar/StatusItemController+Menu.swift:766-772 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) Sources/CodexBar/StatusItemController+Menu.swift:1467 — Sources/CodexBar/StatusItemController+Menu.swift:1467-1473 | Sources/CodexBar/StatusItemController+Menu.swift:1478-1484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/StatusItemController+Menu.swift:1467` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/BrowserCookieAccessGate.swift:125 — Sources/CodexBarCore/BrowserCookieAccessGate.swift:125-131 | Sources/CodexBarCore/BrowserCookieAccessGate.swift:136-142 — both copies are in the same file, so extract the 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 (7 lines × 2) Sources/CodexBarCore/CostUsageModels.swift:776 — Sources/CodexBarCore/CostUsageModels.swift:776-782 | Sources/CodexBarCore/CostUsageModels.swift:1418-1424 — both copies are in the same file, so extract the 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 (7 lines × 2) Sources/CodexBarCore/CostUsageModels.swift:1147 — Sources/CodexBarCore/CostUsageModels.swift:1147-1153 | Sources/CodexBarCore/CostUsageModels.swift:1179-1185 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CostUsageModels.swift:1147` 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:1152 — Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:1152-1158 | Sources/CodexBarCore/Providers/ProviderVersionDetector.swift:62-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:622 — Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:622-628 | Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:643-649 — both copies are in the same file, so extract the 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 (7 lines × 2) Sources/CodexBarCore/ManagedCodexAccountStore.swift:107 — Sources/CodexBarCore/ManagedCodexAccountStore.swift:107-113 | Sources/CodexBarCore/Providers/Codex/CodexOpenAIWorkspaceIdentityCache.swift:49-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:799 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:799-805 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:808-814 — both copies are in the same file, so extract the 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 (7 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:363 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:363-369 | Sources/CodexBarCore/Providers/Codex/CodexStatusProbe.swift:175-181 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:363` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanCookieImporter.swift:50 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanCookieImporter.swift:50-56 | Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieImporter.swift:65-71 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanCookieImporter.swift:50` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:474 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:474-480 | Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:483-489 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:470` calls `apiError` and `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:480` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:165 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:165-171 | Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:558-564 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:165` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:487 — Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:487-493 | Sources/CodexBarCore/Providers/Kimi/KimiAPIError.swift:26-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:487` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:214 — Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:214-220 | Sources/CodexBarCore/Providers/Groq/GroqConsoleUsageSnapshot.swift:129-135 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:191 — Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:191-197 | Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift:105-114 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:191` 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) Sources/CodexBarCore/Providers/CommandCode/CommandCodeCookieHeader.swift:61 — Sources/CodexBarCore/Providers/CommandCode/CommandCodeCookieHeader.swift:61-67 | Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieHeader.swift:69-75 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/CommandCode/CommandCodeCookieHeader.swift:61` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Cursor/CursorAppAuth.swift:328 — Sources/CodexBarCore/Providers/Cursor/CursorAppAuth.swift:328-334 | Sources/CodexBarCore/Providers/Windsurf/WindsurfStatusProbe.swift:119-125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Cursor/CursorAppAuth.swift:328` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:125 — Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:125-131 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:84-91 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:125` 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.
  • + 10 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×35
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/AppGroupSupport.swift:173 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/CodexLaunchPreflight+SignatureIdentity.swift:20 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/CopilotUsageModels.swift:258 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/PathEnvironment.swift:690 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/PiFamilySessionScanner.swift:96 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/PiProcessEnvironment.swift:68 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/PiSessionCostScanner.swift:706 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/PiSessionCostScanner.swift:986 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/WidgetSnapshot.swift:276 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/ProviderVersionDetector.swift:102 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/ProviderVersionDetector.swift:115 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/ProviderVersionDetector.swift:129 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieImporter.swift:159 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieImporter.swift:168 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift:285 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoZenBalanceFetcher.swift:52 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/OpenCode/OpenCodeCookieImporter.swift:80 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/Nous/NousProviderDescriptor.swift:62 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/Mistral/MistralCookieImporter.swift:106 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/MiniMax/MiniMaxCookieImporter.swift:91 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/Kimi/KimiCookieImporter.swift:135 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/Kimi/KimiDesktopAuthToken.swift:48 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/Kimi/KimiDesktopAuthToken.swift:51 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/Kimi/KimiModels.swift:27 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) Sources/CodexBarCore/Providers/Grok/GrokCLISettingsFetcher.swift:41 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • + 10 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×31
  • Duplicated block (8 lines × 2) Sources/CodexBar/MenuBarLayout.swift:1223 — Sources/CodexBar/MenuBarLayout.swift:1223-1230 | Sources/CodexBar/MenuBarLayout.swift:1397-1404 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/MenuBarLayout.swift:1223` 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 (8 lines × 2) Sources/CodexBar/MenuCardView.swift:1270 — Sources/CodexBar/MenuCardView.swift:1270-1277 | Sources/CodexBar/MenuCardView.swift:1485-1492 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/MenuCardView.swift:1270` 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) Sources/CodexBar/ShareStatsCardView.swift:268 — Sources/CodexBar/ShareStatsCardView.swift:268-275 | Sources/CodexBar/ShareStatsCardView.swift:321-328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/ShareStatsCardView.swift:268` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBar/ShareStatsCardView.swift:319` calls `minimumScaleFactor` and `Sources/CodexBar/ShareStatsCardView.swift:266` 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 (8 lines × 2) Sources/CodexBar/SpendSessionPerformanceView.swift:216 — Sources/CodexBar/SpendSessionPerformanceView.swift:216-223 | Sources/CodexBar/SpendSessionPerformanceView.swift:275-282 — both copies are in the same file, so extract the 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) Sources/CodexBar/StatusItemController+HostedSubmenus.swift:382 — Sources/CodexBar/StatusItemController+HostedSubmenus.swift:382-389 | Sources/CodexBar/StatusItemController+HostedSubmenus.swift:409-416 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) Sources/CodexBar/UsageStore+Refresh.swift:120 — Sources/CodexBar/UsageStore+Refresh.swift:120-127 | Sources/CodexBar/UsageStore+Refresh.swift:141-148 — both copies are in the same file, so extract the 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) Sources/CodexBar/UsageStore+TokenAccounts.swift:1212 — Sources/CodexBar/UsageStore+TokenAccounts.swift:1212-1219 | Sources/CodexBar/UsageStore+TokenAccounts.swift:1477-1484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/UsageStore+TokenAccounts.swift:1212` 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) Sources/CodexBarCLI/CLIGuardCommand.swift:246 — Sources/CodexBarCLI/CLIGuardCommand.swift:246-254 | Sources/CodexBarCLI/CLIHooksWatchCommand.swift:150-157 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (8 lines × 2) Sources/CodexBarCLI/CLIIO.swift:98 — Sources/CodexBarCLI/CLIIO.swift:98-105 | Sources/CodexBarCore/PathEnvironment.swift:1334-1341 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCLI/CLIIO.swift:98` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) Sources/CodexBarCLI/CLIRenderer.swift:149 — Sources/CodexBarCLI/CLIRenderer.swift:149-156 | Sources/CodexBarCLI/CLIRenderer.swift:1048-1059 — both copies are in the same file, so extract the 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 (8 lines × 2) Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:621 — Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:621-628 | Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:657-664 — both copies are in the same file, so extract the 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) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:777 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:777-784 | Sources/CodexBarCore/UsageFetcher.swift:1304-1311 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) Sources/CodexBarCore/ProviderEndpointOverrideValidator.swift:102 — Sources/CodexBarCore/ProviderEndpointOverrideValidator.swift:102-109 | Sources/CodexBarCore/ProviderEndpointOverrideValidator.swift:235-242 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:458 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:458-465 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:787-794 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:458` 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) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:238 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:238-245 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:448-455 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:238` 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, `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:246` calls `error` and `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:456` 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 (8 lines × 2) Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:974 — Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:974-981 | Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:997-1004 — both copies are in the same file, so extract the 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) Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:312 — Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:312-319 | Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:232-239 — before extracting anything, compare `Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift` and `Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:312` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:979 — Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:979-986 | Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:994-1001 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:979` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) Sources/CodexBarCore/Providers/Codebuff/CodebuffSettingsReader.swift:31 — Sources/CodexBarCore/Providers/Codebuff/CodebuffSettingsReader.swift:31-38 | Sources/CodexBarCore/Providers/Kilo/KiloSettingsReader.swift:15-22 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) Sources/CodexBarCore/Providers/Codex/CodexReconciledState.swift:43 — Sources/CodexBarCore/Providers/Codex/CodexReconciledState.swift:43-50 | Sources/CodexBarCore/Providers/Codex/CodexReconciledState.swift:58-65 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexReconciledState.swift:43` 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 (8 lines × 2) Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:839 — Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:839-846 | Sources/CodexBarCore/Providers/Warp/WarpUsageFetcher.swift:390-397 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:839` 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) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:444 — Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:444-451 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:494-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:444` 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) Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIProviderDescriptor.swift:49 — Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIProviderDescriptor.swift:49-56 | Sources/CodexBarCore/Providers/OpenRouter/OpenRouterProviderDescriptor.swift:74-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIProviderDescriptor.swift:49` 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 (8 lines × 2) Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:231 — Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:231-238 | Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:248-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:231` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Sources/CodexBarCore/ProviderHTTPClient.swift:237 — Sources/CodexBarCore/ProviderHTTPClient.swift:237-246 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleCookieRouting.swift:115-122 — 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.
  • + 6 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×25
  • Duplicated block (10 lines × 2) Sources/CodexBar/CodexOwnershipContext.swift:59 — Sources/CodexBar/CodexOwnershipContext.swift:59-68 | Sources/CodexBar/CodexOwnershipContext.swift:90-99 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/CodexOwnershipContext.swift:59` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) Sources/CodexBar/CreditsHistoryChartMenuView.swift:274 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:274-283 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:404-413 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 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 `Sources/CodexBar/CreditsHistoryChartMenuView.swift:274` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Sources/CodexBar/IconRenderer.swift:246 — Sources/CodexBar/IconRenderer.swift:246-255 | Sources/CodexBar/IconRenderer.swift:347-356 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/IconRenderer.swift:246` 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 (10 lines × 2) Sources/CodexBar/IconRenderer.swift:563 — Sources/CodexBar/IconRenderer.swift:563-572 | Sources/CodexBar/IconRenderer.swift:576-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 (10 lines × 2) Sources/CodexBar/ProviderSwitcherButtons.swift:98 — Sources/CodexBar/ProviderSwitcherButtons.swift:98-107 | Sources/CodexBar/ProviderSwitcherButtons.swift:222-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/ProviderSwitcherButtons.swift:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Sources/CodexBar/SettingsStore+TokenAccounts.swift:300 — Sources/CodexBar/SettingsStore+TokenAccounts.swift:300-309 | Sources/CodexBar/SettingsStore+TokenAccounts.swift:330-339 — both copies are in the same file, so extract the 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 (10 lines × 2) Sources/CodexBarCLI/CLICostCommand.swift:1096 — Sources/CodexBarCLI/CLICostCommand.swift:1096-1105 | Sources/CodexBarCLI/CLICostCommand.swift:1226-1235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCLI/CLICostCommand.swift:1096` 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 (10 lines × 2) Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:1148 — Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:1148-1157 | Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:1168-1177 — both copies are in the same file, so extract the 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 (10 lines × 2) Sources/CodexBarCore/Config/CodexBarConfig.swift:347 — Sources/CodexBarCore/Config/CodexBarConfig.swift:347-356 | Sources/CodexBarCore/TokenAccounts.swift:63-72 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:161 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:161-170 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:187-196 — 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) Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:1177 — Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:1177-1186 | Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:1252-1261 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:45 — Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:45-54 | Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:32-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:45` 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 (10 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:605 — Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:605-614 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:627-636 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) Sources/CodexBarCore/Providers/Codebuff/CodebuffProviderDescriptor.swift:52 — Sources/CodexBarCore/Providers/Codebuff/CodebuffProviderDescriptor.swift:52-61 | Sources/CodexBarCore/Providers/Wayfinder/WayfinderProviderDescriptor.swift:36-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codebuff/CodebuffProviderDescriptor.swift:52` 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 (10 lines × 2) Sources/CodexBarCore/Providers/Codex/CodexPAT/CodexPATFetchStrategy.swift:137 — Sources/CodexBarCore/Providers/Codex/CodexPAT/CodexPATFetchStrategy.swift:137-146 | Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift:534-543 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexPAT/CodexPATFetchStrategy.swift:137` 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 (10 lines × 2) Sources/CodexBarCore/Providers/Cursor/CursorProviderDescriptor.swift:68 — Sources/CodexBarCore/Providers/Cursor/CursorProviderDescriptor.swift:68-77 | Sources/CodexBarCore/Providers/Mistral/MistralProviderDescriptor.swift:40-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Cursor/CursorProviderDescriptor.swift:68` 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 (10 lines × 2) Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:890 — Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:890-899 | Sources/CodexBarCore/Providers/Warp/WarpUsageFetcher.swift:429-438 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10 lines × 2) Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift:45 — Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift:45-54 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:37-46 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift:45` 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 (10 lines × 2) Sources/CodexBarCore/Providers/Grok/GrokCLISettingsFetcher.swift:26 — Sources/CodexBarCore/Providers/Grok/GrokCLISettingsFetcher.swift:26-35 | Sources/CodexBarCore/Providers/Grok/GrokCreditsProxyFetcher.swift:23-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Grok/GrokCLISettingsFetcher.swift:26` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:44 — Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:44-53 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieHeaders.swift:96-105 — before extracting anything, compare `Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift` and `Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieHeaders.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:44` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageSnapshot+Metadata.swift:11 — Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageSnapshot+Metadata.swift:11-20 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageSnapshot+Metadata.swift:28-37 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageSnapshot.swift:123 — Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageSnapshot.swift:123-132 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageSnapshot.swift:152-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageSnapshot.swift:123` 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 (10 lines × 2) Sources/CodexBarCore/Providers/Replicate/ReplicateWebFetchStrategy.swift:72 — Sources/CodexBarCore/Providers/Replicate/ReplicateWebFetchStrategy.swift:72-81 | Sources/CodexBarCore/Providers/TypeSafe/TypeSafeWebFetchStrategy.swift:91-100 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Replicate/ReplicateWebFetchStrategy.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.
  • Duplicated block (10 lines × 2) Sources/CodexBarWidget/BurnDownWidgetViews.swift:116 — Sources/CodexBarWidget/BurnDownWidgetViews.swift:116-125 | Sources/CodexBarWidget/CombinedBurnDownWidgetViews.swift:66-75 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarWidget/BurnDownWidgetViews.swift:115` calls `VStack` and `Sources/CodexBarWidget/CombinedBurnDownWidgetViews.swift:65` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) Sources/CodexBarCore/Providers/Venice/VeniceSettingsReader.swift:7 — Sources/CodexBarCore/Providers/Venice/VeniceSettingsReader.swift:7-16 | Sources/CodexBarCore/Providers/Warp/WarpSettingsReader.swift:9-18 — 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 (13 lines × 2) · ×24
  • Duplicated block (13 lines × 2) Sources/CodexBar/CreditsHistoryChartMenuView.swift:260 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:260-272 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:390-402 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 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 `Sources/CodexBar/CreditsHistoryChartMenuView.swift:260` 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) Sources/CodexBar/IconRenderer.swift:373 — Sources/CodexBar/IconRenderer.swift:373-385 | Sources/CodexBar/IconRenderer.swift:512-524 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/IconRenderer.swift:373` 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 before the matched lines, `Sources/CodexBar/IconRenderer.swift:367` calls `NSBezierPath`, `fill` and `Sources/CodexBar/IconRenderer.swift:508` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (13 lines × 2) Sources/CodexBar/MenuDescriptor.swift:236 — Sources/CodexBar/MenuDescriptor.swift:236-248 | Sources/CodexBarCLI/CLISessionsCommand.swift:87-99 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) Sources/CodexBar/Providers/Devin/DevinProviderImplementation.swift:102 — Sources/CodexBar/Providers/Devin/DevinProviderImplementation.swift:102-114 | Sources/CodexBar/Providers/Factory/FactoryProviderImplementation.swift:119-131 — 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 (13 lines × 2) Sources/CodexBar/Providers/Doubao/DoubaoProviderImplementation.swift:25 — Sources/CodexBar/Providers/Doubao/DoubaoProviderImplementation.swift:25-37 | Sources/CodexBar/Providers/Ollama/OllamaProviderImplementation.swift:115-127 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Doubao/DoubaoProviderImplementation.swift:25` 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) Sources/CodexBar/SpendDashboardModel.swift:95 — Sources/CodexBar/SpendDashboardModel.swift:95-107 | Sources/CodexBarCore/Providers/ProviderFetchPlan.swift:171-183 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/SpendDashboardModel.swift:95` 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) Sources/CodexBarCLI/CLIPayloads.swift:46 — Sources/CodexBarCLI/CLIPayloads.swift:46-58 | Sources/CodexBarCLI/CLIPayloads.swift:77-89 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCLI/CLIPayloads.swift:46` 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) Sources/CodexBarCLI/CLIServeCommand.swift:395 — Sources/CodexBarCLI/CLIServeCommand.swift:395-407 | Sources/CodexBarCLI/CLIServeCommand.swift:488-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 `Sources/CodexBarCLI/CLIServeCommand.swift:395` 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) Sources/CodexBarCore/CookieHeaderCache.swift:678 — Sources/CodexBarCore/CookieHeaderCache.swift:678-690 | Sources/CodexBarCore/CookieHeaderCache.swift:740-752 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) Sources/CodexBarCore/CostUsageModels.swift:123 — Sources/CodexBarCore/CostUsageModels.swift:123-135 | Sources/CodexBarCore/CostUsageModels.swift:149-161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) Sources/CodexBarCore/ProviderStorageFootprint.swift:214 — Sources/CodexBarCore/ProviderStorageFootprint.swift:214-226 | Sources/CodexBarCore/ProviderStorageFootprint.swift:242-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:270 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:270-282 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:196-208 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:270` 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) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:184 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:184-196 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:599-611 — 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 (13 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:56 — Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:56-68 | Sources/CodexBarCore/Providers/Codex/CodexProviderSettings.swift:26-38 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:56` 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) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:376 — Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:376-388 | Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:398-410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:13 — Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:13-25 | Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIProviderDescriptor.swift:31-43 — 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 (13 lines × 2) Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:91 — Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:91-103 | Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:182-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:91` 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) Sources/CodexBarCore/Providers/Codex/CodexProviderSettings.swift:27 — Sources/CodexBarCore/Providers/Codex/CodexProviderSettings.swift:27-39 | TestsPlugin/ManusReference.swift:30-42 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexProviderSettings.swift:27` 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) Sources/CodexBarCore/Providers/CommandCode/CommandCodeProviderDescriptor.swift:39 — Sources/CodexBarCore/Providers/CommandCode/CommandCodeProviderDescriptor.swift:39-51 | Sources/CodexBarCore/Providers/Doubao/DoubaoProviderDescriptor.swift:65-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/CommandCode/CommandCodeProviderDescriptor.swift:39` 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) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekProviderDescriptor.swift:76 — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekProviderDescriptor.swift:76-88 | Sources/CodexBarCore/Providers/Pi/PiProviderDescriptor.swift:10-22 — 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 (13 lines × 2) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:430 — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:430-442 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:451-463 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:430` 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 (13 lines × 2) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1272 — Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1272-1284 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1341-1353 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1272` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1354` calls `setValue` and `Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1286` 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 (13 lines × 2) Sources/CodexBarCore/Providers/LongCat/LongCatProviderDescriptor.swift:17 — Sources/CodexBarCore/Providers/LongCat/LongCatProviderDescriptor.swift:17-29 | Sources/CodexBarCore/Providers/Warp/WarpProviderDescriptor.swift:16-28 — before extracting anything, compare `Sources/CodexBarCore/Providers/LongCat/LongCatProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/Warp/WarpProviderDescriptor.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 49 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 (13 lines × 2) Sources/CodexBarCore/Providers/MiMo/MiMoProviderDescriptor.swift:14 — Sources/CodexBarCore/Providers/MiMo/MiMoProviderDescriptor.swift:14-26 | Sources/CodexBarCore/Providers/ZoomMate/ZoomMateProviderDescriptor.swift:13-25 — 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.
D35 · Change Coupling · Change coupling · ×20
  • Change coupling: StatusItemController+Actions.swift ↔ StatusItemController+PersistentMenuActions.swift Sources/CodexBar/StatusItemController+Actions.swift:1 — `Sources/CodexBar/StatusItemController+Actions.swift` and `Sources/CodexBar/StatusItemController+PersistentMenuActions.swift` 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). 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 8 shared commits counted here, the most recent 3 are `e9da0796` feat: add first-class plugin switcher tabs (#3516); `dbfd1959` Fix stranded menu scroll after a manual refresh clears a provider err…; `e3c2adeb` fix: scope provider refresh state (#1911) — run `git show` on any of them.
  • Change coupling: SettingsStore+MenuObservation.swift ↔ SettingsStoreState.swift Sources/CodexBar/SettingsStore+MenuObservation.swift:1 — `Sources/CodexBar/SettingsStore+MenuObservation.swift` and `Sources/CodexBar/SettingsStoreState.swift` change together 76% of the time (26 of the 34 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 26 shared commits counted here, the most recent 3 are `2f232d6f` Add color by provider setting and preference persistence; `39b17af0` Add spend provenance, pinned day timezone, and Codex fork fail-closed.; `afe28dd8` feat: add automatic low-power preference — run `git show` on any of them.
  • Change coupling: KeychainPromptCoordinator.swift ↔ SettingsStore.swift Sources/CodexBar/KeychainPromptCoordinator.swift:1 — `Sources/CodexBar/KeychainPromptCoordinator.swift` and `Sources/CodexBar/SettingsStore.swift` change together 70% of the time (7 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). 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 7 shared commits counted here, the most recent 3 are `dd54a28d` Add Chinese (Simplified) localization (#819); `8799099b` feat: add synthetic provider; `7c1d0a2b` wip — run `git show` on any of them.
  • Change coupling: MenuCardView.swift ↔ VertexAIProviderDescriptor.swift Sources/CodexBar/MenuCardView.swift:1 — `Sources/CodexBar/MenuCardView.swift` and `Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift` 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). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `6838b449` feat(vertex): add direct token cost tracking with _vrtx_ detection; `15dcdbb9` fix(vertex): disable direct token cost tracking to avoid double-counting; `5a04e57c` feat(vertexai): add token cost tracking for Vertex AI Claude usage — run `git show` on any of them.
  • Change coupling: ProviderTokenResolver.swift ↔ CodexBarWidgetProvider.swift Sources/CodexBarCore/Providers/ProviderTokenResolver.swift:1 — `Sources/CodexBarCore/Providers/ProviderTokenResolver.swift` and `Sources/CodexBarWidget/CodexBarWidgetProvider.swift` change together 62% of the time (16 of the 26 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 16 shared commits counted here, the most recent 3 are `479e1284` Add Neuralwatt provider; `3cb9d0d9` Add ClinePass usage provider; `87b11959` Add LiteLLM provider (#1542) — run `git show` on any of them.
  • Change coupling: ProviderTokenResolver.swift ↔ CodexBarWidgetViews.swift Sources/CodexBarCore/Providers/ProviderTokenResolver.swift:1 — `Sources/CodexBarCore/Providers/ProviderTokenResolver.swift` and `Sources/CodexBarWidget/CodexBarWidgetViews.swift` change together 62% of the time (16 of the 26 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 16 shared commits counted here, the most recent 3 are `479e1284` Add Neuralwatt provider; `3cb9d0d9` Add ClinePass usage provider; `87b11959` Add LiteLLM provider (#1542) — run `git show` on any of them.
  • Change coupling: StatusItemController+MenuReconcile.swift ↔ StatusItemController+MenuSmartUpdate.swift Sources/CodexBar/StatusItemController+MenuReconcile.swift:1 — `Sources/CodexBar/StatusItemController+MenuReconcile.swift` and `Sources/CodexBar/StatusItemController+MenuSmartUpdate.swift` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `cd49d30f` Swap SwiftUI payloads across menu tab switches instead of detaching v…; `6d467b6a` Warm sibling switcher tabs after menu open for flicker-free switches; `3adca574` Flush hosted menu rows synchronously during provider tab switches — run `git show` on any of them.
  • Change coupling: CLIConfigCommand.swift ↔ CLIHelp.swift Sources/CodexBarCLI/CLIConfigCommand.swift:1 — `Sources/CodexBarCLI/CLIConfigCommand.swift` and `Sources/CodexBarCLI/CLIHelp.swift` change together 60% of the time (6 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 `73040e26` fix(cli): accept all|both provider values in hooks watch; `e916f693` Add CLI command to persist provider source; `26dcc073` feat(settings): add portable preferences and switcher shortcuts — run `git show` on any of them.
  • Change coupling: PredictivePaceWarnings.swift ↔ UsageStore+Refresh.swift Sources/CodexBar/PredictivePaceWarnings.swift:1 — `Sources/CodexBar/PredictivePaceWarnings.swift` and `Sources/CodexBar/UsageStore+Refresh.swift` change together 58% of the time (7 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in 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 7 shared commits counted here, the most recent 3 are `0ada5de3` fix(claude): keep warnings for unresolved accounts (#3813); `cc244d70` fix(claude): preserve verified quota warning history (#3813); `a9dc8229` Scope quota warnings to accounts — run `git show` on any of them.
  • Change coupling: StatusItemController+Animation.swift ↔ StatusItemController+IconObservation.swift Sources/CodexBar/StatusItemController+Animation.swift:1 — `Sources/CodexBar/StatusItemController+Animation.swift` and `Sources/CodexBar/StatusItemController+IconObservation.swift` change together 58% of the time (11 of the 19 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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 11 shared commits counted here, the most recent 3 are `8de11fff` feat(sync): show iCloud fleet usage in the menu bar without a local l…; `c286d342` fix(plugins): retain selected quotas and support row severity (#4627); `b65a5eb3` fix(claude): hide the prepaid menu bar balance with optional credits — run `git show` on any of them.
  • Change coupling: ClaudeProviderImplementation.swift ↔ MiniMaxProviderImplementation.swift Sources/CodexBar/Providers/Claude/ClaudeProviderImplementation.swift:1 — `Sources/CodexBar/Providers/Claude/ClaudeProviderImplementation.swift` and `Sources/CodexBar/Providers/MiniMax/MiniMaxProviderImplementation.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 `1d7ae093` Memoize cookie cache lookups behind settings picker labels; `b327b14b` refactor: push menu and snapshot hooks to providers; `be6c18aa` refactor: move provider settings and token hooks — run `git show` on any of them.
  • Change coupling: CostUsageFetcher.swift ↔ VertexAIProviderDescriptor.swift Sources/CodexBarCore/CostUsageFetcher.swift:1 — `Sources/CodexBarCore/CostUsageFetcher.swift` and `Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.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 different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `6838b449` feat(vertex): add direct token cost tracking with _vrtx_ detection; `15dcdbb9` fix(vertex): disable direct token cost tracking to avoid double-counting; `5a04e57c` feat(vertexai): add token cost tracking for Vertex AI Claude usage — run `git show` on any of them.
  • Change coupling: UsageStore+CodexCostCatchUp.swift ↔ UsageStore+SpendDashboardCodexCostCatchUp.swift Sources/CodexBar/UsageStore+CodexCostCatchUp.swift:1 — `Sources/CodexBar/UsageStore+CodexCostCatchUp.swift` and `Sources/CodexBar/UsageStore+SpendDashboardCodexCostCatchUp.swift` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in 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 7 shared commits counted here, the most recent 3 are `411e4960` Fix empty Codex cost scan recovery and completed stalls; `c0915b58` fix(codex): continue automatic cost discovery in a bounded burst (#4237); `93762299` fix(codex): exclude queue waiting from catch-up delays — run `git show` on any of them.
  • Change coupling: PreferencesProvidersPane.swift ↔ SettingsStore+MenuPreferences.swift Sources/CodexBar/PreferencesProvidersPane.swift:1 — `Sources/CodexBar/PreferencesProvidersPane.swift` and `Sources/CodexBar/SettingsStore+MenuPreferences.swift` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in 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 7 shared commits counted here, the most recent 3 are `d71d92f8` feat: add combined Codex usage metric; `c7f38669` feat: show balance metrics for API-balance providers; `a6b03428` Add Cursor extra usage menu bar metric — run `git show` on any of them.
  • Change coupling: ProviderRegistry.swift ↔ OpenCodeProviderImplementation.swift Sources/CodexBar/ProviderRegistry.swift:1 — `Sources/CodexBar/ProviderRegistry.swift` and `Sources/CodexBar/Providers/OpenCode/OpenCodeProviderImplementation.swift` change together 54% of the time (7 of the 13 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `b327b14b` refactor: push menu and snapshot hooks to providers; `be6c18aa` refactor: move provider settings and token hooks; `be490316` fix: require manual cookies without keychain — run `git show` on any of them.
  • Change coupling: ManagedCodexAccountService.swift ↔ CodexAccountPromotionExecution.swift Sources/CodexBar/ManagedCodexAccountService.swift:1 — `Sources/CodexBar/ManagedCodexAccountService.swift` and `Sources/CodexBarCore/Providers/Codex/CodexAccountPromotionExecution.swift` change together 50% of the time (6 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `bcc4c567` feat(codex-accounts): log redacted registry mutations for account-los…; `79a43f74` fix(codex): retain shared managed homes through cleanup; `5e9bbaa3` fix(codex): guard managed home deletion when another record reference… — run `git show` on any of them.
  • Change coupling: CLICookieCommand.swift ↔ CLIHelp.swift Sources/CodexBarCLI/CLICookieCommand.swift:1 — `Sources/CodexBarCLI/CLICookieCommand.swift` and `Sources/CodexBarCLI/CLIHelp.swift` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `fb44dd67` fix: make cookie refresh non-destructive; `b9089b9a` fix: preserve scoped cookie caches during refresh; `aa7b3224` fix: gate CLI cookie refresh — run `git show` on any of them.
  • Change coupling: CLIDashboardCommand.swift ↔ CLIServeWebUI+HTML.swift Sources/CodexBarCLI/CLIDashboardCommand.swift:1 — `Sources/CodexBarCLI/CLIDashboardCommand.swift` and `Sources/CodexBarCLI/CLIServeWebUI+HTML.swift` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `d56adeae` Serve existing accounts with private dashboard defaults; `18dd6ffb` fix(serve): honor usage bar fill preference (#3670); `6ed9d98e` fix(claude): keep at-limit claude-swap cards complete (#3081) — run `git show` on any of them.
  • Change coupling: KeychainPromptCoordinator.swift ↔ PreferencesProvidersPane.swift Sources/CodexBar/KeychainPromptCoordinator.swift:1 — `Sources/CodexBar/KeychainPromptCoordinator.swift` and `Sources/CodexBar/PreferencesProvidersPane.swift` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `dd54a28d` Add Chinese (Simplified) localization (#819); `8799099b` feat: add synthetic provider; `c917fd0f` refactor: convert MiniMax from cookie-based to API token authentication — run `git show` on any of them.
  • Change coupling: ProviderRegistry.swift ↔ TokenAccountSupport.swift Sources/CodexBar/ProviderRegistry.swift:1 — `Sources/CodexBar/ProviderRegistry.swift` and `Sources/CodexBarCore/TokenAccountSupport.swift` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in 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 5 shared commits counted here, the most recent 3 are `aa8977ef` feat: add Claude Admin API usage source; `f8d7dc39` refactor: streamline provider registries and snapshots; `e680a09f` fix: tighten amp provider wiring (#167) (thanks @duailibe) — run `git show` on any of them.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×20
  • Duplicated block (11 lines × 2) Sources/CodexBar/CodexAccountSwitcherView.swift:199 — Sources/CodexBar/CodexAccountSwitcherView.swift:199-209 | Sources/CodexBar/CodexAccountSwitcherView.swift:225-235 — both copies are in the same file, so extract the 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 (11 lines × 2) Sources/CodexBar/CostHistoryChartMenuView.swift:198 — Sources/CodexBar/CostHistoryChartMenuView.swift:198-208 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:93-103 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/CostHistoryChartMenuView.swift:198` 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) Sources/CodexBar/ProviderSwitcherButtons.swift:81 — Sources/CodexBar/ProviderSwitcherButtons.swift:81-91 | Sources/CodexBar/ProviderSwitcherButtons.swift:205-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:358 — Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:358-368 | Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:379-389 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:358` 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) Sources/CodexBar/Providers/OpenCodeGo/OpenCodeGoProviderImplementation.swift:88 — Sources/CodexBar/Providers/OpenCodeGo/OpenCodeGoProviderImplementation.swift:88-98 | Sources/CodexBar/Providers/OpenRouter/OpenRouterProviderImplementation.swift:41-51 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/OpenCodeGo/OpenCodeGoProviderImplementation.swift:88` 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) Sources/CodexBar/StatusItemController+MenuViewportRestore.swift:266 — Sources/CodexBar/StatusItemController+MenuViewportRestore.swift:266-276 | Sources/CodexBar/StatusItemController+MenuViewportRestore.swift:316-326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/StatusItemController+MenuViewportRestore.swift:266` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) Sources/CodexBarCore/CookieHeaderCache.swift:292 — Sources/CodexBarCore/CookieHeaderCache.swift:292-302 | Sources/CodexBarCore/CookieHeaderCache.swift:951-961 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CookieHeaderCache.swift:292` 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 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 (11 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1097 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1097-1107 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1122-1132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1097` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:167 — Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:167-177 | Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:196-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.
  • Duplicated block (11 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:513 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:513-523 | Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:548-558 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:513` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:502 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:502-512 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudTokenPlanAPIClient.swift:91-101 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:502` 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) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:207 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:207-217 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:620-630 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:207` 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 (11 lines × 2) Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:43 — Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:43-53 | Sources/CodexBarCore/Providers/Codebuff/CodebuffProviderDescriptor.swift:50-60 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:43` 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) Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:414 — Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:414-424 | Sources/CodexBarCore/Providers/Codex/CodexPAT/CodexPATUsageFetcher.swift:89-99 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.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.
  • Duplicated block (11 lines × 2) Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:600 — Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:600-610 | Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:615-625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:600` 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) Sources/CodexBarCore/Providers/CommandCode/CommandCodeUsageFetcher.swift:50 — Sources/CodexBarCore/Providers/CommandCode/CommandCodeUsageFetcher.swift:50-60 | Sources/CodexBarCore/Providers/CommandCode/CommandCodeUsageFetcher.swift:62-72 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageError.swift:10 — Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageError.swift:10-20 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:13-23 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift:132 — Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift:132-142 | Sources/CodexBarCore/Providers/ZoomMate/ZoomMateProviderDescriptor.swift:77-87 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift:132` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:98 — Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:98-108 | Sources/CodexBarCore/Providers/Codex/CodexStatusProbe.swift:72-82 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift:98 — Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift:98-108 | Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieImporter.swift:161-171 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift:110` calls `invalidateImportSessionCache`, `invalidate` and `Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieImporter.swift:173` 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 (12 lines × 2) · ×19
  • Duplicated block (12 lines × 2) Sources/CodexBar/SpendDashboardModel.swift:1166 — Sources/CodexBar/SpendDashboardModel.swift:1166-1177 | Sources/CodexBar/SpendDashboardModel.swift:1599-1610 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/SpendDashboardModel.swift:1166` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) Sources/CodexBar/UsageStore+TokenAccounts.swift:459 — Sources/CodexBar/UsageStore+TokenAccounts.swift:459-470 | Sources/CodexBar/UsageStore+TokenAccounts.swift:1093-1104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/UsageStore+TokenAccounts.swift:459` 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 (12 lines × 2) Sources/CodexBarCLI/CLICardsRenderer.swift:61 — Sources/CodexBarCLI/CLICardsRenderer.swift:61-72 | Sources/CodexBarCore/ProviderAccountSnapshot.swift:56-67 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCLI/CLICardsRenderer.swift:61` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) Sources/CodexBarCLI/CLIServeCommand.swift:899 — Sources/CodexBarCLI/CLIServeCommand.swift:899-910 | Sources/CodexBarCLI/CLIServeCommand.swift:936-947 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCLI/CLIServeCommand.swift:899` 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) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:235 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:235-246 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:253-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:235` 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 (12 lines × 2) Sources/CodexBarCore/PiFamilySessionScanner.swift:1011 — Sources/CodexBarCore/PiFamilySessionScanner.swift:1011-1022 | Sources/CodexBarCore/PiFamilySessionScanner.swift:1023-1034 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/PiFamilySessionScanner.swift:1011` 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) Sources/CodexBarCore/PiSessionCostScanner.swift:1164 — Sources/CodexBarCore/PiSessionCostScanner.swift:1164-1175 | Sources/CodexBarCore/PiSessionCostScanner.swift:1193-1204 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/PiSessionCostScanner.swift:1164` 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 (12 lines × 2) Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:223 — Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:223-234 | Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:679-690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:223` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:255 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:255-266 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:181-192 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:255` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:16 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:16-27 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudUsageFetcher.swift:13-24 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:16` 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 (12 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:1099 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:1099-1110 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleJSON.swift:217-228 — 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) Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:22 — Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:22-33 | Sources/CodexBarCore/Providers/Ollama/OllamaProviderDescriptor.swift:32-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:22` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:372 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:372-383 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:736-747 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:372` 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) Sources/CodexBarCore/Providers/Amp/AmpUsageSnapshot.swift:35 — Sources/CodexBarCore/Providers/Amp/AmpUsageSnapshot.swift:35-46 | Sources/CodexBarCore/Providers/Cursor/CursorUsageEventsFetcher.swift:115-126 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpUsageSnapshot.swift:35` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountList.swift:150 — Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountList.swift:150-161 | Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountSwitch.swift:27-38 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountList.swift:150` 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 (12 lines × 2) Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift:146 — Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift:146-157 | Sources/CodexBarCore/UsageFetcher.swift:1083-1094 — 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) Sources/CodexBarCore/Providers/Groq/GroqConsoleUsageSnapshot.swift:190 — Sources/CodexBarCore/Providers/Groq/GroqConsoleUsageSnapshot.swift:190-201 | Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift:267-278 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Groq/GroqConsoleUsageSnapshot.swift:190` 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 (12 lines × 2) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:496 — Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:496-507 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:816-827 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:496` 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) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:691 — Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:691-702 | Sources/CodexBarCore/Providers/Shared/OpenCodeSubscriptionParser.swift:161-172 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:691` 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) · ×12
  • Duplicated block (14 lines × 2) Sources/CodexBar/CostHistoryChartMenuView.swift:1026 — Sources/CodexBar/CostHistoryChartMenuView.swift:1026-1039 | Sources/CodexBarCore/CostUsageModels.swift:1234-1247 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/CostHistoryChartMenuView.swift:1026` 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 (14 lines × 2) Sources/CodexBar/Providers/Moonshot/MoonshotProviderImplementation.swift:38 — Sources/CodexBar/Providers/Moonshot/MoonshotProviderImplementation.swift:38-52 | Sources/CodexBar/Providers/Zai/ZaiProviderImplementation.swift:38-51 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Moonshot/MoonshotProviderImplementation.swift:38` 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) Sources/CodexBar/StatusItemController+Actions.swift:42 — Sources/CodexBar/StatusItemController+Actions.swift:42-55 | Sources/CodexBar/StatusItemController+Actions.swift:59-72 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/StatusItemController+Actions.swift:42` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) Sources/CodexBarCore/CostUsageFetcher.swift:1935 — Sources/CodexBarCore/CostUsageFetcher.swift:1935-1948 | Sources/CodexBarCore/CostUsageFetcher.swift:1964-1977 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CostUsageFetcher.swift:1935` 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) Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:1666 — Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:1666-1679 | Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:1694-1707 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:1666` 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) Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:32 — Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:32-45 | Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift:32-45 — before extracting anything, compare `Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift` and `Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:32` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:535 — Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:535-548 | Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:352-365 — before extracting anything, compare `Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift` and `Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 61 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 (14 lines × 2) Sources/CodexBarCore/Providers/Codex/CodexDashboardAuthority.swift:237 — Sources/CodexBarCore/Providers/Codex/CodexDashboardAuthority.swift:237-250 | Sources/CodexBarCore/Providers/Codex/CodexDashboardAuthority.swift:261-274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexDashboardAuthority.swift:237` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:476 — Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:476-489 | Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:504-517 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:476` 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) Sources/CodexBarCore/Providers/Grok/GrokCreditsProxyFetcher.swift:29 — Sources/CodexBarCore/Providers/Grok/GrokCreditsProxyFetcher.swift:29-42 | Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:270-283 — 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 (14 lines × 2) Sources/CodexBarCore/Providers/Groq/GroqProviderDescriptor.swift:25 — Sources/CodexBarCore/Providers/Groq/GroqProviderDescriptor.swift:25-38 | Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:75-88 — 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 (14 lines × 2) Sources/CodexBarCore/WidgetSnapshot.swift:36 — Sources/CodexBarCore/WidgetSnapshot.swift:36-49 | Sources/CodexBarCore/WidgetSnapshot.swift:68-81 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/WidgetSnapshot.swift:36` 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 (15 lines × 2) · ×11
  • Duplicated block (15 lines × 2) Sources/CodexBar/MenuCardView.swift:1123 — Sources/CodexBar/MenuCardView.swift:1123-1137 | Sources/CodexBar/MenuDescriptor.swift:514-528 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/MenuCardView.swift:1123` 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 (15 lines × 2) Sources/CodexBar/SettingsStore+Config.swift:159 — Sources/CodexBar/SettingsStore+Config.swift:159-173 | Sources/CodexBar/SettingsStore+Config.swift:219-233 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/SettingsStore+Config.swift:159` 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 (15 lines × 2) Sources/CodexBarCore/CopilotUsageModels.swift:165 — Sources/CodexBarCore/CopilotUsageModels.swift:165-179 | Sources/CodexBarCore/CopilotUsageModels.swift:202-216 — both copies are in the same file, so extract the 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) Sources/CodexBarCore/CostUsageFetcher.swift:274 — Sources/CodexBarCore/CostUsageFetcher.swift:274-288 | Sources/CodexBarCore/CostUsageFetcher.swift:445-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.
  • Duplicated block (15 lines × 2) Sources/CodexBarCore/CostUsageFetcher.swift:426 — Sources/CodexBarCore/CostUsageFetcher.swift:426-440 | Sources/CodexBarCore/CostUsageFetcher.swift:471-485 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (15 lines × 2) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:428 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:428-442 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:755-769 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (15 lines × 2) Sources/CodexBarCore/Providers/Codex/CodexAccountReconciliation.swift:333 — Sources/CodexBarCore/Providers/Codex/CodexAccountReconciliation.swift:333-347 | Sources/CodexBarCore/Providers/Codex/CodexSystemAccountObserver.swift:47-61 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexAccountReconciliation.swift:333` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (15 lines × 2) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1109 — Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1109-1123 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1174-1188 — both copies are in the same file, so extract the 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) Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift:23 — Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift:23-37 | Sources/CodexBarCore/Providers/TypeSafe/TypeSafeProviderDescriptor.swift:27-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift:23` 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) Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:74 — Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:74-88 | Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift:74-88 — before extracting anything, compare `Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift` and `Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 78 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 (15 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:99 — Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:99-113 | Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift:99-113 — before extracting anything, compare `Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift` and `Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 78 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.
D2 · Cognitive Complexity · fetchUsage · ×10
  • fetchUsage::accounts (cognitive 36) REDACTED:38 — fetchUsage::accounts has cognitive complexity 36 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 8, loops 3 (6 pts), ternaries 1 (2 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.
  • fetchUsage::pages (cognitive 35) Sources/CodexBarCore/Resources/Plugins/openai.js:77 — fetchUsage::pages has cognitive complexity 35 (threshold 15). Drivers by points: if/else 6 (18 pts), ternaries 2 (8 pts), boolean chains 6, loops 2 (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.
  • fetchUsage::parseQuota (cognitive 35) REDACTED:241 — fetchUsage::parseQuota has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 9, ternaries 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • fetchUsage::summary (cognitive 30) REDACTED:82 — fetchUsage::summary has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 11, loops 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.
  • fetchUsage::cookies (cognitive 26) Sources/CodexBarCore/Resources/Plugins/perplexity.js:18 — fetchUsage::cookies has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • fetchUsage::parse (cognitive 22) Sources/CodexBarCore/Resources/Plugins/qoder.js:32 — fetchUsage::parse has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 6, if/else 5, ternaries 4 (5 pts), other 4, error handling 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.
  • fetchUsage::parseLimit (cognitive 22) Sources/CodexBarCore/Resources/Plugins/zai.js:60 — fetchUsage::parseLimit has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 8, ternaries 3 (5 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.
  • fetchUsage::validate (cognitive 20) REDACTED:38 — fetchUsage::validate has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 2 (6 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • fetchUsage::window (cognitive 18) Sources/CodexBarCore/Resources/Plugins/zai.js:92 — fetchUsage::window has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, ternaries 1 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • fetchUsage::discover (cognitive 17) REDACTED:52 — fetchUsage::discover has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (6 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.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×10
  • Duplicated block (16 lines × 2) Sources/CodexBar/MenuCardView+Costs.swift:390 — Sources/CodexBar/MenuCardView+Costs.swift:390-405 | Sources/CodexBarCore/CostUsageModels.swift:308-323 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/MenuCardView+Costs.swift:390` 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 (16 lines × 2) Sources/CodexBar/Providers/ClawRouter/ClawRouterProviderImplementation.swift:23 — Sources/CodexBar/Providers/ClawRouter/ClawRouterProviderImplementation.swift:23-38 | Sources/CodexBar/Providers/OpenCodeGo/OpenCodeGoProviderImplementation.swift:81-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/ClawRouter/ClawRouterProviderImplementation.swift:23` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `context` to `ProviderAvailabilityContext` in one and `ProviderSettingsContext` 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 (16 lines × 2) Sources/CodexBar/Providers/Codex/CodexProviderImplementation.swift:102 — Sources/CodexBar/Providers/Codex/CodexProviderImplementation.swift:102-117 | Sources/CodexBar/Providers/Codex/CodexProviderImplementation.swift:131-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Codex/CodexProviderImplementation.swift:102` 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) Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:664 — Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:664-679 | Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:688-703 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:664` 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) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:512 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:512-527 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:539-554 — both copies are in the same file, so extract the 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) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:54 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:54-69 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:65-80 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:54` 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) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:306 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:306-321 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:229-244 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:306` 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 (16 lines × 2) Sources/CodexBarCore/Providers/Groq/GroqConsoleUsageSnapshot.swift:172 — Sources/CodexBarCore/Providers/Groq/GroqConsoleUsageSnapshot.swift:172-187 | Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift:249-264 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Groq/GroqConsoleUsageSnapshot.swift:172` 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) Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:239 — Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:239-254 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:261-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) Sources/CodexBarCore/Providers/Perplexity/PerplexityAPIError.swift:11 — Sources/CodexBarCore/Providers/Perplexity/PerplexityAPIError.swift:11-26 | TestsPlugin/ManusReference.swift:163-178 — 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 · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×8
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/CodexBar/UsageStore+OpenAIWeb.swift:539 — Sources/CodexBar/UsageStore+OpenAIWeb.swift:539-652 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:654-717 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:719-781 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:783-837 — 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) Sources/CodexBarCLI/CLIRenderer.swift:168 — Sources/CodexBarCLI/CLIRenderer.swift:168-177 | Sources/CodexBarCLI/CLIRenderer.swift:208-230 | Sources/CodexBarCLI/CLIRenderer.swift:232-254 | Sources/CodexBarCLI/CLIRenderer.swift:309-320 — 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) Sources/CodexBarCore/Config/SettingsValue.swift:8 — Sources/CodexBarCore/Config/SettingsValue.swift:8-19 | Sources/CodexBarCore/Providers/HuggingFace/HuggingFaceSettingsReader.swift:64-75 | Sources/CodexBarCore/Providers/IBMBob/IBMBobSettingsReader.swift:6-22 | Sources/CodexBarCore/Providers/Nous/NousSettingsReader.swift:278-284 — 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) Sources/CodexBarCore/CostUsageFetcher.swift:204 — Sources/CodexBarCore/CostUsageFetcher.swift:204-239 | Sources/CodexBarCore/CostUsageFetcher.swift:241-290 | Sources/CodexBarCore/CostUsageFetcher.swift:421-463 | Sources/CodexBarCore/CostUsageFetcher.swift:466-839 — 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) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:774 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:774-787 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:1182-1195 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageParser.swift:177-195 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleSECTokenResolver.swift:153-166 — 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) Sources/CodexBarCore/Providers/Claude/ClaudeScopedWeeklyLimitMapper.swift:49 — Sources/CodexBarCore/Providers/Claude/ClaudeScopedWeeklyLimitMapper.swift:49-62 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:542-555 | Sources/CodexBarCore/Providers/Codex/CodexAdditionalRateLimitMapper.swift:139-152 | Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:743-756 — 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) Sources/CodexBarCore/Providers/Grok/GrokCLISettingsFetcher.swift:19 — Sources/CodexBarCore/Providers/Grok/GrokCLISettingsFetcher.swift:19-46 | Sources/CodexBarCore/Providers/Grok/GrokCreditsProxyFetcher.swift:14-44 | Sources/CodexBarCore/Providers/Grok/GrokRemainingResetsFetcher.swift:317-356 | Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:248-289 — 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) Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift:42 — Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift:42-54 | Sources/CodexBarCore/Providers/Mistral/MistralCookieImporter.swift:48-78 | Sources/CodexBarCore/Providers/Replicate/ReplicateCookieImporter.swift:22-43 | Sources/CodexBarCore/Providers/Venice/VeniceCookieImporter.swift:20-32 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×8
  • Duplicated block (12 lines × 3) Sources/CodexBar/Providers/Alibaba/AlibabaTokenPlanProviderImplementation.swift:50 — Sources/CodexBar/Providers/Alibaba/AlibabaTokenPlanProviderImplementation.swift:50-62 | Sources/CodexBar/Providers/Kilo/KiloProviderImplementation.swift:56-67 | Sources/CodexBar/Providers/Windsurf/WindsurfProviderImplementation.swift:33-46 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Alibaba/AlibabaTokenPlanProviderImplementation.swift:50` 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 (12 lines × 3) Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:848 — Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:848-859 | Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:929-940 | Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:1022-1033 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:848` 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 (12 lines × 3) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:776 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:776-787 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:1184-1195 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleSECTokenResolver.swift:155-166 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:776` 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 (12 lines × 3) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:57 — Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:57-68 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:390-401 | Sources/CodexBarCore/Providers/ProviderFetchPlan.swift:88-99 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:57` 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 × 3) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:56 — Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:56-67 | Sources/CodexBarCore/Providers/Codex/CodexProviderSettings.swift:26-37 | Sources/CodexBarCore/UsageFetcher.swift:36-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:56` 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 × 3) Sources/CodexBarCore/Providers/CommandCode/CommandCodeCookieImporter.swift:50 — Sources/CodexBarCore/Providers/CommandCode/CommandCodeCookieImporter.swift:50-61 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxCookieImporter.swift:53-64 | Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieImporter.swift:127-138 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/CommandCode/CommandCodeCookieImporter.swift:50` 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 (12 lines × 3) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:390 — Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:390-401 | Sources/CodexBarCore/Providers/ProviderFetchPlan.swift:88-99 | TestsPlugin/ManusReference.swift:30-41 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:390` 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 × 3) Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift:45 — Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift:45-56 | Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift:83-94 | Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift:152-163 — 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.
D1 · Cyclomatic Complexity · fetchUsage · ×7
  • fetchUsage::parseQuota (cyclomatic 26) REDACTED:241 — fetchUsage::parseQuota has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • fetchUsage::summary (cyclomatic 25) REDACTED:82 — fetchUsage::summary 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.
  • fetchUsage::parse (cyclomatic 22) Sources/CodexBarCore/Resources/Plugins/qoder.js:32 — fetchUsage::parse 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.
  • fetchUsage::parseLimit (cyclomatic 22) Sources/CodexBarCore/Resources/Plugins/zai.js:60 — fetchUsage::parseLimit 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.
  • fetchUsage::accounts (cyclomatic 21) REDACTED:38 — fetchUsage::accounts 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.
  • fetchUsage::pages (cyclomatic 19) Sources/CodexBarCore/Resources/Plugins/openai.js:77 — fetchUsage::pages 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.
  • fetchUsage::cookies (cyclomatic 16) Sources/CodexBarCore/Resources/Plugins/perplexity.js:18 — fetchUsage::cookies 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.
D35 · Change Coupling · Change-coupling hub · ×7
  • Change-coupling hub: CursorProviderImplementation.swift → ProviderRegistry.swift, ClaudeProviderImplementation.swift, CodexProviderImplementation.swift, FactoryProviderImplementation.swift, MiniMaxProviderImplementation.swift, OpenCodeProviderImplementation.swift Sources/CodexBar/Providers/Cursor/CursorProviderImplementation.swift — `Sources/CodexBar/Providers/Cursor/CursorProviderImplementation.swift` changes together with 6 other files — `Sources/CodexBar/ProviderRegistry.swift`, `Sources/CodexBar/Providers/Claude/ClaudeProviderImplementation.swift`, `Sources/CodexBar/Providers/Codex/CodexProviderImplementation.swift`, `Sources/CodexBar/Providers/Factory/FactoryProviderImplementation.swift`, `Sources/CodexBar/Providers/MiniMax/MiniMaxProviderImplementation.swift`, `Sources/CodexBar/Providers/OpenCode/OpenCodeProviderImplementation.swift` — none of which declares a dependency on it: one file is the hub of 6 separate couplings, not 6 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 6.
  • Change-coupling hub: LogCategories.swift → ProviderDescriptor.swift, CodexBarWidgetProvider.swift, CodexBarWidgetViews.swift Sources/CodexBarCore/Logging/LogCategories.swift — `Sources/CodexBarCore/Logging/LogCategories.swift` changes together with 3 other files — `Sources/CodexBarCore/Providers/ProviderDescriptor.swift`, `Sources/CodexBarWidget/CodexBarWidgetProvider.swift`, `Sources/CodexBarWidget/CodexBarWidgetViews.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: StatusItemController+Menu.swift → StatusItemController+HostedSubmenus.swift, StatusItemController+MenuCardItems.swift, StatusItemController+MenuReconcile.swift, StatusItemController+MenuRefreshScheduling.swift, StatusItemController+ProviderSwitcher.swift, StatusItemController+UsageHistoryMenu.swift, VertexAIProviderDescriptor.swift Sources/CodexBar/StatusItemController+Menu.swift — `Sources/CodexBar/StatusItemController+Menu.swift` changes together with 7 other files — `Sources/CodexBar/StatusItemController+HostedSubmenus.swift`, `Sources/CodexBar/StatusItemController+MenuCardItems.swift`, `Sources/CodexBar/StatusItemController+MenuReconcile.swift`, `Sources/CodexBar/StatusItemController+MenuRefreshScheduling.swift`, `Sources/CodexBar/StatusItemController+ProviderSwitcher.swift`, `Sources/CodexBar/StatusItemController+UsageHistoryMenu.swift`, `Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift` — none of which declares a dependency on it: one file is the hub of 7 separate couplings, not 7 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 7.
  • Change-coupling hub: AugmentProviderImplementation.swift → ProviderRegistry.swift, ClaudeProviderImplementation.swift, CodexProviderImplementation.swift, CursorProviderImplementation.swift, FactoryProviderImplementation.swift, MiniMaxProviderImplementation.swift, OpenCodeProviderImplementation.swift Sources/CodexBar/Providers/Augment/AugmentProviderImplementation.swift — `Sources/CodexBar/Providers/Augment/AugmentProviderImplementation.swift` changes together with 7 other files — `Sources/CodexBar/ProviderRegistry.swift`, `Sources/CodexBar/Providers/Claude/ClaudeProviderImplementation.swift`, `Sources/CodexBar/Providers/Codex/CodexProviderImplementation.swift`, `Sources/CodexBar/Providers/Cursor/CursorProviderImplementation.swift`, `Sources/CodexBar/Providers/Factory/FactoryProviderImplementation.swift`, `Sources/CodexBar/Providers/MiniMax/MiniMaxProviderImplementation.swift`, `Sources/CodexBar/Providers/OpenCode/OpenCodeProviderImplementation.swift` — none of which declares a dependency on it: one file is the hub of 7 separate couplings, not 7 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 7.
  • Change-coupling hub: FactoryProviderImplementation.swift → ClaudeProviderImplementation.swift, CodexProviderImplementation.swift, MiniMaxProviderImplementation.swift Sources/CodexBar/Providers/Factory/FactoryProviderImplementation.swift — `Sources/CodexBar/Providers/Factory/FactoryProviderImplementation.swift` changes together with 3 other files — `Sources/CodexBar/Providers/Claude/ClaudeProviderImplementation.swift`, `Sources/CodexBar/Providers/Codex/CodexProviderImplementation.swift`, `Sources/CodexBar/Providers/MiniMax/MiniMaxProviderImplementation.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: UsageStore.swift → KeychainPromptCoordinator.swift, ProviderConfigEnvironment.swift, AugmentSessionKeepalive.swift, VertexAIProviderDescriptor.swift, CodexBarWidgetProvider.swift, CodexBarWidgetViews.swift Sources/CodexBar/UsageStore.swift — `Sources/CodexBar/UsageStore.swift` changes together with 6 other files — `Sources/CodexBar/KeychainPromptCoordinator.swift`, `Sources/CodexBarCore/Config/ProviderConfigEnvironment.swift`, `Sources/CodexBarCore/Providers/Augment/AugmentSessionKeepalive.swift`, `Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift`, `Sources/CodexBarWidget/CodexBarWidgetProvider.swift`, `Sources/CodexBarWidget/CodexBarWidgetViews.swift` — none of which declares a dependency on it: one file is the hub of 6 separate couplings, not 6 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 6.
  • Change-coupling hub: ProviderConfigEnvironment.swift → CodexBarConfigValidation.swift, ProviderTokenResolver.swift, CodexBarWidgetProvider.swift, CodexBarWidgetViews.swift Sources/CodexBarCore/Config/ProviderConfigEnvironment.swift — `Sources/CodexBarCore/Config/ProviderConfigEnvironment.swift` changes together with 4 other files — `Sources/CodexBarCore/Config/CodexBarConfigValidation.swift`, `Sources/CodexBarCore/Providers/ProviderTokenResolver.swift`, `Sources/CodexBarWidget/CodexBarWidgetProvider.swift`, `Sources/CodexBarWidget/CodexBarWidgetViews.swift` — 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.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×7
  • Duplicated block (6 lines × 4) Sources/CodexBarCore/CopilotUsageModels.swift:169 — Sources/CodexBarCore/CopilotUsageModels.swift:169-174 | Sources/CodexBarCore/CopilotUsageModels.swift:206-211 | Sources/CodexBarCore/Providers/Codex/CodexSpendControlNumber.swift:9-14 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxDecoding.swift:22-27 — there are 4 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 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.
  • Duplicated block (6 lines × 4) Sources/CodexBarCore/CopilotUsageModels.swift:169 — Sources/CodexBarCore/CopilotUsageModels.swift:169-174 | Sources/CodexBarCore/CopilotUsageModels.swift:206-211 | Sources/CodexBarCore/Providers/Codex/CodexSpendControlNumber.swift:9-14 | Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:207-212 — there are 4 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 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `container` to `KeyedDecodingContainer<CodingKeys>` in one and `KeyedDecodingContainer<DynamicCodingKey>` 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 (6 lines × 4) Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:499 — Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:499-504 | Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:540-546 | Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:582-588 | Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:627-632 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:499` 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 before the matched lines, `Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:625` calls `setValue` and `Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:497` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 4) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:219 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:219-224 | Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:609-614 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1318-1323 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:632-637 — 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.
  • Duplicated block (6 lines × 4) Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:332 — Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:332-337 | Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:602-607 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1311-1316 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:707-712 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:703` calls `String` and `Sources/CodexBarCore/Providers/Amp/AmpUsageFetcher.swift:329` 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 × 4) Sources/CodexBar/Providers/Amp/AmpSettingsStore.swift:7 — Sources/CodexBar/Providers/Amp/AmpSettingsStore.swift:7-12 | Sources/CodexBar/Providers/CommandCode/CommandCodeSettingsStore.swift:7-12 | Sources/CodexBar/Providers/Grok/GrokSettingsStore.swift:7-12 | Sources/CodexBar/Providers/Ollama/OllamaSettingsStore.swift:10-15 — 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.
  • Duplicated block (6 lines × 4) Sources/CodexBar/Providers/Bedrock/BedrockSettingsStore.swift:7 — Sources/CodexBar/Providers/Bedrock/BedrockSettingsStore.swift:7-12 | Sources/CodexBar/Providers/Bedrock/BedrockSettingsStore.swift:17-22 | Sources/CodexBar/Providers/Bedrock/BedrockSettingsStore.swift:27-32 | Sources/CodexBar/Providers/Doubao/DoubaoSettingsStore.swift:12-17 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×7
  • Duplicated block (5 lines × 3) Sources/CodexBarCore/CostUsageModels.swift:821 — Sources/CodexBarCore/CostUsageModels.swift:821-825 | Sources/CodexBarCore/CostUsageModels.swift:1315-1319 | Sources/CodexBarCore/CostUsageModels.swift:1385-1389 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CostUsageModels.swift:821` 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 (5 lines × 3) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:571 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:571-575 | Sources/CodexBarCore/Providers/Grok/GrokRemainingResetsFetcher.swift:333-337 | Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:262-266 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:571` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:411 — Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:411-416 | Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:540-545 | Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:494-498 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (5 lines × 3) Sources/CodexBarCore/Providers/CommandCode/CommandCodeCookieImporter.swift:74 — Sources/CodexBarCore/Providers/CommandCode/CommandCodeCookieImporter.swift:74-78 | Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift:89-93 | Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieImporter.swift:150-154 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/CommandCode/CommandCodeCookieImporter.swift:74` 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 × 3) Sources/CodexBarCore/Providers/Groq/GroqConsoleFetcher.swift:175 — Sources/CodexBarCore/Providers/Groq/GroqConsoleFetcher.swift:175-179 | Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:330-334 | Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:342-346 — 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, `Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:348` calls `response`, `statusError` and `Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:335` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 3) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanSettingsReader.swift:54 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanSettingsReader.swift:54-58 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanSettingsReader.swift:14-18 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudSettingsReader.swift:8-12 — 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.
  • Duplicated block (5 lines × 3) Sources/AdaptiveReplayKit/ActivityCoverageStats.swift:11 — Sources/AdaptiveReplayKit/ActivityCoverageStats.swift:11-15 | Sources/CodexBarCore/Providers/Doubao/DoubaoVolcengineSigner.swift:16-20 | Sources/CodexBarCore/Providers/ProviderBranding.swift:8-12 — 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×7
  • Low cohesion: SettingsStore (LCOM4 16) Sources/CodexBar/SettingsStore.swift:244 — SettingsStore's methods fall into 16 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 16 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: SidebarResizeHandleView (LCOM4 8) Sources/CodexBar/SidebarResizeHandle.swift:47 — SidebarResizeHandleView'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: StatusItemController (LCOM4 7) Sources/CodexBar/StatusItemController.swift:41 — StatusItemController's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: UsageStore (LCOM4 5) Sources/CodexBar/UsageStore.swift:121 — UsageStore'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: PersistentRefreshMenuView (LCOM4 4) Sources/CodexBar/StatusItemController+MenuPresentation.swift:549 — PersistentRefreshMenuView'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: ProviderSwitcherView (LCOM4 4) Sources/CodexBar/StatusItemController+SwitcherViews.swift:10 — ProviderSwitcherView'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: AntigravitySpawnedPTYProcessHandle (LCOM4 4) Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:971 — AntigravitySpawnedPTYProcessHandle'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.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×6
  • Duplicated block (20 lines × 2) Sources/CodexBar/CodexLoginAlertPresentation.swift:9 — Sources/CodexBar/CodexLoginAlertPresentation.swift:9-28 | Sources/CodexBar/Providers/Kiro/KiroLoginAlertPresentation.swift:4-23 — 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 (20 lines × 2) Sources/CodexBar/QuotaWarningAlertOverlayController.swift:68 — Sources/CodexBar/QuotaWarningAlertOverlayController.swift:68-87 | Sources/CodexBar/ScreenConfettiOverlayController.swift:39-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/QuotaWarningAlertOverlayController.swift:68` 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 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 (20 lines × 2) Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:199 — Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:199-218 | Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:223-242 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:199` 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 (20 lines × 2) Sources/CodexBarCore/CostUsageFetcher.swift:678 — Sources/CodexBarCore/CostUsageFetcher.swift:678-697 | Sources/CodexBarCore/CostUsageFetcher.swift:786-805 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CostUsageFetcher.swift:678` 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 (20 lines × 2) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:593 — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:593-612 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:726-745 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:593` 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 (20 lines × 2) Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageSnapshot.swift:117 — Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageSnapshot.swift:117-136 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageSnapshot.swift:96-115 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageSnapshot.swift:117` 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 (8 lines × 3) · ×6
  • Duplicated block (8 lines × 3) Sources/CodexBar/CostHistoryChartMenuView.swift:889 — Sources/CodexBar/CostHistoryChartMenuView.swift:889-896 | Sources/CodexBar/CreditsHistoryChartMenuView.swift:259-266 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:389-396 — 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 `Sources/CodexBar/CostHistoryChartMenuView.swift:889` 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 × 3) Sources/CodexBarCLI/CLICardsBriefRenderer.swift:251 — Sources/CodexBarCLI/CLICardsBriefRenderer.swift:251-258 | Sources/CodexBarCLI/CLICardsBriefRenderer.swift:264-271 | Sources/CodexBarCLI/CLICardsBriefRenderer.swift:277-284 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCLI/CLICardsBriefRenderer.swift:251` 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 (8 lines × 3) Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageFetcher.swift:12 — Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageFetcher.swift:12-19 | Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:202-209 | Sources/CodexBarCore/Providers/Warp/WarpUsageFetcher.swift:116-123 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageFetcher.swift:12` 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 × 3) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:754 — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:754-761 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:791-800 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:839-848 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:754` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:207 — Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:207-214 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:498-505 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:818-825 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:207` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:206` calls `String` and `Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:497` 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 (8 lines × 3) Sources/CodexBar/Providers/Antigravity/AntigravityProviderImplementation.swift:29 — Sources/CodexBar/Providers/Antigravity/AntigravityProviderImplementation.swift:29-36 | Sources/CodexBar/Providers/Kilo/KiloProviderImplementation.swift:43-50 | Sources/CodexBar/Providers/Windsurf/WindsurfProviderImplementation.swift:19-26 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `context` to `ProviderSourceLabelContext` in one and `ProviderSettingsSnapshotContext` 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.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×5
  • Duplicated block (10–11 lines × 2) Sources/CodexBarCLI/CLIConfigCommand.swift:97 — Sources/CodexBarCLI/CLIConfigCommand.swift:97-106 | Sources/CodexBarCLI/CLIConfigCommand.swift:146-156 — both copies are in the same file, so extract the 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–11 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:343 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:343-353 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:409-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:343` 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 (10–11 lines × 2) Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:319 — Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:319-329 | Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:447-456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:447` 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–11 lines × 2) Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:619 — Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:619-629 | Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:666-675 — both copies are in the same file, so extract the 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–11 lines × 2) Sources/CodexBarCore/UsagePace.swift:203 — Sources/CodexBarCore/UsagePace.swift:203-213 | Sources/CodexBarCore/UsagePace.swift:243-252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/UsagePace.swift:203` 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 (7 lines × 4) · ×5
  • Duplicated block (7 lines × 4) Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:32 — Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:32-38 | Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:26-33 | Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift:36-43 | Sources/CodexBarCore/Providers/Windsurf/WindsurfProviderDescriptor.swift:22-29 — before extracting anything, compare `Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:26` 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 (7 lines × 4) Sources/CodexBarCore/Providers/Grok/GrokCLISettingsFetcher.swift:30 — Sources/CodexBarCore/Providers/Grok/GrokCLISettingsFetcher.swift:30-36 | Sources/CodexBarCore/Providers/Grok/GrokCreditsProxyFetcher.swift:27-33 | Sources/CodexBarCore/Providers/Grok/GrokRemainingResetsFetcher.swift:339-345 | Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:268-274 — 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 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Grok/GrokCLISettingsFetcher.swift:30` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 4) Sources/CodexBar/CopilotTokenStore.swift:14 — Sources/CodexBar/CopilotTokenStore.swift:14-20 | Sources/CodexBar/KimiTokenStore.swift:14-20 | Sources/CodexBar/MiniMaxAPITokenStore.swift:14-20 | Sources/CodexBar/SyntheticTokenStore.swift:14-20 — 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 4 call sites, so a change lands once.
  • Duplicated block (7 lines × 4) Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderConfig.swift:5 — Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderConfig.swift:5-11 | Sources/CodexBarCore/Providers/Bedrock/BedrockProviderConfig.swift:5-20 | Sources/CodexBarCore/Providers/Codex/CodexProviderConfig.swift:5-11 | Sources/CodexBarCore/Providers/Kilo/KiloProviderConfig.swift:5-11 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderConfig.swift:5` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderConfig.swift:11` calls `setExtensionValue` and `Sources/CodexBarCore/Providers/Bedrock/BedrockProviderConfig.swift:20` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 4) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanSettingsReader.swift:60 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanSettingsReader.swift:60-66 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxSettingsReader.swift:55-61 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxSettingsReader.swift:63-69 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxSettingsReader.swift:71-77 — 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.
X3 · Exception handling · Swallowed exception (empty catch) · ×5
  • Swallowed exception (empty catch) REDACTED:119 — 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) Sources/CodexBarCore/Resources/Plugins/poe.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) Sources/CodexBarCore/Resources/Plugins/t3chat.js:70 — 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) Sources/CodexBarCore/Resources/Plugins/zai.js:254 — 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) Sources/CodexBarCore/Resources/Plugins/zai.js:331 — 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.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×4
  • Duplicated block (17 lines × 2) Sources/CodexBarCore/PathEnvironment.swift:86 — Sources/CodexBarCore/PathEnvironment.swift:86-102 | Sources/CodexBarCore/PathEnvironment.swift:345-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/PathEnvironment.swift:86` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1130 — Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1130-1146 | Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1203-1219 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1130` 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 first that the copies are not typed on the same thing: the declarations holding them bind `now` to `Date = Date()` in one and `Date` 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 (17 lines × 2) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe+SessionResolution.swift:129 — Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe+SessionResolution.swift:129-145 | Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe+SessionResolution.swift:151-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe+SessionResolution.swift:129` 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) Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift:37 — Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift:37-53 | Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift:144-160 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Mistral/MistralUsageFetcher.swift:37` 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 (9–10 lines × 2) · ×4
  • Duplicated block (9–10 lines × 2) Sources/CodexBar/ClaudeLoginRunner.swift:114 — Sources/CodexBar/ClaudeLoginRunner.swift:114-122 | Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:693-702 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/ClaudeLoginRunner.swift:114` 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–10 lines × 2) Sources/CodexBar/CostHistoryChartMenuView.swift:699 — Sources/CodexBar/CostHistoryChartMenuView.swift:699-708 | Sources/CodexBarCore/Providers/Mistral/MistralModels.swift:520-528 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9–10 lines × 2) Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:337 — Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:337-345 | Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:385-394 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:337` 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 (9–10 lines × 2) Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:368 — Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:368-376 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:606-615 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:368` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 × 3) · ×4
  • Duplicated block (9 lines × 3) Sources/CodexBarCLI/CLICostCommand.swift:1034 — Sources/CodexBarCLI/CLICostCommand.swift:1034-1042 | Sources/CodexBarCLI/CLICostCommand.swift:1098-1106 | Sources/CodexBarCLI/CLICostCommand.swift:1228-1236 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1058 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1058-1066 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1101-1109 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1126-1134 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1058` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1111` calls `setValue` and `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1068` 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 (9 lines × 3) Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:542 — Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:542-550 | Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:566-574 | Sources/CodexBarCore/Plugins/QuickJSProviderPluginEngine.swift:344-352 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:542` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (9 lines × 3) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:157 — Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:157-165 | Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift:67-75 | Sources/CodexBarCore/Providers/Gemini/GeminiProviderDescriptor.swift:40-48 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:157` 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 (5 lines × 4) · ×4
  • Duplicated block (5 lines × 4) Sources/CodexBar/CreditsHistoryChartMenuView.swift:204 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:204-211 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:336-343 | Sources/CodexBarCore/CostUsageModels.swift:1567-1572 | Sources/CodexBarCore/PiSessionCostScanner.swift:1354-1358 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also 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 (5 lines × 4) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:776 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:776-780 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:1184-1188 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageParser.swift:181-185 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleSECTokenResolver.swift:155-159 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:776` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) Sources/CodexBarCore/Providers/AiAnd/AiAndSettingsReader.swift:6 — Sources/CodexBarCore/Providers/AiAnd/AiAndSettingsReader.swift:6-10 | Sources/CodexBarCore/Providers/ClinePass/ClinePassSettingsReader.swift:6-10 | Sources/CodexBarCore/Providers/DeepInfra/DeepInfraSettingsReader.swift:6-10 | Sources/CodexBarCore/Providers/Poe/PoeSettingsReader.swift:6-10 — 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.
  • Duplicated block (5 lines × 4) Sources/CodexBarCLI/CLIRenderer.swift:169 — Sources/CodexBarCLI/CLIRenderer.swift:169-173 | Sources/CodexBarCLI/CLIRenderer.swift:209-213 | Sources/CodexBarCLI/CLIRenderer.swift:233-237 | Sources/CodexBarCLI/CLIRenderer.swift:310-314 — 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.
D1 · Cyclomatic Complexity · fetchUsage (cyclomatic 34) · ×3
  • fetchUsage (cyclomatic 34) REDACTED:15 — fetchUsage has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • fetchUsage (cyclomatic 34) Sources/CodexBarCore/Resources/Plugins/venice.js:15 — fetchUsage has cyclomatic complexity 34 (threshold 15). Of this number, 28 points are the body's own statements and 6 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.
  • fetchUsage (cyclomatic 34) REDACTED:11 — fetchUsage has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 14 of the 34 points are its own statements and the rest belongs to 7 function items inside it that branch (get, amount, date, …). 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 · fetchUsage (cyclomatic 16) · ×3
  • fetchUsage (cyclomatic 16) REDACTED:8 — fetchUsage 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.
  • fetchUsage (cyclomatic 16) Sources/CodexBarCore/Resources/Plugins/qoder.js:8 — fetchUsage 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.
  • fetchUsage (cyclomatic 16) Sources/CodexBarCore/Resources/Plugins/tinyapi.js:8 — fetchUsage 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.
D2 · Cognitive Complexity · fetchUsage (cognitive 36) · ×3
  • fetchUsage (cognitive 36) Sources/CodexBarCore/Resources/Plugins/flora.js:11 — fetchUsage has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 11, other 4, ternaries 3 (4 pts), error handling 1 (nesting depth added 3). Of this number, 32 points are the body's own statements and 4 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.
  • fetchUsage (cognitive 36) REDACTED:15 — fetchUsage has cognitive complexity 36 (threshold 15). Drivers by points: if/else 50 (66 pts), boolean chains 33, ternaries 18 (26 pts), loops 5 (6 pts), error handling 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • fetchUsage (cognitive 36) Sources/CodexBarCore/Resources/Plugins/xapi.js:15 — fetchUsage has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (22 pts), ternaries 3 (5 pts), boolean chains 4, error handling 2 (4 pts), loops 1 (nesting depth added 15). Of this number, 16 points are the body's own statements and 20 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×3
  • Duplicated block (27 lines × 2) Sources/CodexBar/CreditsHistoryChartMenuView.swift:84 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:84-110 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:121-147 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 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 `Sources/CodexBar/CreditsHistoryChartMenuView.swift:84` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (27 lines × 2) Sources/CodexBar/UsageStore+OpenAIWeb.swift:146 — Sources/CodexBar/UsageStore+OpenAIWeb.swift:146-172 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:188-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/UsageStore+OpenAIWeb.swift:146` 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 (27 lines × 2) Sources/CodexBarCore/Providers/LLMProxy/LLMProxySettingsReader.swift:7 — Sources/CodexBarCore/Providers/LLMProxy/LLMProxySettingsReader.swift:7-33 | Sources/CodexBarCore/Providers/LiteLLM/LiteLLMSettingsReader.swift:8-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/LLMProxy/LLMProxySettingsReader.swift:7` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/LiteLLM/LiteLLMSettingsReader.swift:40` calls `setExtensionValue` and `Sources/CodexBarCore/Providers/LLMProxy/LLMProxySettingsReader.swift:33` 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 (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) Sources/CodexBar/ScreenConfettiOverlayController.swift:143 — Sources/CodexBar/ScreenConfettiOverlayController.swift:143-165 | Sources/CodexBar/ScreenConfettiOverlayController.swift:174-196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/ScreenConfettiOverlayController.swift:143` 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 (23 lines × 2) Sources/CodexBar/SpendDashboardSource+OpenCodex.swift:13 — Sources/CodexBar/SpendDashboardSource+OpenCodex.swift:13-35 | Sources/CodexBar/SpendDashboardSource+OpenCodex.swift:50-72 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/SpendDashboardSource+OpenCodex.swift:13` 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 (23 lines × 2) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:66 — Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:66-88 | Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieHeaders.swift:118-140 — before extracting anything, compare `Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift` and `Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieHeaders.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 44 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:66` 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–15 lines × 2) · ×3
  • Duplicated block (14–15 lines × 2) Sources/CodexBar/MenuCardView+ModelHelpers.swift:1237 — Sources/CodexBar/MenuCardView+ModelHelpers.swift:1237-1250 | Sources/CodexBar/MenuCardView+ModelHelpers.swift:1272-1286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/MenuCardView+ModelHelpers.swift:1237` 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–15 lines × 2) Sources/CodexBar/ProviderSwitcherButtons.swift:117 — Sources/CodexBar/ProviderSwitcherButtons.swift:117-130 | Sources/CodexBar/ProviderSwitcherButtons.swift:241-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/ProviderSwitcherButtons.swift:117` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14–15 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:793 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:793-806 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:1166-1180 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:793` 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 lines × 3) · ×3
  • Duplicated block (7 lines × 3) Sources/CodexBar/CostHistoryChartMenuView.swift:196 — Sources/CodexBar/CostHistoryChartMenuView.swift:196-202 | Sources/CodexBar/CreditsHistoryChartMenuView.swift:56-62 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:91-97 — 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 `Sources/CodexBar/CostHistoryChartMenuView.swift:196` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBar/CreditsHistoryChartMenuView.swift:55` calls `chartYAxis` and `Sources/CodexBar/CostHistoryChartMenuView.swift:195` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (7 lines × 3) Sources/CodexBarCore/CopilotUsageModels.swift:169 — Sources/CodexBarCore/CopilotUsageModels.swift:169-175 | Sources/CodexBarCore/CopilotUsageModels.swift:206-212 | Sources/CodexBarCore/Providers/Codex/CodexSpendControlNumber.swift:9-15 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CopilotUsageModels.swift:169` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 3) Sources/CodexBarCore/Providers/ElevenLabs/ElevenLabsSettingsReader.swift:11 — Sources/CodexBarCore/Providers/ElevenLabs/ElevenLabsSettingsReader.swift:11-17 | Sources/CodexBarCore/Providers/NeuralWatt/NeuralWattSettingsReader.swift:10-16 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:816-824 — 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 (6 lines × 3) · ×3
  • Duplicated block (6 lines × 3) Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:31 — Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:31-36 | Sources/CodexBarCore/Providers/Gemini/GeminiProviderDescriptor.swift:24-29 | Sources/CodexBarCore/Providers/Windsurf/WindsurfProviderDescriptor.swift:27-32 — 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.
  • Duplicated block (6 lines × 3) Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:480 — Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:480-485 | Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:508-513 | Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:534-539 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthUsageFetcher.swift:480` 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 (6 lines × 3) Sources/CodexBarCore/CodexLocalProjectUsageModels.swift:320 — Sources/CodexBarCore/CodexLocalProjectUsageModels.swift:320-325 | Sources/CodexBarCore/CodexLocalProjectUsageModels.swift:472-477 | Sources/CodexBarCore/CodexLocalProjectUsageModels.swift:616-621 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/CodexLocalProjectUsageModels.swift:318` calls `decode`, `decodeIfPresent` and `Sources/CodexBarCore/CodexLocalProjectUsageModels.swift:615` 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.
R7 · Dead Code · Dead file (~259 LoC) · ×3
  • Dead file (~259 LoC) Sources/CodexBarCore/Resources/Plugins/aixy.js — no import path from any entry point (11 application, 14 tooling, 6 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
  • Dead file (~259 LoC) Sources/CodexBarCore/Resources/Plugins/muse.ts — no import path from any entry point (11 application, 14 tooling, 6 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
  • Dead file (~259 LoC) Sources/CodexBarCore/Resources/Plugins/zoommate.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~172 LoC) · ×3
  • Dead file (~172 LoC) Sources/CodexBarCore/Resources/Plugins/clawrouter.js — no import path from any entry point (11 application, 14 tooling, 6 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
  • Dead file (~172 LoC) Sources/CodexBarCore/Resources/Plugins/raycast.js — no import path from any entry point (11 application, 14 tooling, 6 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
  • Dead file (~172 LoC) Sources/CodexBarCore/Resources/Plugins/v0.ts — no import path from any entry point (11 application, 14 tooling, 6 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
D1 · Cyclomatic Complexity · fetchUsage (cyclomatic 35) · ×2
  • fetchUsage (cyclomatic 35) Sources/CodexBarCore/Resources/Plugins/flora.js:11 — fetchUsage has cyclomatic complexity 35 (threshold 15). Of this number, 31 points are the body's own statements and 4 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.
  • fetchUsage (cyclomatic 35) Sources/CodexBarCore/Resources/Plugins/sakana.js:12 — fetchUsage has cyclomatic complexity 35 (threshold 15). Of this number, 17 points are the body's own statements and 18 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 · fetchUsage (cyclomatic 26) · ×2
  • fetchUsage (cyclomatic 26) Sources/CodexBarCore/Resources/Plugins/fal.js:8 — fetchUsage 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.
  • fetchUsage (cyclomatic 26) Sources/CodexBarCore/Resources/Plugins/tavily.js:8 — fetchUsage has cyclomatic complexity 26 (threshold 15). Of this number, 19 points are the body's own statements and 7 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · fetchUsage (cognitive 62) · ×2
  • fetchUsage (cognitive 62) Sources/CodexBarCore/Resources/Plugins/t3chat.js:12 — fetchUsage has cognitive complexity 62 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 22, loops 6 (8 pts), ternaries 4, error handling 1 (2 pts), other 2 (nesting depth added 12). Of this number, 50 points are the body's own statements and 12 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • fetchUsage (cognitive 62) Sources/CodexBarCore/Resources/Plugins/zed.js:12 — fetchUsage has cognitive complexity 62 (threshold 15). Drivers by points: if/else 24 (31 pts), ternaries 14 (21 pts), boolean chains 9, error handling 1 (nesting depth added 14). Of this number, 53 points are the body's own statements and 9 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 · fetchUsage (cognitive 37) · ×2
  • fetchUsage (cognitive 37) Sources/CodexBarCore/Resources/Plugins/sakana.js:12 — fetchUsage has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 12, ternaries 6 (10 pts) (nesting depth added 7). Of this number, 22 points are the body's own statements and 15 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.
  • fetchUsage (cognitive 37) REDACTED:11 — fetchUsage has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 11, ternaries 4, error handling 2 (3 pts), loops 1 (nesting depth added 5). Of this number, 16 points are the body's own statements and 21 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 · fetchUsage (cognitive 34) · ×2
  • fetchUsage (cognitive 34) Sources/CodexBarCore/Resources/Plugins/manus.js:8 — fetchUsage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 10 (11 pts), boolean chains 9, error handling 1, loops 1, other 1 (nesting depth added 3). Of this number, 22 points are the body's own statements and 12 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.
  • fetchUsage (cognitive 34) Sources/CodexBarCore/Resources/Plugins/perplexity.js:8 — fetchUsage has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21 (38 pts), boolean chains 14, other 10, ternaries 8, loops 6 (7 pts), error handling 1 (2 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 · chutes.chutesMinutes (cognitive 28) · ×2
  • chutes.chutesMinutes (cognitive 28) Sources/CodexBarCore/Resources/Plugins/chutes.js:121 — chutes.chutesMinutes has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 5 (19 pts), if/else 4 (6 pts), boolean chains 2, loops 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.
  • chutes.chutesMinutes (cognitive 28) Sources/CodexBarCore/Resources/Plugins/chutes.ts:94 — chutes.chutesMinutes has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 5 (19 pts), if/else 4 (6 pts), boolean chains 2, loops 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 · fetchUsage (cognitive 24) · ×2
  • fetchUsage (cognitive 24) REDACTED:8 — fetchUsage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (23 pts), ternaries 8 (10 pts), loops 5 (8 pts), other 7, boolean chains 6, error handling 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.
  • fetchUsage (cognitive 24) Sources/CodexBarCore/Resources/Plugins/qoder.js:8 — fetchUsage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 15, ternaries 8 (10 pts), loops 5 (7 pts), other 6, error handling 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×2
  • Duplicated block (25 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageSnapshot.swift:18 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageSnapshot.swift:18-42 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudUsageSnapshot.swift:18-42 — before extracting anything, compare `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageSnapshot.swift` and `Sources/CodexBarCore/Providers/QwenCloud/QwenCloudUsageSnapshot.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageSnapshot.swift:18` 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 (25 lines × 2) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:786 — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:786-810 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:834-858 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:786` 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 (23–24 lines × 2) · ×2
  • Duplicated block (23–24 lines × 2) Sources/CodexBar/IconRenderer.swift:805 — Sources/CodexBar/IconRenderer.swift:805-828 | Sources/CodexBar/IconRenderer.swift:837-859 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/IconRenderer.swift:805` 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 (23–24 lines × 2) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:316 — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:316-339 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:939-961 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:939` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:939` calls `isAuthenticationError` and `Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:316` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) Sources/CodexBarCore/ProviderStorageFootprint.swift:144 — Sources/CodexBarCore/ProviderStorageFootprint.swift:144-162 | Sources/CodexBarCore/ProviderStorageFootprint.swift:173-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/ProviderStorageFootprint.swift:144` 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–19 lines × 2) Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:1083 — Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:1083-1101 | Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:563-580 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:1083` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:581` calls `ioFailed`, `usleep` and `Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:1102` 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 (18 lines × 2) · ×2
  • Duplicated block (18 lines × 2) Sources/CodexBar/StatusItemController+Menu.swift:307 — Sources/CodexBar/StatusItemController+Menu.swift:307-324 | Sources/CodexBar/StatusItemController+Menu.swift:340-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/StatusItemController+Menu.swift:307` 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 (18 lines × 2) Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:455 — Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:455-472 | Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:493-510 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:455` 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 `cookieHeader` to `String) async throws -> (AugmentCreditsResponse` in one and `String) async throws -> (AugmentSubscriptionResponse` 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.
D4 · Code Duplication · Duplicated block (14–15 lines × 3) · ×2
  • Duplicated block (14–15 lines × 3) Sources/CodexBarCore/CookieHeaderCache.swift:876 — Sources/CodexBarCore/CookieHeaderCache.swift:876-889 | Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:1267-1281 | Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthPendingCacheClearStore.swift:396-410 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CookieHeaderCache.swift:876` 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. 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 (14–15 lines × 3) Sources/CodexBarCore/PathEnvironment.swift:90 — Sources/CodexBarCore/PathEnvironment.swift:90-104 | Sources/CodexBarCore/PathEnvironment.swift:136-149 | Sources/CodexBarCore/PathEnvironment.swift:349-363 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/PathEnvironment.swift:136` 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 (15 lines × 3) · ×2
  • Duplicated block (15 lines × 3) Sources/CodexBarCore/Providers/Bedrock/BedrockProviderDescriptor.swift:34 — Sources/CodexBarCore/Providers/Bedrock/BedrockProviderDescriptor.swift:34-48 | Sources/CodexBarCore/Providers/Kiro/KiroProviderDescriptor.swift:14-28 | Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift:15-29 — before extracting anything, compare `Sources/CodexBarCore/Providers/Bedrock/BedrockProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/Kiro/KiroProviderDescriptor.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 41 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Bedrock/BedrockProviderDescriptor.swift:34` 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 × 3) Sources/CodexBarCore/Providers/Bifrost/BifrostSettingsReader.swift:7 — Sources/CodexBarCore/Providers/Bifrost/BifrostSettingsReader.swift:7-21 | Sources/CodexBarCore/Providers/LLMProxy/LLMProxySettingsReader.swift:7-33 | Sources/CodexBarCore/Providers/LiteLLM/LiteLLMSettingsReader.swift:8-40 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/LLMProxy/LLMProxySettingsReader.swift:7` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/LiteLLM/LiteLLMSettingsReader.swift:40` calls `setExtensionValue` and `Sources/CodexBarCore/Providers/Bifrost/BifrostSettingsReader.swift:21` 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 (13–14 lines × 2) · ×2
  • Duplicated block (13–14 lines × 2) Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift:184 — Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift:184-196 | Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift:203-216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift:203` 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–14 lines × 2) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:430 — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:430-443 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:670-682 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageFetcher.swift:430` 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 (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:28 — Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:28-40 | Sources/CodexBar/Providers/Grok/GrokProviderImplementation.swift:48-61 | Sources/CodexBar/Providers/Ollama/OllamaProviderImplementation.swift:58-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:28` 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 × 3) Sources/CodexBar/UsageStore+OpenAIWeb.swift:705 — Sources/CodexBar/UsageStore+OpenAIWeb.swift:705-717 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:769-781 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:825-837 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/UsageStore+OpenAIWeb.swift:705` 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–13 lines × 3) · ×2
  • Duplicated block (12–13 lines × 3) Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:27 — Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:27-38 | Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift:31-43 | Sources/CodexBarCore/Providers/Windsurf/WindsurfProviderDescriptor.swift:17-29 — before extracting anything, compare `Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Windsurf/WindsurfProviderDescriptor.swift:17` 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 (12–13 lines × 3) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:36 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:36-47 | Sources/CodexBarCore/Providers/Cursor/CursorProviderDescriptor.swift:40-52 | Sources/CodexBarCore/Providers/Gemini/GeminiProviderDescriptor.swift:15-26 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–13 lines × 2) · ×2
  • Duplicated block (8–13 lines × 2) Sources/CodexBar/MenuBarDisplayText.swift:205 — Sources/CodexBar/MenuBarDisplayText.swift:205-212 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:523-535 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/MenuBarDisplayText.swift:205` 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 (8–13 lines × 2) Sources/CodexBarCore/Config/CodexBarConfigValidation.swift:136 — Sources/CodexBarCore/Config/CodexBarConfigValidation.swift:136-143 | Sources/CodexBarCore/Config/CodexBarConfigValidation.swift:175-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12 lines × 4) · ×2
  • Duplicated block (12 lines × 4) Sources/CodexBar/MenuCardView.swift:74 — Sources/CodexBar/MenuCardView.swift:74-85 | Sources/CodexBar/SpendDashboardModel.swift:96-107 | Sources/CodexBarCore/PiSessionCostCache.swift:89-100 | Sources/CodexBarCore/Providers/ProviderFetchPlan.swift:172-183 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/MenuCardView.swift:74` 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 × 4) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:35 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:35-46 | Sources/CodexBarCore/Providers/Cursor/CursorProviderDescriptor.swift:39-50 | Sources/CodexBarCore/Providers/Gemini/GeminiProviderDescriptor.swift:14-25 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift:52-63 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift:49` calls `ProviderConfigCapabilities` and `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:32` 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–12 lines × 3) · ×2
  • Duplicated block (10–12 lines × 3) Sources/CodexBar/UsageStore+OpenAIWeb.swift:567 — Sources/CodexBar/UsageStore+OpenAIWeb.swift:567-578 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:729-738 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:792-801 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/UsageStore+OpenAIWeb.swift:567` 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 (10–12 lines × 3) Sources/CodexBarCore/Providers/Antigravity/AntigravityOAuthCredentialsStore.swift:54 — Sources/CodexBarCore/Providers/Antigravity/AntigravityOAuthCredentialsStore.swift:54-63 | Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:928-939 | Sources/CodexBarCore/Providers/VertexAI/VertexAIOAuth/VertexAIIDToken.swift:11-22 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Antigravity/AntigravityOAuthCredentialsStore.swift:54` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×2
  • Duplicated block (10–12 lines × 2) Sources/CodexBarCore/Providers/Devin/DevinSessionImporter.swift:188 — Sources/CodexBarCore/Providers/Devin/DevinSessionImporter.swift:188-197 | Sources/CodexBarCore/Providers/Windsurf/WindsurfDevinSessionImporter.swift:160-171 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (10–12 lines × 2) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:478 — Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:478-487 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:792-803 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:478` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×2
  • Duplicated block (11 lines × 3) Sources/CodexBarCore/CookieHeaderCache+Fingerprint.swift:11 — Sources/CodexBarCore/CookieHeaderCache+Fingerprint.swift:11-21 | Sources/CodexBarCore/CookieHeaderCache.swift:88-98 | Sources/CodexBarCore/CookieHeaderCache.swift:101-111 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CookieHeaderCache+Fingerprint.swift:11` 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 × 3) Sources/CodexBar/Providers/Antigravity/AntigravitySettingsStore.swift:76 — Sources/CodexBar/Providers/Antigravity/AntigravitySettingsStore.swift:76-86 | Sources/CodexBar/Providers/Kilo/KiloSettingsStore.swift:59-69 | Sources/CodexBar/Providers/Windsurf/WindsurfSettingsStore.swift:49-59 — 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 × 3) · ×2
  • Duplicated block (10 lines × 3) Sources/CodexBar/Providers/ClawRouter/ClawRouterProviderImplementation.swift:30 — Sources/CodexBar/Providers/ClawRouter/ClawRouterProviderImplementation.swift:30-39 | Sources/CodexBar/Providers/OpenCodeGo/OpenCodeGoProviderImplementation.swift:88-97 | Sources/CodexBar/Providers/OpenRouter/OpenRouterProviderImplementation.swift:41-50 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/ClawRouter/ClawRouterProviderImplementation.swift:30` 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 (10 lines × 3) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageError.swift:9 — Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageError.swift:9-18 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeUsageFetcher.swift:12-21 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:13-22 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageError.swift:9` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×2
  • Duplicated block (8–9 lines × 3) Sources/CodexBar/CostHistoryChartMenuView.swift:697 — Sources/CodexBar/CostHistoryChartMenuView.swift:697-705 | Sources/CodexBar/SpendDashboardModel.swift:1408-1415 | Sources/CodexBarCore/Providers/Mistral/MistralModels.swift:518-525 — 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. 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, `Sources/CodexBar/SpendDashboardModel.swift:1416` calls `bucketCalendar` and `Sources/CodexBar/CostHistoryChartMenuView.swift:706` 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 (8–9 lines × 3) Sources/CodexBarCore/Providers/Grok/GrokCreditsProxyFetcher.swift:28 — Sources/CodexBarCore/Providers/Grok/GrokCreditsProxyFetcher.swift:28-35 | Sources/CodexBarCore/Providers/Grok/GrokRemainingResetsFetcher.swift:340-348 | Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:269-276 — 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 `Sources/CodexBarCore/Providers/Grok/GrokCreditsProxyFetcher.swift:28` 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 (7–9 lines × 3) · ×2
  • Duplicated block (7–9 lines × 3) Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:26 — Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:26-32 | Sources/CodexBar/Providers/Factory/FactoryProviderImplementation.swift:49-57 | Sources/CodexBar/Providers/Kimi/KimiProviderImplementation.swift:58-65 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:26` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note 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 (7–9 lines × 3) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:234 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:234-242 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:252-260 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift:1032-1038 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×2
  • Duplicated block (6–7 lines × 2) Sources/CodexBar/ShareStatsPayload.swift:446 — Sources/CodexBar/ShareStatsPayload.swift:446-451 | Sources/CodexBar/ShareStatsPayload.swift:464-470 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/ShareStatsPayload.swift:446` 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–7 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:927 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:927-933 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardWebsiteDataStore.swift:53-58 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:927` 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.
D5 · Coupling · Off the main sequence · ×2
  • Off the main sequence: AdaptiveRefreshCore — AdaptiveRefreshCore: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 2 project(s), so it's rigid to change.
  • Off the main sequence: CodexBarCore — CodexBarCore: abstractness 0.02, instability 0.17, distance 0.82 — zone of pain — concrete and depended on by 5 project(s), so it's rigid to change.
R10 · Code Duplication · Duplicated block with local edits (149 matched lines × 2 locations) · ×2
  • Duplicated block with local edits (149 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/bifrost.js:39 — Sources/CodexBarCore/Resources/Plugins/bifrost.js:39 · Sources/CodexBarCore/Resources/Plugins/bifrost.ts:11 — the two spans are one implementation copied and then locally edited — 1403 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 (149 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/typesafe.js:23 — Sources/CodexBarCore/Resources/Plugins/typesafe.js:23 · Sources/CodexBarCore/Resources/Plugins/typesafe.ts:3 — the two spans are one implementation copied and then locally edited — 1311 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 (77 lines × 2 locations) · ×2
  • Duplicated block (77 lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/bifrost.js:276 — Sources/CodexBarCore/Resources/Plugins/bifrost.js:276 · Sources/CodexBarCore/Resources/Plugins/bifrost.ts:237 — 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 (77 lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/devpass.js:36 — Sources/CodexBarCore/Resources/Plugins/devpass.js:36 · Sources/CodexBarCore/Resources/Plugins/devpass.ts:8 — 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.
R2 · Cyclomatic Complexity · Complex function fetchUsage (cyclomatic 44, cognitive 60) · ×2
  • Complex function fetchUsage (cyclomatic 44, cognitive 60) REDACTED:11 — fetchUsage has cyclomatic complexity 44 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
  • Complex function fetchUsage (cyclomatic 44, cognitive 60) REDACTED:11 — fetchUsage has cyclomatic complexity 44 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function fetchUsage (cyclomatic 39, cognitive 53) · ×2
  • Complex function fetchUsage (cyclomatic 39, cognitive 53) Sources/CodexBarCore/Resources/Plugins/qwencloud-team.ts:9 — fetchUsage has cyclomatic complexity 39 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.
  • Complex function fetchUsage (cyclomatic 39, cognitive 53) Sources/CodexBarCore/Resources/Plugins/zed.js:12 — fetchUsage has cyclomatic complexity 39 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.
R7 · Dead Code · Dead file (~237 LoC) · ×2
  • Dead file (~237 LoC) Sources/CodexBarCore/Resources/Plugins/claudeplatform.js — no import path from any entry point (11 application, 14 tooling, 6 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
  • Dead file (~237 LoC) Sources/CodexBarCore/Resources/Plugins/claudeplatform.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~179 LoC) · ×2
  • Dead file (~179 LoC) Sources/CodexBarCore/Resources/Plugins/poe.js — no import path from any entry point (11 application, 14 tooling, 6 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
  • Dead file (~179 LoC) Sources/CodexBarCore/Resources/Plugins/typesafe.ts — no import path from any entry point (11 application, 14 tooling, 6 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
D1 · Cyclomatic Complexity · fetchUsage (cyclomatic 135) · ×1
  • fetchUsage (cyclomatic 135) Sources/CodexBarCore/Resources/Plugins/openrouter.js:24 — fetchUsage has cyclomatic complexity 135 (threshold 15). Of this number, 116 points are the body's own statements and 19 belong to 9 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TTYCommandRunner.run (cyclomatic 83) · ×1
  • TTYCommandRunner.run (cyclomatic 83) Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:455 — TTYCommandRunner.run has cyclomatic complexity 83 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (TTYCommandRunner.run::processNonCodexChunk) 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 · ProviderPluginManifest.init (cyclomatic 80) · ×1
  • ProviderPluginManifest.init (cyclomatic 80) REDACTED:127 — ProviderPluginManifest.init has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fetchUsage (cyclomatic 79) · ×1
  • fetchUsage (cyclomatic 79) Sources/CodexBarCore/Resources/Plugins/sub2api.js:10 — fetchUsage has cyclomatic complexity 79 (threshold 15). Of this number, 52 points are the body's own statements and 27 belong to 9 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · fetchUsage (cyclomatic 76) · ×1
  • fetchUsage (cyclomatic 76) Sources/CodexBarCore/Resources/Plugins/poe.js:15 — fetchUsage has cyclomatic complexity 76 (threshold 15). Of this number, 57 points are the body's own statements and 19 belong to 17 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 · applyProviderPluginPrelude (cyclomatic 68) · ×1
  • applyProviderPluginPrelude (cyclomatic 68) REDACTED:2 — applyProviderPluginPrelude has cyclomatic complexity 68 (threshold 15). Most of this is not in the body itself: 1 of the 68 points is its own statement and the rest belongs to 52 function items inside it that branch (formatNumber, postOptions, a function literal at line 105, …). 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 · fetchUsage (cyclomatic 67) · ×1
  • fetchUsage (cyclomatic 67) REDACTED:11 — fetchUsage has cyclomatic complexity 67 (threshold 15). Of this number, 43 points are the body's own statements and 24 belong to 8 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 · fetchUsage (cyclomatic 66) · ×1
  • fetchUsage (cyclomatic 66) Sources/CodexBarCore/Resources/Plugins/zai.js:24 — fetchUsage has cyclomatic complexity 66 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fetchUsage (cyclomatic 62) · ×1
  • fetchUsage (cyclomatic 62) Sources/CodexBarCore/Resources/Plugins/openai.js:14 — fetchUsage 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 · ProviderPluginCookiePolicy.init (cyclomatic 61) · ×1
  • ProviderPluginCookiePolicy.init (cyclomatic 61) Sources/CodexBarCore/Plugins/ProviderPluginCookiePolicy.swift:42 — ProviderPluginCookiePolicy.init has cyclomatic complexity 61 (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 · fetchUsage (cyclomatic 60) · ×1
  • fetchUsage (cyclomatic 60) Sources/CodexBarCore/Resources/Plugins/deepgram.js:11 — fetchUsage has cyclomatic complexity 60 (threshold 15). Of this number, 25 points are the body's own statements and 35 belong to 8 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 · CostUsageFetcher.loadTokenResult (cyclomatic 56) · ×1
  • CostUsageFetcher.loadTokenResult (cyclomatic 56) Sources/CodexBarCore/CostUsageFetcher.swift:466 — CostUsageFetcher.loadTokenResult 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 · AntigravityOAuthConfig.binaryClient (cyclomatic 56) · ×1
  • AntigravityOAuthConfig.binaryClient (cyclomatic 56) Sources/CodexBarCore/Providers/Antigravity/AntigravityOAuthCredentialsStore.swift:322 — AntigravityOAuthConfig.binaryClient has cyclomatic complexity 56 (threshold 15). Of this number, 50 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Usage.rows (cyclomatic 55) · ×1
  • Usage.rows (cyclomatic 55) Integrations/Linux/Shared/Usage.js:39 — Usage.rows has cyclomatic complexity 55 (threshold 15). Most of this is not in the body itself: 5 of the 55 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 44, 57, 61, …). 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 · UsageStore.limitResetDetectorTransition (cyclomatic 54) · ×1
  • UsageStore.limitResetDetectorTransition (cyclomatic 54) Sources/CodexBar/UsageStore+LimitResetCelebration.swift:299 — UsageStore.limitResetDetectorTransition has cyclomatic complexity 54 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · fetchUsage (cyclomatic 52) · ×1
  • fetchUsage (cyclomatic 52) Sources/CodexBarCore/Resources/Plugins/t3chat.js:12 — fetchUsage has cyclomatic complexity 52 (threshold 15). Of this number, 41 points are the body's own statements and 11 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 · fetchUsage (cyclomatic 50) · ×1
  • fetchUsage (cyclomatic 50) Sources/CodexBarCore/Resources/Plugins/zed.js:12 — fetchUsage has cyclomatic complexity 50 (threshold 15). Of this number, 39 points are the body's own statements and 11 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StatusItemController.applyIcon (cyclomatic 48) · ×1
  • StatusItemController.applyIcon (cyclomatic 48) Sources/CodexBar/StatusItemController+Animation.swift:340 — StatusItemController.applyIcon has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fetchUsage (cyclomatic 48) · ×1
  • fetchUsage (cyclomatic 48) REDACTED:11 — fetchUsage has cyclomatic complexity 48 (threshold 15). Of this number, 39 points are the body's own statements and 9 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UsageStore.menuCardInput (cyclomatic 47) · ×1
  • UsageStore.menuCardInput (cyclomatic 47) Sources/CodexBar/UsageStore+MenuCardModel.swift:50 — UsageStore.menuCardInput has cyclomatic complexity 47 (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 · UsageStore.handleProviderFetchFailure (cyclomatic 46) · ×1
  • UsageStore.handleProviderFetchFailure (cyclomatic 46) Sources/CodexBar/UsageStore+Refresh.swift:1304 — UsageStore.handleProviderFetchFailure has cyclomatic complexity 46 (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 · fetchUsage (cyclomatic 46) · ×1
  • fetchUsage (cyclomatic 46) REDACTED:8 — fetchUsage has cyclomatic complexity 46 (threshold 15). Of this number, 21 points are the body's own statements and 25 belong to 14 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StatusItemController.populateMenu (cyclomatic 45) · ×1
  • StatusItemController.populateMenu (cyclomatic 45) Sources/CodexBar/StatusItemController+Menu.swift:221 — StatusItemController.populateMenu 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 · fetchUsage (cyclomatic 44) · ×1
  • fetchUsage (cyclomatic 44) REDACTED:10 — fetchUsage 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 · MenuBarLayoutRenderer.renderUncached (cyclomatic 43) · ×1
  • MenuBarLayoutRenderer.renderUncached (cyclomatic 43) Sources/CodexBar/MenuBarLayoutRenderer.swift:422 — MenuBarLayoutRenderer.renderUncached has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClaudeCLISession.captureExclusive (cyclomatic 43) · ×1
  • ClaudeCLISession.captureExclusive (cyclomatic 43) Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:143 — ClaudeCLISession.captureExclusive has cyclomatic complexity 43 (threshold 15). Of this number, 42 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 · fetchUsage (cyclomatic 42) · ×1
  • fetchUsage (cyclomatic 42) Sources/CodexBarCore/Resources/Plugins/clawrouter.js:16 — fetchUsage has cyclomatic complexity 42 (threshold 15). Of this number, 30 points are the body's own statements and 12 belong to 8 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 · CostUsageFetcher.loadCachedCodexTokenSnapshotResult (cyclomatic 41) · ×1
  • CostUsageFetcher.loadCachedCodexTokenSnapshotResult (cyclomatic 41) Sources/CodexBarCore/CostUsageFetcher.swift:1369 — CostUsageFetcher.loadCachedCodexTokenSnapshotResult 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 · PiSessionCostScanner.loadDailyReportResultCancellable (cyclomatic 41) · ×1
  • PiSessionCostScanner.loadDailyReportResultCancellable (cyclomatic 41) Sources/CodexBarCore/PiSessionCostScanner.swift:155 — PiSessionCostScanner.loadDailyReportResultCancellable 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 · CodexCLISession.captureStatus (cyclomatic 40) · ×1
  • CodexCLISession.captureStatus (cyclomatic 40) Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:52 — CodexCLISession.captureStatus has cyclomatic complexity 40 (threshold 15). Of this number, 39 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 · CodexRequestLedger.load (cyclomatic 37) · ×1
  • CodexRequestLedger.load (cyclomatic 37) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift:65 — CodexRequestLedger.load has cyclomatic complexity 37 (threshold 15). Of this number, 35 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · install.main (cyclomatic 37) · ×1
  • install.main (cyclomatic 37) Integrations/Linux/install.py:61 — install.main 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 · fetchUsage (cyclomatic 37) · ×1
  • fetchUsage (cyclomatic 37) Sources/CodexBarCore/Resources/Plugins/manus.js:8 — fetchUsage has cyclomatic complexity 37 (threshold 15). Of this number, 25 points are the body's own statements and 12 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 · CodexBarCLI.topCostModelLines (cyclomatic 36) · ×1
  • CodexBarCLI.topCostModelLines (cyclomatic 36) Sources/CodexBarCLI/CLICostCommand.swift:363 — CodexBarCLI.topCostModelLines has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIDashboardFetcher.collectPageSnapshot (cyclomatic 34) · ×1
  • OpenAIDashboardFetcher.collectPageSnapshot (cyclomatic 34) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher+PageScrape.swift:34 — OpenAIDashboardFetcher.collectPageSnapshot has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AmpUsageParser.parse (cyclomatic 34) · ×1
  • AmpUsageParser.parse (cyclomatic 34) Sources/CodexBarCore/Providers/Amp/AmpUsageParser.swift:20 — AmpUsageParser.parse has cyclomatic complexity 34 (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 · Model.extraRateWindowMetrics (cyclomatic 33) · ×1
  • Model.extraRateWindowMetrics (cyclomatic 33) Sources/CodexBar/MenuCardView+ModelHelpers.swift:945 — Model.extraRateWindowMetrics has cyclomatic complexity 33 (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 · MenuBarLayoutRenderer.renderItem (cyclomatic 33) · ×1
  • MenuBarLayoutRenderer.renderItem (cyclomatic 33) Sources/CodexBar/MenuBarLayoutRenderer.swift:727 — MenuBarLayoutRenderer.renderItem 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 · SessionEquivalentBurnEstimator.estimate (cyclomatic 33) · ×1
  • SessionEquivalentBurnEstimator.estimate (cyclomatic 33) Sources/CodexBar/SessionEquivalentForecast.swift:172 — SessionEquivalentBurnEstimator.estimate 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 · UsageStore.applyProviderRefreshSuccess (cyclomatic 33) · ×1
  • UsageStore.applyProviderRefreshSuccess (cyclomatic 33) Sources/CodexBar/UsageStore+Refresh.swift:630 — UsageStore.applyProviderRefreshSuccess has cyclomatic complexity 33 (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 · MuseLocalUsageReader.parseLine (cyclomatic 33) · ×1
  • MuseLocalUsageReader.parseLine (cyclomatic 33) Sources/CodexBarCore/Providers/Muse/MuseLocalUsageReader.swift:496 — MuseLocalUsageReader.parseLine 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 · CostHistoryChartMenuView.body (cyclomatic 32) · ×1
  • CostHistoryChartMenuView.body (cyclomatic 32) Sources/CodexBar/CostHistoryChartMenuView.swift:119 — CostHistoryChartMenuView.body has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UsageStore.reconcileClaudeRefreshAfterFetch (cyclomatic 32) · ×1
  • UsageStore.reconcileClaudeRefreshAfterFetch (cyclomatic 32) Sources/CodexBar/UsageStore+Refresh.swift:492 — UsageStore.reconcileClaudeRefreshAfterFetch 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 · CodexWeeklyResetConfirmation.evaluateDelayedCandidateCreation (cyclomatic 32) · ×1
  • CodexWeeklyResetConfirmation.evaluateDelayedCandidateCreation (cyclomatic 32) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:231 — CodexWeeklyResetConfirmation.evaluateDelayedCandidateCreation has cyclomatic complexity 32 (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 · CodexWeeklyResetConfirmation.evaluateDelayedCandidate (cyclomatic 32) · ×1
  • CodexWeeklyResetConfirmation.evaluateDelayedCandidate (cyclomatic 32) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:292 — CodexWeeklyResetConfirmation.evaluateDelayedCandidate has cyclomatic complexity 32 (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 · CodexBarConfigValidator.validateProvider (cyclomatic 32) · ×1
  • CodexBarConfigValidator.validateProvider (cyclomatic 32) Sources/CodexBarCore/Config/CodexBarConfigValidation.swift:112 — CodexBarConfigValidator.validateProvider 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 · fetchUsage (cyclomatic 32) · ×1
  • fetchUsage (cyclomatic 32) Sources/CodexBarCore/Resources/Plugins/traecn.js:9 — fetchUsage has cyclomatic complexity 32 (threshold 15). Of this number, 19 points are the body's own statements and 13 belong to 6 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SpendDashboardModel.buildCurrencyGroup (cyclomatic 31) · ×1
  • SpendDashboardModel.buildCurrencyGroup (cyclomatic 31) Sources/CodexBar/SpendDashboardModel.swift:588 — SpendDashboardModel.buildCurrencyGroup has cyclomatic complexity 31 (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 · fetchUsage (cyclomatic 31) · ×1
  • fetchUsage (cyclomatic 31) Sources/CodexBarCore/Resources/Plugins/perplexity.js:8 — fetchUsage 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 · Model.secondaryMetric (cyclomatic 30) · ×1
  • Model.secondaryMetric (cyclomatic 30) Sources/CodexBar/MenuCardView.swift:1382 — Model.secondaryMetric 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 · ProviderSettingsTokenAccountsRowView.body (cyclomatic 30) · ×1
  • ProviderSettingsTokenAccountsRowView.body (cyclomatic 30) Sources/CodexBar/PreferencesProviderSettingsRows.swift:248 — ProviderSettingsTokenAccountsRowView.body 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 · SpendDashboardModel.modelSummary (cyclomatic 30) · ×1
  • SpendDashboardModel.modelSummary (cyclomatic 30) Sources/CodexBar/SpendDashboardModel+ModelBreakdown.swift:31 — SpendDashboardModel.modelSummary 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 · UsageStore.handleSessionQuotaTransition (cyclomatic 30) · ×1
  • UsageStore.handleSessionQuotaTransition (cyclomatic 30) Sources/CodexBar/UsageStore+SessionQuotaTransition.swift:7 — UsageStore.handleSessionQuotaTransition 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 · UsageStore.refreshCodexVisibleAccountsForMenu (cyclomatic 30) · ×1
  • UsageStore.refreshCodexVisibleAccountsForMenu (cyclomatic 30) Sources/CodexBar/UsageStore+TokenAccounts.swift:150 — UsageStore.refreshCodexVisibleAccountsForMenu 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 · AlibabaCodingPlanUsageFetcher.parseUsageSnapshot (cyclomatic 30) · ×1
  • AlibabaCodingPlanUsageFetcher.parseUsageSnapshot (cyclomatic 30) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:443 — AlibabaCodingPlanUsageFetcher.parseUsageSnapshot 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 · GrokWebBillingFetcher.parseGRPCWebResponse (cyclomatic 30) · ×1
  • GrokWebBillingFetcher.parseGRPCWebResponse (cyclomatic 30) Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:312 — GrokWebBillingFetcher.parseGRPCWebResponse has cyclomatic complexity 30 (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 · UsageMenuCardView.body (cyclomatic 29) · ×1
  • UsageMenuCardView.body (cyclomatic 29) Sources/CodexBar/MenuCardView.swift:219 — UsageMenuCardView.body has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MenuDescriptor.usageSection (cyclomatic 29) · ×1
  • MenuDescriptor.usageSection (cyclomatic 29) Sources/CodexBar/MenuDescriptor.swift:250 — MenuDescriptor.usageSection has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MenuDescriptor.accountEntries (cyclomatic 29) · ×1
  • MenuDescriptor.accountEntries (cyclomatic 29) Sources/CodexBar/MenuDescriptor.swift:434 — MenuDescriptor.accountEntries has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionQuotaTransitionReducer.evaluate (cyclomatic 29) · ×1
  • SessionQuotaTransitionReducer.evaluate (cyclomatic 29) Sources/CodexBar/SessionQuotaNotifications.swift:155 — SessionQuotaTransitionReducer.evaluate has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StatusItemController.menuBarDisplayText (cyclomatic 29) · ×1
  • StatusItemController.menuBarDisplayText (cyclomatic 29) Sources/CodexBar/StatusItemController+Animation.swift:748 — StatusItemController.menuBarDisplayText has cyclomatic complexity 29 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · UsageStore.importOpenAIDashboardCookiesIfNeeded (cyclomatic 29) · ×1
  • UsageStore.importOpenAIDashboardCookiesIfNeeded (cyclomatic 29) Sources/CodexBar/UsageStore+OpenAIWeb.swift:1182 — UsageStore.importOpenAIDashboardCookiesIfNeeded has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CodexWeeklyResetConfirmation.confirmationDecision (cyclomatic 29) · ×1
  • CodexWeeklyResetConfirmation.confirmationDecision (cyclomatic 29) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:152 — CodexWeeklyResetConfirmation.confirmationDecision 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 · JavaScriptCoreProviderPluginEngine.makeContext (cyclomatic 29) · ×1
  • JavaScriptCoreProviderPluginEngine.makeContext (cyclomatic 29) Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:639 — JavaScriptCoreProviderPluginEngine.makeContext 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 · QoderCookieRouting.preprocessedCurlShellText (cyclomatic 29) · ×1
  • QoderCookieRouting.preprocessedCurlShellText (cyclomatic 29) Sources/CodexBarCore/Providers/Qoder/QoderCookieRouting.swift:399 — QoderCookieRouting.preprocessedCurlShellText has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · fetchUsage (cyclomatic 29) · ×1
  • fetchUsage (cyclomatic 29) REDACTED:8 — fetchUsage has cyclomatic complexity 29 (threshold 15). Of this number, 17 points are the body's own statements and 12 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 · Model.metrics (cyclomatic 28) · ×1
  • Model.metrics (cyclomatic 28) Sources/CodexBar/MenuCardView.swift:1206 — Model.metrics 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 · HistoricalUsageHistoryStore.backfillCodexWeeklyFromUsageBreakdown (cyclomatic 28) · ×1
  • HistoricalUsageHistoryStore.backfillCodexWeeklyFromUsageBreakdown (cyclomatic 28) Sources/CodexBar/HistoricalUsagePace.swift:154 — HistoricalUsageHistoryStore.backfillCodexWeeklyFromUsageBreakdown 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 · IconRenderer.makeIcon (cyclomatic 28) · ×1
  • IconRenderer.makeIcon (cyclomatic 28) Sources/CodexBar/IconRenderer.swift:142 — IconRenderer.makeIcon 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. This shape REPEATS in the file: one other method here (IconRenderer.makeIcon::drawBar) 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 · UsageStore.runCodexCostCatchUp (cyclomatic 28) · ×1
  • UsageStore.runCodexCostCatchUp (cyclomatic 28) Sources/CodexBar/UsageStore+CodexCostCatchUp.swift:107 — UsageStore.runCodexCostCatchUp 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 · SignatureReader.slice (cyclomatic 28) · ×1
  • SignatureReader.slice (cyclomatic 28) Sources/CodexBarCore/CodexLaunchPreflight+SignatureIdentity.swift:89 — SignatureReader.slice 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 · PiFamilySessionScanner.costSessionRoots (cyclomatic 28) · ×1
  • PiFamilySessionScanner.costSessionRoots (cyclomatic 28) Sources/CodexBarCore/PiFamilySessionScanner.swift:391 — PiFamilySessionScanner.costSessionRoots has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProviderPluginCookieBroker.advance (cyclomatic 28) · ×1
  • ProviderPluginCookieBroker.advance (cyclomatic 28) Sources/CodexBarCore/Plugins/ProviderPluginCookieBroker.swift:301 — ProviderPluginCookieBroker.advance 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 · Lexer.number (cyclomatic 28) · ×1
  • Lexer.number (cyclomatic 28) Sources/CodexBarCore/Providers/Antigravity/AntigravityJSONLObject.swift:116 — Lexer.number has cyclomatic complexity 28 (threshold 15). Of this number, 24 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CursorStatusProbe.parseUsageSummary (cyclomatic 28) · ×1
  • CursorStatusProbe.parseUsageSummary (cyclomatic 28) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe+UsageSummary.swift:5 — CursorStatusProbe.parseUsageSummary has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · KiroUsageSnapshot.toUsageSnapshot (cyclomatic 28) · ×1
  • KiroUsageSnapshot.toUsageSnapshot (cyclomatic 28) Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:108 — KiroUsageSnapshot.toUsageSnapshot 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 · Model.costHistoryInlineDashboard (cyclomatic 27) · ×1
  • Model.costHistoryInlineDashboard (cyclomatic 27) Sources/CodexBar/InlineUsageDashboardContent.swift:272 — Model.costHistoryInlineDashboard has cyclomatic complexity 27 (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 · SpendDashboardController.handleBuiltRequest (cyclomatic 27) · ×1
  • SpendDashboardController.handleBuiltRequest (cyclomatic 27) Sources/CodexBar/SpendDashboardController.swift:1415 — SpendDashboardController.handleBuiltRequest 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 · SpendDashboardModel.projectRows (cyclomatic 27) · ×1
  • SpendDashboardModel.projectRows (cyclomatic 27) Sources/CodexBar/SpendDashboardModel.swift:835 — SpendDashboardModel.projectRows 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 · UsageStore.resolvePlanUtilizationAccountKey (cyclomatic 27) · ×1
  • UsageStore.resolvePlanUtilizationAccountKey (cyclomatic 27) Sources/CodexBar/UsageStore+PlanUtilization.swift:1077 — UsageStore.resolvePlanUtilizationAccountKey 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 · UsageStore.refreshTokenUsage (cyclomatic 27) · ×1
  • UsageStore.refreshTokenUsage (cyclomatic 27) Sources/CodexBar/UsageStore.swift:1447 — UsageStore.refreshTokenUsage 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 · PiSessionCostScanner.parsePiSessionFile (cyclomatic 27) · ×1
  • PiSessionCostScanner.parsePiSessionFile (cyclomatic 27) Sources/CodexBarCore/PiSessionCostScanner.swift:832 — PiSessionCostScanner.parsePiSessionFile has cyclomatic complexity 27 (threshold 15). Of this number, 23 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ProviderPluginHTTPResponse.request (cyclomatic 27) · ×1
  • ProviderPluginHTTPResponse.request (cyclomatic 27) Sources/CodexBarCore/Plugins/ProviderPluginHTTPResponse.swift:224 — ProviderPluginHTTPResponse.request 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 · CursorStatusProbe.resolveSession (cyclomatic 27) · ×1
  • CursorStatusProbe.resolveSession (cyclomatic 27) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe+SessionResolution.swift:37 — CursorStatusProbe.resolveSession 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 · KiloUsageFetcher.creditFields (cyclomatic 27) · ×1
  • KiloUsageFetcher.creditFields (cyclomatic 27) Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:579 — KiloUsageFetcher.creditFields 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 · MiniMaxLocalStorageImporter.readLocalStorage (cyclomatic 27) · ×1
  • MiniMaxLocalStorageImporter.readLocalStorage (cyclomatic 27) Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:137 — MiniMaxLocalStorageImporter.readLocalStorage 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 · OllamaUsageParser.looksSignedOut (cyclomatic 27) · ×1
  • OllamaUsageParser.looksSignedOut (cyclomatic 27) Sources/CodexBarCore/Providers/Ollama/OllamaUsageParser.swift:216 — OllamaUsageParser.looksSignedOut 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 · CodexHistoricalPaceEvaluator.evaluate (cyclomatic 26) · ×1
  • CodexHistoricalPaceEvaluator.evaluate (cyclomatic 26) Sources/CodexBar/HistoricalUsagePace.swift:758 — CodexHistoricalPaceEvaluator.evaluate 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 · SpendDashboardSource.makeRequest (cyclomatic 26) · ×1
  • SpendDashboardSource.makeRequest (cyclomatic 26) Sources/CodexBar/SpendDashboardController.swift:223 — SpendDashboardSource.makeRequest has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · StatusItemController.addActionableSections (cyclomatic 26) · ×1
  • StatusItemController.addActionableSections (cyclomatic 26) Sources/CodexBar/StatusItemController+Menu.swift:850 — StatusItemController.addActionableSections has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UsageStore.shouldExcludeFromHighestUsage (cyclomatic 26) · ×1
  • UsageStore.shouldExcludeFromHighestUsage (cyclomatic 26) Sources/CodexBar/UsageStore+HighestUsage.swift:92 — UsageStore.shouldExcludeFromHighestUsage has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UsageStore.codexWeeklyResetDecision (cyclomatic 26) · ×1
  • UsageStore.codexWeeklyResetDecision (cyclomatic 26) Sources/CodexBar/UsageStore+LimitResetCelebration.swift:438 — UsageStore.codexWeeklyResetDecision has cyclomatic complexity 26 (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 · UsageStore.handleQuotaWarningTransitions (cyclomatic 26) · ×1
  • UsageStore.handleQuotaWarningTransitions (cyclomatic 26) Sources/CodexBar/UsageStore+QuotaWarnings.swift:36 — UsageStore.handleQuotaWarningTransitions 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 · UsageStore.makeWidgetEntry (cyclomatic 26) · ×1
  • UsageStore.makeWidgetEntry (cyclomatic 26) Sources/CodexBar/UsageStore+WidgetSnapshot.swift:235 — UsageStore.makeWidgetEntry 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 · CodexBarCLI.runStandardCost (cyclomatic 26) · ×1
  • CodexBarCLI.runStandardCost (cyclomatic 26) Sources/CodexBarCLI/CLICostCommand.swift:18 — CodexBarCLI.runStandardCost has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SignatureReader.validate (cyclomatic 26) · ×1
  • SignatureReader.validate (cyclomatic 26) Sources/CodexBarCore/CodexLaunchPreflight+SignatureIdentity.swift:131 — SignatureReader.validate has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PiFamilySessionScanner.retainedSettingsRootResolution (cyclomatic 26) · ×1
  • PiFamilySessionScanner.retainedSettingsRootResolution (cyclomatic 26) Sources/CodexBarCore/PiFamilySessionScanner.swift:756 — PiFamilySessionScanner.retainedSettingsRootResolution has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CopilotBudgetWebFetcher.normalizedBillingIdentifier (cyclomatic 26) · ×1
  • CopilotBudgetWebFetcher.normalizedBillingIdentifier (cyclomatic 26) Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:651 — CopilotBudgetWebFetcher.normalizedBillingIdentifier has cyclomatic complexity 26 (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 · OpenCodeGoLocalUsageFetchStrategy.snapshot (cyclomatic 26) · ×1
  • OpenCodeGoLocalUsageFetchStrategy.snapshot (cyclomatic 26) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift:229 — OpenCodeGoLocalUsageFetchStrategy.snapshot has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Repository.loadRecord (cyclomatic 26) · ×1
  • Repository.loadRecord (cyclomatic 26) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:336 — Repository.loadRecord has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BurnTheme.init (cyclomatic 26) · ×1
  • BurnTheme.init (cyclomatic 26) Sources/CodexBarWidget/BurnDownWidgetViews.swift:550 — BurnTheme.init has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.swift.top-level code (cyclomatic 26) · ×1
  • main.swift.top-level code (cyclomatic 26) Scripts/StoreStress/main.swift:25 — main.swift.top-level code has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chutes.chutesQuota (cyclomatic 26) · ×1
  • chutes.chutesQuota (cyclomatic 26) Sources/CodexBarCore/Resources/Plugins/chutes.ts:149 — chutes.chutesQuota has cyclomatic complexity 26 (threshold 15). Of this number, 18 points are the body's own statements and 8 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 · StatusItemController.startManualRefresh (cyclomatic 25) · ×1
  • StatusItemController.startManualRefresh (cyclomatic 25) Sources/CodexBar/StatusItemController+Actions.swift:180 — StatusItemController.startManualRefresh 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 · UsageStore.hydrateCachedTokenSnapshots (cyclomatic 25) · ×1
  • UsageStore.hydrateCachedTokenSnapshots (cyclomatic 25) Sources/CodexBar/UsageStore+TokenCost.swift:387 — UsageStore.hydrateCachedTokenSnapshots 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 · UsageStore.debugLog (cyclomatic 25) · ×1
  • UsageStore.debugLog (cyclomatic 25) Sources/CodexBar/UsageStore.swift:1043 — UsageStore.debugLog 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 · UsageStore.refreshCreditsIfNeeded (cyclomatic 25) · ×1
  • UsageStore.refreshCreditsIfNeeded (cyclomatic 25) Sources/CodexBar/Providers/Codex/UsageStore+CodexRefresh.swift:124 — UsageStore.refreshCreditsIfNeeded 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 · CodexBarCLI.main (cyclomatic 25) · ×1
  • CodexBarCLI.main (cyclomatic 25) Sources/CodexBarCLI/CLIEntry.swift:20 — CodexBarCLI.main has cyclomatic complexity 25 (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 · AntigravityLocalReader.readDatabase (cyclomatic 25) · ×1
  • AntigravityLocalReader.readDatabase (cyclomatic 25) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift:133 — AntigravityLocalReader.readDatabase 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 · BurnDownLayout.body (cyclomatic 25) · ×1
  • BurnDownLayout.body (cyclomatic 25) Sources/CodexBarWidget/BurnDownWidgetViews.swift:66 — BurnDownLayout.body 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 · Model.tokenUsageSection (cyclomatic 24) · ×1
  • Model.tokenUsageSection (cyclomatic 24) Sources/CodexBar/MenuCardView+Costs.swift:210 — Model.tokenUsageSection 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 · Model.providerCostSection (cyclomatic 24) · ×1
  • Model.providerCostSection (cyclomatic 24) Sources/CodexBar/MenuCardView+Costs.swift:471 — Model.providerCostSection 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 · MenuBarLayoutBalanceResolver.balance (cyclomatic 24) · ×1
  • MenuBarLayoutBalanceResolver.balance (cyclomatic 24) Sources/CodexBar/MenuBarLayout.swift:684 — MenuBarLayoutBalanceResolver.balance 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 · MenuBarLayoutPersistence.preferredLibrary (cyclomatic 24) · ×1
  • MenuBarLayoutPersistence.preferredLibrary (cyclomatic 24) Sources/CodexBar/MenuBarLayout.swift:1303 — MenuBarLayoutPersistence.preferredLibrary 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 · MenuBarLayoutRenderer.removeDuplicateBalanceResets (cyclomatic 24) · ×1
  • MenuBarLayoutRenderer.removeDuplicateBalanceResets (cyclomatic 24) Sources/CodexBar/MenuBarLayoutRenderer.swift:564 — MenuBarLayoutRenderer.removeDuplicateBalanceResets has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: MenuBarLayoutConditional.value (cyclomatic 25) 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 · UsageStore.recordPlanUtilizationHistorySample (cyclomatic 24) · ×1
  • UsageStore.recordPlanUtilizationHistorySample (cyclomatic 24) Sources/CodexBar/UsageStore+PlanUtilization.swift:210 — UsageStore.recordPlanUtilizationHistorySample 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 · UsageStore.planUtilizationSeriesSamples (cyclomatic 24) · ×1
  • UsageStore.planUtilizationSeriesSamples (cyclomatic 24) Sources/CodexBar/UsageStore+PlanUtilization.swift:561 — UsageStore.planUtilizationSeriesSamples has cyclomatic complexity 24 (threshold 15). Of this number, 16 points are the body's own statements and 8 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 · UsageStore.resolvedClaudeOAuthHistoryOwner (cyclomatic 24) · ×1
  • UsageStore.resolvedClaudeOAuthHistoryOwner (cyclomatic 24) Sources/CodexBar/UsageStore+PlanUtilization.swift:998 — UsageStore.resolvedClaudeOAuthHistoryOwner 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 · UsageStore.refreshSpendDashboardTokenUsageNow (cyclomatic 24) · ×1
  • UsageStore.refreshSpendDashboardTokenUsageNow (cyclomatic 24) Sources/CodexBar/UsageStore+SpendDashboardTokenCost.swift:70 — UsageStore.refreshSpendDashboardTokenUsageNow 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 · CodexBarCLI.runCodexIdentifiedUsage (cyclomatic 24) · ×1
  • CodexBarCLI.runCodexIdentifiedUsage (cyclomatic 24) Sources/CodexBarCLI/CLICodexIdentifiedUsage.swift:20 — CodexBarCLI.runCodexIdentifiedUsage 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 · CodexThreadMetadataReader.decodeMultilineBasicString (cyclomatic 24) · ×1
  • CodexThreadMetadataReader.decodeMultilineBasicString (cyclomatic 24) Sources/CodexBarCore/CodexThreadMetadataReader.swift:373 — CodexThreadMetadataReader.decodeMultilineBasicString has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · QuickJSProviderPluginEngine.handleHostCall (cyclomatic 24) · ×1
  • QuickJSProviderPluginEngine.handleHostCall (cyclomatic 24) Sources/CodexBarCore/Plugins/QuickJSProviderPluginEngine.swift:542 — QuickJSProviderPluginEngine.handleHostCall has cyclomatic complexity 24 (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 · ProviderDiagnosticFetchAttempt.errorCategoryLabel (cyclomatic 24) · ×1
  • ProviderDiagnosticFetchAttempt.errorCategoryLabel (cyclomatic 24) Sources/CodexBarCore/Providers/ProviderDiagnosticExport.swift:328 — ProviderDiagnosticFetchAttempt.errorCategoryLabel 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 · AmpUsageSnapshot.toUsageSnapshot (cyclomatic 24) · ×1
  • AmpUsageSnapshot.toUsageSnapshot (cyclomatic 24) Sources/CodexBarCore/Providers/Amp/AmpUsageSnapshot.swift:91 — AmpUsageSnapshot.toUsageSnapshot 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 · AntigravityLocalReader.aggregate (cyclomatic 24) · ×1
  • AntigravityLocalReader.aggregate (cyclomatic 24) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalReader.swift:187 — AntigravityLocalReader.aggregate 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 · CodexRequestLedger.validate (cyclomatic 24) · ×1
  • CodexRequestLedger.validate (cyclomatic 24) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift:31 — CodexRequestLedger.validate 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 · ManagedCodexAccountCredentialResolver.resolve (cyclomatic 24) · ×1
  • ManagedCodexAccountCredentialResolver.resolve (cyclomatic 24) Sources/CodexBarCore/Providers/Codex/ManagedCodexAccountCredentialResolver.swift:155 — ManagedCodexAccountCredentialResolver.resolve 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 · KimiDesktopSessionDiscovery.accessToken (cyclomatic 24) · ×1
  • KimiDesktopSessionDiscovery.accessToken (cyclomatic 24) Sources/CodexBarCore/Providers/Kimi/KimiDesktopSessionDiscovery.swift:55 — KimiDesktopSessionDiscovery.accessToken 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 · MistralUsageSnapshot.toCostUsageTokenSnapshot (cyclomatic 24) · ×1
  • MistralUsageSnapshot.toCostUsageTokenSnapshot (cyclomatic 24) Sources/CodexBarCore/Providers/Mistral/MistralModels.swift:264 — MistralUsageSnapshot.toCostUsageTokenSnapshot 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 · localization-formats.pluralCatalogErrors (cyclomatic 24) · ×1
  • localization-formats.pluralCatalogErrors (cyclomatic 24) Scripts/localization-formats.mjs:46 — localization-formats.pluralCatalogErrors has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · social-card.imageDimensions (cyclomatic 24) · ×1
  • social-card.imageDimensions (cyclomatic 24) REDACTED:30 — social-card.imageDimensions 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 · SessionEquivalentBurnEstimator.normalizedBurn (cyclomatic 23) · ×1
  • SessionEquivalentBurnEstimator.normalizedBurn (cyclomatic 23) Sources/CodexBar/SessionEquivalentForecast.swift:286 — SessionEquivalentBurnEstimator.normalizedBurn 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 · UsageStore.runRefresh (cyclomatic 23) · ×1
  • UsageStore.runRefresh (cyclomatic 23) Sources/CodexBar/UsageStore.swift:766 — UsageStore.runRefresh 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 · UsageStore.refreshProviderPass (cyclomatic 23) · ×1
  • UsageStore.refreshProviderPass (cyclomatic 23) Sources/CodexBar/UsageStore+Refresh.swift:293 — UsageStore.refreshProviderPass 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 · UsageStore.runSpendDashboardCodexCostCatchUp (cyclomatic 23) · ×1
  • UsageStore.runSpendDashboardCodexCostCatchUp (cyclomatic 23) Sources/CodexBar/UsageStore+SpendDashboardCodexCostCatchUp.swift:143 — UsageStore.runSpendDashboardCodexCostCatchUp has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UsageStore.codexOutcomeAdmittedForPublication (cyclomatic 23) · ×1
  • UsageStore.codexOutcomeAdmittedForPublication (cyclomatic 23) Sources/CodexBar/Providers/Codex/UsageStore+CodexWeeklyResetConfirmation.swift:31 — UsageStore.codexOutcomeAdmittedForPublication has cyclomatic complexity 23 (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 · CodexWeeklyResetConfirmation.initialDecision (cyclomatic 23) · ×1
  • CodexWeeklyResetConfirmation.initialDecision (cyclomatic 23) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:87 — CodexWeeklyResetConfirmation.initialDecision 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 · CodexBarCLI.fetchUsageOutput (cyclomatic 23) · ×1
  • CodexBarCLI.fetchUsageOutput (cyclomatic 23) Sources/CodexBarCLI/CLIUsageCommand.swift:423 — CodexBarCLI.fetchUsageOutput 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 · QuotaSnapshots.init (cyclomatic 23) · ×1
  • QuotaSnapshots.init (cyclomatic 23) Sources/CodexBarCore/CopilotUsageModels.swift:233 — QuotaSnapshots.init 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 · KeychainCacheStore.storeResult (cyclomatic 23) · ×1
  • KeychainCacheStore.storeResult (cyclomatic 23) Sources/CodexBarCore/KeychainCacheStore.swift:171 — KeychainCacheStore.storeResult 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 · PiSessionCostScanner.appendingPreviousSessionRoots (cyclomatic 23) · ×1
  • PiSessionCostScanner.appendingPreviousSessionRoots (cyclomatic 23) Sources/CodexBarCore/PiSessionCostScanner.swift:496 — PiSessionCostScanner.appendingPreviousSessionRoots has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionToolActivityParser.operation (cyclomatic 23) · ×1
  • SessionToolActivityParser.operation (cyclomatic 23) Sources/CodexBarCore/SessionToolActivityParser.swift:13 — SessionToolActivityParser.operation 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 · WidgetExtensionRecovery.launch (cyclomatic 23) · ×1
  • WidgetExtensionRecovery.launch (cyclomatic 23) Sources/CodexBarCore/WidgetExtensionRecovery.swift:40 — WidgetExtensionRecovery.launch 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 · AntigravityLocalReader.readStepTimestamps (cyclomatic 23) · ×1
  • AntigravityLocalReader.readStepTimestamps (cyclomatic 23) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift:322 — AntigravityLocalReader.readStepTimestamps 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 · ClaudeStatusProbe.exactLocalOccurrences (cyclomatic 23) · ×1
  • ClaudeStatusProbe.exactLocalOccurrences (cyclomatic 23) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1130 — ClaudeStatusProbe.exactLocalOccurrences 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 · DeepSeekPlatformTokenImporter.resolve (cyclomatic 23) · ×1
  • DeepSeekPlatformTokenImporter.resolve (cyclomatic 23) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekPlatformTokenImporter.swift:139 — DeepSeekPlatformTokenImporter.resolve 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 · KiroStatusProbe.parse (cyclomatic 23) · ×1
  • KiroStatusProbe.parse (cyclomatic 23) Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:884 — KiroStatusProbe.parse 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 · ClaudeOAuthCredentialsStore.loadCodexBarOAuthKeychainCache (cyclomatic 23) · ×1
  • ClaudeOAuthCredentialsStore.loadCodexBarOAuthKeychainCache (cyclomatic 23) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:2635 — ClaudeOAuthCredentialsStore.loadCodexBarOAuthKeychainCache 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 · Repository.hasCachedCredentials (cyclomatic 23) · ×1
  • Repository.hasCachedCredentials (cyclomatic 23) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:900 — Repository.hasCachedCredentials has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, 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 · Recovery.syncFromClaudeKeychainWithoutPrompt (cyclomatic 23) · ×1
  • Recovery.syncFromClaudeKeychainWithoutPrompt (cyclomatic 23) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1232 — Recovery.syncFromClaudeKeychainWithoutPrompt 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 · fetchUsage (cyclomatic 23) · ×1
  • fetchUsage (cyclomatic 23) Sources/CodexBarCore/Resources/Plugins/xapi.js:15 — fetchUsage has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 11 of the 23 points are its own statements and the rest belongs to 4 function items inside it that branch (request, amount, invalid, …). 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 · QuotaBurndownModel.init (cyclomatic 22) · ×1
  • QuotaBurndownModel.init (cyclomatic 22) Sources/CodexBar/QuotaBurndownModel.swift:17 — QuotaBurndownModel.init 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 · SpendDashboardModel.inputSummary (cyclomatic 22) · ×1
  • SpendDashboardModel.inputSummary (cyclomatic 22) Sources/CodexBar/SpendDashboardModel.swift:740 — SpendDashboardModel.inputSummary 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 · UsageStore.performOpenAIDashboardRefreshIfNeeded (cyclomatic 22) · ×1
  • UsageStore.performOpenAIDashboardRefreshIfNeeded (cyclomatic 22) Sources/CodexBar/UsageStore+OpenAIWeb.swift:539 — UsageStore.performOpenAIDashboardRefreshIfNeeded 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 · UsageStore.applySelectedOutcome (cyclomatic 22) · ×1
  • UsageStore.applySelectedOutcome (cyclomatic 22) Sources/CodexBar/UsageStore+TokenAccounts.swift:1462 — UsageStore.applySelectedOutcome 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 · UsageStore.widgetAccounts (cyclomatic 22) · ×1
  • UsageStore.widgetAccounts (cyclomatic 22) Sources/CodexBar/UsageStore+WidgetAccounts.swift:42 — UsageStore.widgetAccounts 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 · UsageStore.switchClaudeSwapAccount (cyclomatic 22) · ×1
  • UsageStore.switchClaudeSwapAccount (cyclomatic 22) Sources/CodexBar/Providers/Claude/UsageStore+ClaudeSwapRefresh.swift:181 — UsageStore.switchClaudeSwapAccount 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 · CodexBarCLI.handleServeRequest (cyclomatic 22) · ×1
  • CodexBarCLI.handleServeRequest (cyclomatic 22) Sources/CodexBarCLI/CLIServeCommand.swift:854 — CodexBarCLI.handleServeRequest has cyclomatic complexity 22 (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 · CostUsageFetcher.loadLocalTokenScanResult (cyclomatic 22) · ×1
  • CostUsageFetcher.loadLocalTokenScanResult (cyclomatic 22) Sources/CodexBarCore/CostUsageFetcher.swift:879 — CostUsageFetcher.loadLocalTokenScanResult 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 · CostUsageTokenSnapshot.quotaHourlyResidualSlices (cyclomatic 22) · ×1
  • CostUsageTokenSnapshot.quotaHourlyResidualSlices (cyclomatic 22) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:429 — CostUsageTokenSnapshot.quotaHourlyResidualSlices 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 · PiSessionCostScanner.loadCachedDailyReportResult (cyclomatic 22) · ×1
  • PiSessionCostScanner.loadCachedDailyReportResult (cyclomatic 22) Sources/CodexBarCore/PiSessionCostScanner.swift:343 — PiSessionCostScanner.loadCachedDailyReportResult 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 · AntigravityCLISession.ensureStartedLocked (cyclomatic 22) · ×1
  • AntigravityCLISession.ensureStartedLocked (cyclomatic 22) Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:498 — AntigravityCLISession.ensureStartedLocked 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 · ClaudeProviderDescriptor.makeDescriptor (cyclomatic 22) · ×1
  • ClaudeProviderDescriptor.makeDescriptor (cyclomatic 22) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:88 — ClaudeProviderDescriptor.makeDescriptor 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 · KiroStatusProbe.runCommand (cyclomatic 22) · ×1
  • KiroStatusProbe.runCommand (cyclomatic 22) Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:1209 — KiroStatusProbe.runCommand 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 · Recovery.syncWithClaudeKeychainIfChanged (cyclomatic 22) · ×1
  • Recovery.syncWithClaudeKeychainIfChanged (cyclomatic 22) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1075 — Recovery.syncWithClaudeKeychainIfChanged 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 · Recovery.repairFromClaudeKeychainWithoutPromptIfAllowed (cyclomatic 22) · ×1
  • Recovery.repairFromClaudeKeychainWithoutPromptIfAllowed (cyclomatic 22) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1152 — Recovery.repairFromClaudeKeychainWithoutPromptIfAllowed 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 · OneConsoleCookieRouting.redirectedRequest (cyclomatic 22) · ×1
  • OneConsoleCookieRouting.redirectedRequest (cyclomatic 22) Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleCookieRouting.swift:31 — OneConsoleCookieRouting.redirectedRequest 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 · CombinedBurnRow.body (cyclomatic 22) · ×1
  • CombinedBurnRow.body (cyclomatic 22) Sources/CodexBarWidget/CombinedBurnDownWidgetViews.swift:141 — CombinedBurnRow.body 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 · ReplayEngine.runDetailed (cyclomatic 21) · ×1
  • ReplayEngine.runDetailed (cyclomatic 21) Sources/AdaptiveReplayKit/ReplayEngine.swift:53 — ReplayEngine.runDetailed 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 · Model.hasCompatibleTrackedLayout (cyclomatic 21) · ×1
  • Model.hasCompatibleTrackedLayout (cyclomatic 21) Sources/CodexBar/MenuCardView+ModelHelpers.swift:426 — Model.hasCompatibleTrackedLayout 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 · SessionEquivalentForecast.make (cyclomatic 21) · ×1
  • SessionEquivalentForecast.make (cyclomatic 21) Sources/CodexBar/SessionEquivalentForecast.swift:40 — SessionEquivalentForecast.make 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 · SpendDashboardPublication.coverageSources (cyclomatic 21) · ×1
  • SpendDashboardPublication.coverageSources (cyclomatic 21) Sources/CodexBar/SpendDashboardPublication.swift:153 — SpendDashboardPublication.coverageSources 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 · StatusItemController.performStoreRefresh (cyclomatic 21) · ×1
  • StatusItemController.performStoreRefresh (cyclomatic 21) Sources/CodexBar/StatusItemController+Actions.swift:74 — StatusItemController.performStoreRefresh 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 · UsageStore.handleQuotaWarningTransition (cyclomatic 21) · ×1
  • UsageStore.handleQuotaWarningTransition (cyclomatic 21) Sources/CodexBar/UsageStore+QuotaWarnings.swift:138 — UsageStore.handleQuotaWarningTransition 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 · CodexBarCLI.renderCostText (cyclomatic 21) · ×1
  • CodexBarCLI.renderCostText (cyclomatic 21) Sources/CodexBarCLI/CLICostCommand.swift:191 — CodexBarCLI.renderCostText 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 · CLIServeOperationCoordinator.sourceProduced (cyclomatic 21) · ×1
  • CLIServeOperationCoordinator.sourceProduced (cyclomatic 21) Sources/CodexBarCLI/CLIServeOperationCoordinator.swift:471 — CLIServeOperationCoordinator.sourceProduced 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 · CostUsageFetcher.codexBreakdownsWithMetadata (cyclomatic 21) · ×1
  • CostUsageFetcher.codexBreakdownsWithMetadata (cyclomatic 21) Sources/CodexBarCore/CostUsageFetcher.swift:1009 — CostUsageFetcher.codexBreakdownsWithMetadata has cyclomatic complexity 21 (threshold 15). Of this number, 20 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 · ProviderDiagnosticError.errorCategory (cyclomatic 21) · ×1
  • ProviderDiagnosticError.errorCategory (cyclomatic 21) Sources/CodexBarCore/Providers/ProviderDiagnosticExport.swift:369 — ProviderDiagnosticError.errorCategory has cyclomatic complexity 21 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Lexer.object (cyclomatic 21) · ×1
  • Lexer.object (cyclomatic 21) Sources/CodexBarCore/Providers/Antigravity/AntigravityJSONLObject.swift:34 — Lexer.object 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 · AuggieCLIProbe.parse (cyclomatic 21) · ×1
  • AuggieCLIProbe.parse (cyclomatic 21) Sources/CodexBarCore/Providers/Augment/AuggieCLIProbe.swift:55 — AuggieCLIProbe.parse 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 · ClaudeCLIScreen.applyCSI (cyclomatic 21) · ×1
  • ClaudeCLIScreen.applyCSI (cyclomatic 21) Sources/CodexBarCore/Providers/Claude/ClaudeCLIScreen.swift:86 — ClaudeCLIScreen.applyCSI 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 · CursorStatusSnapshot.toUsageSnapshot (cyclomatic 21) · ×1
  • CursorStatusSnapshot.toUsageSnapshot (cyclomatic 21) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:448 — CursorStatusSnapshot.toUsageSnapshot 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 · CursorStatusProbe.fetchWithCookieHeader (cyclomatic 21) · ×1
  • CursorStatusProbe.fetchWithCookieHeader (cyclomatic 21) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:1221 — CursorStatusProbe.fetchWithCookieHeader 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 · DoubaoUsageFetcher.decodeArkcliUsage (cyclomatic 21) · ×1
  • DoubaoUsageFetcher.decodeArkcliUsage (cyclomatic 21) Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:504 — DoubaoUsageFetcher.decodeArkcliUsage 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 · MuseLocalUsageReader.parseSessionLog (cyclomatic 21) · ×1
  • MuseLocalUsageReader.parseSessionLog (cyclomatic 21) Sources/CodexBarCore/Providers/Muse/MuseLocalUsageReader.swift:423 — MuseLocalUsageReader.parseSessionLog has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ClaudeOAuthRefreshFailureGate.reloadPersistedState (cyclomatic 21) · ×1
  • ClaudeOAuthRefreshFailureGate.reloadPersistedState (cyclomatic 21) REDACTED:374 — ClaudeOAuthRefreshFailureGate.reloadPersistedState 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 · IconRenderer.makeIcon · ×1
  • IconRenderer.makeIcon::drawBar (cyclomatic 20) Sources/CodexBar/IconRenderer.swift:168 — IconRenderer.makeIcon::drawBar 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 shape REPEATS in the file: one other method here (IconRenderer.makeIcon) 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 · SpendDashboardController.startLoad (cyclomatic 20) · ×1
  • SpendDashboardController.startLoad (cyclomatic 20) Sources/CodexBar/SpendDashboardController.swift:1283 — SpendDashboardController.startLoad 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 · StatusItemController.hydrateHostedSubviewMenuIfNeeded (cyclomatic 20) · ×1
  • StatusItemController.hydrateHostedSubviewMenuIfNeeded (cyclomatic 20) Sources/CodexBar/StatusItemController+HostedSubmenus.swift:91 — StatusItemController.hydrateHostedSubviewMenuIfNeeded 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 · UsageStore.prepareLimitResetNotification (cyclomatic 20) · ×1
  • UsageStore.prepareLimitResetNotification (cyclomatic 20) Sources/CodexBar/LimitResetNotifications.swift:31 — UsageStore.prepareLimitResetNotification 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 · UsageStore.applyOpenAIDashboardAuthorityDecision (cyclomatic 20) · ×1
  • UsageStore.applyOpenAIDashboardAuthorityDecision (cyclomatic 20) Sources/CodexBar/UsageStore+OpenAIWeb.swift:231 — UsageStore.applyOpenAIDashboardAuthorityDecision 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 · UsageStore.shouldApplyCodexUsageResult (cyclomatic 20) · ×1
  • UsageStore.shouldApplyCodexUsageResult (cyclomatic 20) Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:263 — UsageStore.shouldApplyCodexUsageResult 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 · CloudSyncEngine.processEvent (cyclomatic 20) · ×1
  • CloudSyncEngine.processEvent (cyclomatic 20) Sources/CodexBar/Sync/CloudSyncEngine.swift:803 — CloudSyncEngine.processEvent has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · CLIClaudeSwapText.sanitize (cyclomatic 20) · ×1
  • CLIClaudeSwapText.sanitize (cyclomatic 20) Sources/CodexBarCLI/CLIClaudeSwapCards.swift:24 — CLIClaudeSwapText.sanitize 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 · CodexModelsAnalyticsBuilder.parityMismatches (cyclomatic 20) · ×1
  • CodexModelsAnalyticsBuilder.parityMismatches (cyclomatic 20) Sources/CodexBarCore/CodexModelsAnalyticsModels.swift:708 — CodexModelsAnalyticsBuilder.parityMismatches 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 · CodexThreadMetadataReader.assignedProjectSessionIDs (cyclomatic 20) · ×1
  • CodexThreadMetadataReader.assignedProjectSessionIDs (cyclomatic 20) Sources/CodexBarCore/CodexThreadMetadataReader+Projects.swift:79 — CodexThreadMetadataReader.assignedProjectSessionIDs 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 · CodexWorkspaceUsageSidecar.loadLatestSnapshot (cyclomatic 20) · ×1
  • CodexWorkspaceUsageSidecar.loadLatestSnapshot (cyclomatic 20) Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:73 — CodexWorkspaceUsageSidecar.loadLatestSnapshot 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 · PiSessionCostScanner.buildReport (cyclomatic 20) · ×1
  • PiSessionCostScanner.buildReport (cyclomatic 20) Sources/CodexBarCore/PiSessionCostScanner+Aggregation.swift:17 — PiSessionCostScanner.buildReport 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 · TailscaleStatusParser.parseHosts (cyclomatic 20) · ×1
  • TailscaleStatusParser.parseHosts (cyclomatic 20) Sources/CodexBarCore/RemoteSessionFetcher.swift:29 — TailscaleStatusParser.parseHosts 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 · UsagePace.weekly (cyclomatic 20) · ×1
  • UsagePace.weekly (cyclomatic 20) Sources/CodexBarCore/UsagePace.swift:60 — UsagePace.weekly 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 · PreferencesDocument.validate (cyclomatic 20) · ×1
  • PreferencesDocument.validate (cyclomatic 20) Sources/CodexBarCore/Config/PreferencesDocument.swift:132 — PreferencesDocument.validate 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 · OpenAIDashboardBrowserCookieImporter.importBestCookies (cyclomatic 20) · ×1
  • OpenAIDashboardBrowserCookieImporter.importBestCookies (cyclomatic 20) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:119 — OpenAIDashboardBrowserCookieImporter.importBestCookies 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 · TTYCommandRunner.run · ×1
  • TTYCommandRunner.run::processNonCodexChunk (cyclomatic 20) Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:739 — TTYCommandRunner.run::processNonCodexChunk 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 shape REPEATS in the file: one other method here (TTYCommandRunner.run) 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 · AntigravityRemoteUsageFetcher.fetch (cyclomatic 20) · ×1
  • AntigravityRemoteUsageFetcher.fetch (cyclomatic 20) Sources/CodexBarCore/Providers/Antigravity/AntigravityRemoteUsageFetcher.swift:100 — AntigravityRemoteUsageFetcher.fetch 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 · FactoryStatusProbe.fetchWithCookies (cyclomatic 20) · ×1
  • FactoryStatusProbe.fetchWithCookies (cyclomatic 20) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:930 — FactoryStatusProbe.fetchWithCookies has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · MiniMaxLocalStorageImporter.importAccessTokens (cyclomatic 20) · ×1
  • MiniMaxLocalStorageImporter.importAccessTokens (cyclomatic 20) Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:14 — MiniMaxLocalStorageImporter.importAccessTokens 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 · MiniMaxUsageParser.parseCodingPlanRemains (cyclomatic 20) · ×1
  • MiniMaxUsageParser.parseCodingPlanRemains (cyclomatic 20) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift:774 — MiniMaxUsageParser.parseCodingPlanRemains 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 · QoderCookieRouting.httpRequestRoute (cyclomatic 20) · ×1
  • QoderCookieRouting.httpRequestRoute (cyclomatic 20) Sources/CodexBarCore/Providers/Qoder/QoderCookieRouting.swift:75 — QoderCookieRouting.httpRequestRoute 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 · OpenCodeSubscriptionParser.parseUsageNested (cyclomatic 20) · ×1
  • OpenCodeSubscriptionParser.parseUsageNested (cyclomatic 20) Sources/CodexBarCore/Providers/Shared/OpenCodeSubscriptionParser.swift:65 — OpenCodeSubscriptionParser.parseUsageNested 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 · Repository.loadFromClaudeKeychainWithPromptIfAllowed (cyclomatic 20) · ×1
  • Repository.loadFromClaudeKeychainWithPromptIfAllowed (cyclomatic 20) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:542 — Repository.loadFromClaudeKeychainWithPromptIfAllowed 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 · ClaudeSubscriptionMetadataFetcher.fetchVerified (cyclomatic 20) · ×1
  • ClaudeSubscriptionMetadataFetcher.fetchVerified (cyclomatic 20) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeSubscriptionMetadata.swift:113 — ClaudeSubscriptionMetadataFetcher.fetchVerified has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 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 · mimo-usage.parse_session_usage (cyclomatic 20) · ×1
  • mimo-usage.parse_session_usage (cyclomatic 20) Scripts/mimo-usage.py:36 — mimo-usage.parse_session_usage 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 · SessionUsagePresentation.sessions (cyclomatic 19) · ×1
  • SessionUsagePresentation.sessions (cyclomatic 19) Sources/CodexBar/SessionUsagePresentation.swift:17 — SessionUsagePresentation.sessions 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 · ShareStatsBuilder.make (cyclomatic 19) · ×1
  • ShareStatsBuilder.make (cyclomatic 19) Sources/CodexBar/ShareStatsPayload.swift:216 — ShareStatsBuilder.make has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SpendProviderBreakdownRows.providerGroup (cyclomatic 19) · ×1
  • SpendProviderBreakdownRows.providerGroup (cyclomatic 19) Sources/CodexBar/SpendDashboardProviderBreakdown.swift:128 — SpendProviderBreakdownRows.providerGroup 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 · StatusItemController.scheduleMenuBarCountdownRefreshIfNeeded (cyclomatic 19) · ×1
  • StatusItemController.scheduleMenuBarCountdownRefreshIfNeeded (cyclomatic 19) Sources/CodexBar/StatusItemController+CountdownRefresh.swift:7 — StatusItemController.scheduleMenuBarCountdownRefreshIfNeeded 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 · StatusItemController.storedMenuBarLayoutPaceSignature (cyclomatic 19) · ×1
  • StatusItemController.storedMenuBarLayoutPaceSignature (cyclomatic 19) Sources/CodexBar/StatusItemController+IconObservation.swift:224 — StatusItemController.storedMenuBarLayoutPaceSignature 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 · StatusItemController.menuWillOpen (cyclomatic 19) · ×1
  • StatusItemController.menuWillOpen (cyclomatic 19) Sources/CodexBar/StatusItemController+Menu.swift:66 — StatusItemController.menuWillOpen 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 · StatusItemController.scheduleOpenMenuRefresh (cyclomatic 19) · ×1
  • StatusItemController.scheduleOpenMenuRefresh (cyclomatic 19) Sources/CodexBar/StatusItemController+Menu.swift:1158 — StatusItemController.scheduleOpenMenuRefresh 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 · UsageStore.handleCredentialOutcome (cyclomatic 19) · ×1
  • UsageStore.handleCredentialOutcome (cyclomatic 19) Sources/CodexBar/UsageStore+CredentialNotifications.swift:50 — UsageStore.handleCredentialOutcome 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 · CodexWeeklyResetConfirmation.resetCreditEvidence (cyclomatic 19) · ×1
  • CodexWeeklyResetConfirmation.resetCreditEvidence (cyclomatic 19) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:460 — CodexWeeklyResetConfirmation.resetCreditEvidence 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 · KiloProviderImplementation.settingsOrganizations (cyclomatic 19) · ×1
  • KiloProviderImplementation.settingsOrganizations (cyclomatic 19) Sources/CodexBar/Providers/Kilo/KiloProviderImplementation.swift:91 — KiloProviderImplementation.settingsOrganizations has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CLICardsRenderer.renderCard (cyclomatic 19) · ×1
  • CLICardsRenderer.renderCard (cyclomatic 19) Sources/CodexBarCLI/CLICardsRenderer.swift:296 — CLICardsRenderer.renderCard 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 · CodexThreadCatalogReader.loadResult (cyclomatic 19) · ×1
  • CodexThreadCatalogReader.loadResult (cyclomatic 19) Sources/CodexBarCore/CodexThreadCatalogReader.swift:66 — CodexThreadCatalogReader.loadResult 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 · CodexThreadMetadataReader.multilineQuote (cyclomatic 19) · ×1
  • CodexThreadMetadataReader.multilineQuote (cyclomatic 19) Sources/CodexBarCore/CodexThreadMetadataReader.swift:237 — CodexThreadMetadataReader.multilineQuote 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 · CodexThreadMetadataReader.tomlString (cyclomatic 19) · ×1
  • CodexThreadMetadataReader.tomlString (cyclomatic 19) Sources/CodexBarCore/CodexThreadMetadataReader.swift:327 — CodexThreadMetadataReader.tomlString 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 · CookieHeaderCache.currentObservationMatch (cyclomatic 19) · ×1
  • CookieHeaderCache.currentObservationMatch (cyclomatic 19) Sources/CodexBarCore/CookieHeaderCache.swift:1396 — CookieHeaderCache.currentObservationMatch 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 · KeychainAccessPreflight.evaluateDecryptACL (cyclomatic 19) · ×1
  • KeychainAccessPreflight.evaluateDecryptACL (cyclomatic 19) Sources/CodexBarCore/KeychainAccessPreflight.swift:347 — KeychainAccessPreflight.evaluateDecryptACL 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 · ShellCommandLocator.runShellCommand (cyclomatic 19) · ×1
  • ShellCommandLocator.runShellCommand (cyclomatic 19) Sources/CodexBarCore/PathEnvironment.swift:889 — ShellCommandLocator.runShellCommand 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 · PiFamilySessionScanner.ompSessionRootResolution (cyclomatic 19) · ×1
  • PiFamilySessionScanner.ompSessionRootResolution (cyclomatic 19) Sources/CodexBarCore/PiFamilySessionScanner.swift:853 — PiFamilySessionScanner.ompSessionRootResolution 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 · PiFamilySessionScanner.records (cyclomatic 19) · ×1
  • PiFamilySessionScanner.records (cyclomatic 19) Sources/CodexBarCore/PiFamilySessionScanner.swift:1234 — PiFamilySessionScanner.records 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 · PiSessionCostScanner.scanPiSessionFile (cyclomatic 19) · ×1
  • PiSessionCostScanner.scanPiSessionFile (cyclomatic 19) Sources/CodexBarCore/PiSessionCostScanner.swift:745 — PiSessionCostScanner.scanPiSessionFile 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 · OpenAIDashboardParser.parseSignedInEmailFromClientBootstrap (cyclomatic 19) · ×1
  • OpenAIDashboardParser.parseSignedInEmailFromClientBootstrap (cyclomatic 19) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:9 — OpenAIDashboardParser.parseSignedInEmailFromClientBootstrap 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 · OpenAISubscription.fetch (cyclomatic 19) · ×1
  • OpenAISubscription.fetch (cyclomatic 19) Sources/CodexBarCore/OpenAIWeb/OpenAISubscriptionMetadata.swift:94 — OpenAISubscription.fetch 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 · ProviderIntentPayload.applying (cyclomatic 19) · ×1
  • ProviderIntentPayload.applying (cyclomatic 19) Sources/CodexBarCore/Sync/SyncModels.swift:77 — ProviderIntentPayload.applying 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 · AntigravityLocalReader.consumeJSONLLine (cyclomatic 19) · ×1
  • AntigravityLocalReader.consumeJSONLLine (cyclomatic 19) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalJSONL.swift:85 — AntigravityLocalReader.consumeJSONLLine 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 · AntigravityCLIHTTPSFetchStrategy.tryWarmAgyFetch (cyclomatic 19) · ×1
  • AntigravityCLIHTTPSFetchStrategy.tryWarmAgyFetch (cyclomatic 19) Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:350 — AntigravityCLIHTTPSFetchStrategy.tryWarmAgyFetch 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 · ClaudeStatusProbe.extractUsageErrorJSON (cyclomatic 19) · ×1
  • ClaudeStatusProbe.extractUsageErrorJSON (cyclomatic 19) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1333 — ClaudeStatusProbe.extractUsageErrorJSON 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 · CodexDisplacedLivePreservationPlanner.makePlan (cyclomatic 19) · ×1
  • CodexDisplacedLivePreservationPlanner.makePlan (cyclomatic 19) Sources/CodexBarCore/Providers/Codex/CodexAccountPromotionPlanning.swift:43 — CodexDisplacedLivePreservationPlanner.makePlan 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 · CodexDashboardAuthority.evaluate (cyclomatic 19) · ×1
  • CodexDashboardAuthority.evaluate (cyclomatic 19) Sources/CodexBarCore/Providers/Codex/CodexDashboardAuthority.swift:170 — CodexDashboardAuthority.evaluate 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 · CodexVisibleAccountProjection.make (cyclomatic 19) · ×1
  • CodexVisibleAccountProjection.make (cyclomatic 19) Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift:152 — CodexVisibleAccountProjection.make has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · GeminiStatusProbe.fetchViaAPI (cyclomatic 19) · ×1
  • GeminiStatusProbe.fetchViaAPI (cyclomatic 19) Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:268 — GeminiStatusProbe.fetchViaAPI 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 · MistralSubscriptionBudgetParser.collectModels (cyclomatic 19) · ×1
  • MistralSubscriptionBudgetParser.collectModels (cyclomatic 19) Sources/CodexBarCore/Providers/Mistral/MistralSubscriptionBudgetParser.swift:91 — MistralSubscriptionBudgetParser.collectModels 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 · QoderCookieRouting.curlHeaderHostSites (cyclomatic 19) · ×1
  • QoderCookieRouting.curlHeaderHostSites (cyclomatic 19) Sources/CodexBarCore/Providers/Qoder/QoderCookieRouting.swift:276 — QoderCookieRouting.curlHeaderHostSites 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 · fetchUsage (cyclomatic 19) · ×1
  • fetchUsage (cyclomatic 19) Sources/CodexBarCore/Resources/Plugins/exa.js:11 — fetchUsage 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 · Model.monthlyTargetMetrics (cyclomatic 18) · ×1
  • Model.monthlyTargetMetrics (cyclomatic 18) Sources/CodexBar/MenuCardView+MonthlyTarget.swift:5 — Model.monthlyTargetMetrics has cyclomatic complexity 18 (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 · Model.visibleProviderDetails (cyclomatic 18) · ×1
  • Model.visibleProviderDetails (cyclomatic 18) Sources/CodexBar/MenuCardView+ProviderDetailVisibility.swift:5 — Model.visibleProviderDetails 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 · Model.applyingUsageItemVisibility (cyclomatic 18) · ×1
  • Model.applyingUsageItemVisibility (cyclomatic 18) Sources/CodexBar/ProviderUsageItemVisibility.swift:188 — Model.applyingUsageItemVisibility 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 · SpendDashboardSource.load (cyclomatic 18) · ×1
  • SpendDashboardSource.load (cyclomatic 18) Sources/CodexBar/SpendDashboardController.swift:489 — SpendDashboardSource.load 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 · SpendTrendChart.chart (cyclomatic 18) · ×1
  • SpendTrendChart.chart (cyclomatic 18) Sources/CodexBar/SpendDashboardTrendPanel.swift:272 — SpendTrendChart.chart 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 · StatusItemController.addOverviewRows (cyclomatic 18) · ×1
  • StatusItemController.addOverviewRows (cyclomatic 18) Sources/CodexBar/StatusItemController+Menu.swift:545 — StatusItemController.addOverviewRows 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 · StatusItemController.addMenuCardSections (cyclomatic 18) · ×1
  • StatusItemController.addMenuCardSections (cyclomatic 18) Sources/CodexBar/StatusItemController+Menu.swift:1290 — StatusItemController.addMenuCardSections has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, 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 · StatusItemController.scheduleDeferredMenuInteractionRefreshIfNeeded (cyclomatic 18) · ×1
  • StatusItemController.scheduleDeferredMenuInteractionRefreshIfNeeded (cyclomatic 18) Sources/CodexBar/StatusItemController+MenuInteractionRefresh.swift:112 — StatusItemController.scheduleDeferredMenuInteractionRefreshIfNeeded 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 · StatusItemController.scheduleManualRefreshViewportRestore (cyclomatic 18) · ×1
  • StatusItemController.scheduleManualRefreshViewportRestore (cyclomatic 18) Sources/CodexBar/StatusItemController+MenuViewportRestore.swift:510 — StatusItemController.scheduleManualRefreshViewportRestore 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 · UsageStore.presentationSnapshot (cyclomatic 18) · ×1
  • UsageStore.presentationSnapshot (cyclomatic 18) Sources/CodexBar/UsageStore+Accessors.swift:42 — UsageStore.presentationSnapshot 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 · UsageStore.postLimitResetCelebrationIfNeeded (cyclomatic 18) · ×1
  • UsageStore.postLimitResetCelebrationIfNeeded (cyclomatic 18) Sources/CodexBar/UsageStore+LimitResetCelebration.swift:174 — UsageStore.postLimitResetCelebrationIfNeeded 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 · UsageStore.openAIDashboardFriendlyError (cyclomatic 18) · ×1
  • UsageStore.openAIDashboardFriendlyError (cyclomatic 18) Sources/CodexBar/UsageStore+OpenAIWeb.swift:1539 — UsageStore.openAIDashboardFriendlyError 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 · UsageStore.preservedClaudeWidgetUsage (cyclomatic 18) · ×1
  • UsageStore.preservedClaudeWidgetUsage (cyclomatic 18) Sources/CodexBar/UsageStore+WidgetSnapshot.swift:355 — UsageStore.preservedClaudeWidgetUsage 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 · UsageStore.resolvedCodexRefreshOutcome (cyclomatic 18) · ×1
  • UsageStore.resolvedCodexRefreshOutcome (cyclomatic 18) Sources/CodexBar/Providers/Codex/UsageStore+CodexPATRefresh.swift:46 — UsageStore.resolvedCodexRefreshOutcome 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 · CodexConsumerProjection.make (cyclomatic 18) · ×1
  • CodexConsumerProjection.make (cyclomatic 18) Sources/CodexBar/Providers/Codex/CodexConsumerProjection.swift:275 — CodexConsumerProjection.make 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 · CodexBarCLI.runCacheClear (cyclomatic 18) · ×1
  • CodexBarCLI.runCacheClear (cyclomatic 18) Sources/CodexBarCLI/CLICacheCommand.swift:6 — CodexBarCLI.runCacheClear 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 · CodexBarCLI.runCodexHostCosts (cyclomatic 18) · ×1
  • CodexBarCLI.runCodexHostCosts (cyclomatic 18) Sources/CodexBarCLI/CLICodexHostCosts.swift:6 — CodexBarCLI.runCodexHostCosts 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 · CostUsageFetcher.tokenSnapshot (cyclomatic 18) · ×1
  • CostUsageFetcher.tokenSnapshot (cyclomatic 18) Sources/CodexBarCore/CostUsageFetcher.swift:1749 — CostUsageFetcher.tokenSnapshot 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 · CostUsageTokenSnapshot.quotaWindowCoverage (cyclomatic 18) · ×1
  • CostUsageTokenSnapshot.quotaWindowCoverage (cyclomatic 18) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:523 — CostUsageTokenSnapshot.quotaWindowCoverage 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 · KeychainCacheStore.load (cyclomatic 18) · ×1
  • KeychainCacheStore.load (cyclomatic 18) Sources/CodexBarCore/KeychainCacheStore.swift:97 — KeychainCacheStore.load 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 · PiFamilySessionScanner.scan (cyclomatic 18) · ×1
  • PiFamilySessionScanner.scan (cyclomatic 18) Sources/CodexBarCore/PiFamilySessionScanner.swift:223 — PiFamilySessionScanner.scan 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 · PiFamilySessionScanner.piSessionRootResolution (cyclomatic 18) · ×1
  • PiFamilySessionScanner.piSessionRootResolution (cyclomatic 18) Sources/CodexBarCore/PiFamilySessionScanner.swift:957 — PiFamilySessionScanner.piSessionRootResolution 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 · SessionToolActivityParser.outcome (cyclomatic 18) · ×1
  • SessionToolActivityParser.outcome (cyclomatic 18) Sources/CodexBarCore/SessionToolActivityParser.swift:74 — SessionToolActivityParser.outcome 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 · ProviderPluginSnapshotMapper.aggregateCostUsageEntries (cyclomatic 18) · ×1
  • ProviderPluginSnapshotMapper.aggregateCostUsageEntries (cyclomatic 18) Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:458 — ProviderPluginSnapshotMapper.aggregateCostUsageEntries 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 · QuickJSProviderPluginEngine.hostCookieHeader (cyclomatic 18) · ×1
  • QuickJSProviderPluginEngine.hostCookieHeader (cyclomatic 18) Sources/CodexBarCore/Plugins/QuickJSProviderPluginEngine.swift:702 — QuickJSProviderPluginEngine.hostCookieHeader 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 · AntigravityLocalReader.readRows (cyclomatic 18) · ×1
  • AntigravityLocalReader.readRows (cyclomatic 18) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift:535 — AntigravityLocalReader.readRows 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 · AntigravityStatusSnapshot.normalizeModel (cyclomatic 18) · ×1
  • AntigravityStatusSnapshot.normalizeModel (cyclomatic 18) Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:528 — AntigravityStatusSnapshot.normalizeModel has cyclomatic complexity 18 (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 · BedrockUsageFetcher.parseDailyResponse (cyclomatic 18) · ×1
  • BedrockUsageFetcher.parseDailyResponse (cyclomatic 18) Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:320 — BedrockUsageFetcher.parseDailyResponse 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 · ClaudeProviderDescriptor.resolveStrategies (cyclomatic 18) · ×1
  • ClaudeProviderDescriptor.resolveStrategies (cyclomatic 18) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:287 — ClaudeProviderDescriptor.resolveStrategies has cyclomatic complexity 18 (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 · ClaudeOAuthFetchStrategy.isPlausiblyAvailable (cyclomatic 18) · ×1
  • ClaudeOAuthFetchStrategy.isPlausiblyAvailable (cyclomatic 18) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:656 — ClaudeOAuthFetchStrategy.isPlausiblyAvailable 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 · CursorLocalCSVReader.parseFile (cyclomatic 18) · ×1
  • CursorLocalCSVReader.parseFile (cyclomatic 18) Sources/CodexBarCore/Providers/Cursor/CursorLocalCSVReader.swift:36 — CursorLocalCSVReader.parseFile 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 · DeepSeekUsageCostParser.parseByAPIKey (cyclomatic 18) · ×1
  • DeepSeekUsageCostParser.parseByAPIKey (cyclomatic 18) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:795 — DeepSeekUsageCostParser.parseByAPIKey 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 · DoubaoUsageFetcher.apiErrorSummary (cyclomatic 18) · ×1
  • DoubaoUsageFetcher.apiErrorSummary (cyclomatic 18) Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:839 — DoubaoUsageFetcher.apiErrorSummary 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 · KiroStatusProbe.runViaPipe (cyclomatic 18) · ×1
  • KiroStatusProbe.runViaPipe (cyclomatic 18) Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:662 — KiroStatusProbe.runViaPipe 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 · ClaudeOAuthPendingCacheClearUserDefaultsStore.withCacheTransaction (cyclomatic 18) · ×1
  • ClaudeOAuthPendingCacheClearUserDefaultsStore.withCacheTransaction (cyclomatic 18) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthPendingCacheClearStore.swift:151 — ClaudeOAuthPendingCacheClearUserDefaultsStore.withCacheTransaction 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 · Usage.laneSegments (cyclomatic 18) · ×1
  • Usage.laneSegments (cyclomatic 18) Integrations/Linux/Shared/Usage.js:303 — Usage.laneSegments has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CLIArguments.parse (cyclomatic 17) · ×1
  • CLIArguments.parse (cyclomatic 17) Sources/AdaptiveReplayCLI/CLIArguments.swift:46 — CLIArguments.parse 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 · Model.usageItemDescriptors (cyclomatic 17) · ×1
  • Model.usageItemDescriptors (cyclomatic 17) Sources/CodexBar/ProviderUsageItemVisibility.swift:103 — Model.usageItemDescriptors 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 · HomebrewUpdateNotifier.postIfNeeded (cyclomatic 17) · ×1
  • HomebrewUpdateNotifier.postIfNeeded (cyclomatic 17) Sources/CodexBar/HomebrewUpdateNotifier.swift:48 — HomebrewUpdateNotifier.postIfNeeded 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 · MenuDescriptor.hasAccount (cyclomatic 17) · ×1
  • MenuDescriptor.hasAccount (cyclomatic 17) Sources/CodexBar/MenuDescriptor.swift:672 — MenuDescriptor.hasAccount 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 is NOT this file's highest cyclomatic complexity: MenuAction.systemImageName (cyclomatic 19) 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 · ProviderDetailView.body (cyclomatic 17) · ×1
  • ProviderDetailView.body (cyclomatic 17) Sources/CodexBar/PreferencesProviderDetailView.swift:135 — ProviderDetailView.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 · SpendDashboardController.publishCurrentState (cyclomatic 17) · ×1
  • SpendDashboardController.publishCurrentState (cyclomatic 17) Sources/CodexBar/SpendDashboardController.swift:1731 — SpendDashboardController.publishCurrentState 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 · SpendTrendChartModel.emptyStateTitle (cyclomatic 17) · ×1
  • SpendTrendChartModel.emptyStateTitle (cyclomatic 17) Sources/CodexBar/SpendTrendChartModel.swift:118 — SpendTrendChartModel.emptyStateTitle 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 · StatusItemController.kiroDisplayText (cyclomatic 17) · ×1
  • StatusItemController.kiroDisplayText (cyclomatic 17) Sources/CodexBar/StatusItemController+Animation.swift:907 — StatusItemController.kiroDisplayText 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 · StatusItemController.handleOverviewScrollWheel (cyclomatic 17) · ×1
  • StatusItemController.handleOverviewScrollWheel (cyclomatic 17) Sources/CodexBar/StatusItemController+OverviewScroll.swift:17 — StatusItemController.handleOverviewScrollWheel 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 · StatusItemController.switcherWeeklyMetricPercent (cyclomatic 17) · ×1
  • StatusItemController.switcherWeeklyMetricPercent (cyclomatic 17) Sources/CodexBar/StatusItemController+SwitcherMetrics.swift:27 — StatusItemController.switcherWeeklyMetricPercent 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 · UsageStore.scheduleStorageFootprintRefresh (cyclomatic 17) · ×1
  • UsageStore.scheduleStorageFootprintRefresh (cyclomatic 17) Sources/CodexBar/UsageStore+ProviderStorage.swift:86 — UsageStore.scheduleStorageFootprintRefresh 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 · UsageStore.widgetUsageRows (cyclomatic 17) · ×1
  • UsageStore.widgetUsageRows (cyclomatic 17) Sources/CodexBar/UsageStore+WidgetSnapshot.swift:445 — UsageStore.widgetUsageRows 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 · CLILocalHTTPServer.run (cyclomatic 17) · ×1
  • CLILocalHTTPServer.run (cyclomatic 17) Sources/CodexBarCLI/CLILocalHTTPServer.swift:328 — CLILocalHTTPServer.run 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 · CLIServeResponseCache.mergeLastGoodUsageItems (cyclomatic 17) · ×1
  • CLIServeResponseCache.mergeLastGoodUsageItems (cyclomatic 17) Sources/CodexBarCLI/CLIServeCommand.swift:394 — CLIServeResponseCache.mergeLastGoodUsageItems 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 · CLIServeResponseCache.mergeLastGoodCostItems (cyclomatic 17) · ×1
  • CLIServeResponseCache.mergeLastGoodCostItems (cyclomatic 17) Sources/CodexBarCLI/CLIServeCommand.swift:487 — CLIServeResponseCache.mergeLastGoodCostItems 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 · TokenAccountCLIContext.resolvedAccounts (cyclomatic 17) · ×1
  • TokenAccountCLIContext.resolvedAccounts (cyclomatic 17) Sources/CodexBarCLI/TokenAccountCLI.swift:89 — TokenAccountCLIContext.resolvedAccounts 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 · Entry.coverageCounts (cyclomatic 17) · ×1
  • Entry.coverageCounts (cyclomatic 17) Sources/CodexBarCore/CostUsageModels.swift:565 — Entry.coverageCounts 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 · LocalAgentSessionScanner.scanWithActivity (cyclomatic 17) · ×1
  • LocalAgentSessionScanner.scanWithActivity (cyclomatic 17) Sources/CodexBarCore/LocalAgentSessionScanner.swift:202 — LocalAgentSessionScanner.scanWithActivity 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 · PiFamilySessionScanner.profileSessionRoots (cyclomatic 17) · ×1
  • PiFamilySessionScanner.profileSessionRoots (cyclomatic 17) Sources/CodexBarCore/PiFamilySessionScanner.swift:1084 — PiFamilySessionScanner.profileSessionRoots has cyclomatic complexity 17 (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 · ProviderEndpointOverrideValidator.isPrivateNetworkHost (cyclomatic 17) · ×1
  • ProviderEndpointOverrideValidator.isPrivateNetworkHost (cyclomatic 17) Sources/CodexBarCore/ProviderEndpointOverrideValidator.swift:150 — ProviderEndpointOverrideValidator.isPrivateNetworkHost 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 · SessionToolActivityStore.details (cyclomatic 17) · ×1
  • SessionToolActivityStore.details (cyclomatic 17) Sources/CodexBarCore/SessionToolActivityStore.swift:36 — SessionToolActivityStore.details 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 · SessionToolJSONProjection.punctuation (cyclomatic 17) · ×1
  • SessionToolJSONProjection.punctuation (cyclomatic 17) Sources/CodexBarCore/SessionToolJSONProjection.swift:117 — SessionToolJSONProjection.punctuation 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 · UsageSnapshot.backfillingResetTimes (cyclomatic 17) · ×1
  • UsageSnapshot.backfillingResetTimes (cyclomatic 17) Sources/CodexBarCore/UsageFetcher.swift:525 — UsageSnapshot.backfillingResetTimes has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (eligibleCachedReset). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · ProviderPluginIconSVG.hasBoundedCanvas (cyclomatic 17) · ×1
  • ProviderPluginIconSVG.hasBoundedCanvas (cyclomatic 17) Sources/CodexBarCore/Plugins/ProviderPluginIconSVG.swift:43 — ProviderPluginIconSVG.hasBoundedCanvas 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 · SpawnedProcessGroup.launchPTY (cyclomatic 17) · ×1
  • SpawnedProcessGroup.launchPTY (cyclomatic 17) Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:402 — SpawnedProcessGroup.launchPTY 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 · SubprocessRunner.run (cyclomatic 17) · ×1
  • SubprocessRunner.run (cyclomatic 17) Sources/CodexBarCore/Host/Process/SubprocessRunner.swift:133 — SubprocessRunner.run has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AlibabaTokenPlanUsageFetcher.fetchUsage (cyclomatic 17) · ×1
  • AlibabaTokenPlanUsageFetcher.fetchUsage (cyclomatic 17) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:102 — AlibabaTokenPlanUsageFetcher.fetchUsage 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 · AlibabaTokenPlanUsageFetcher.throwIfErrorPayload (cyclomatic 17) · ×1
  • AlibabaTokenPlanUsageFetcher.throwIfErrorPayload (cyclomatic 17) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:743 — AlibabaTokenPlanUsageFetcher.throwIfErrorPayload 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 · AntigravityLocalReader.readJSONLFile (cyclomatic 17) · ×1
  • AntigravityLocalReader.readJSONLFile (cyclomatic 17) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalJSONL.swift:24 — AntigravityLocalReader.readJSONLFile 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 · ClaudeCLIFetchStrategy.fetch (cyclomatic 17) · ×1
  • ClaudeCLIFetchStrategy.fetch (cyclomatic 17) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:1119 — ClaudeCLIFetchStrategy.fetch 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 · ClaudeUsageFetcher.applyWebExtrasIfNeeded (cyclomatic 17) · ×1
  • ClaudeUsageFetcher.applyWebExtrasIfNeeded (cyclomatic 17) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:1251 — ClaudeUsageFetcher.applyWebExtrasIfNeeded 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 · DeepSeekUsageCostParser.decodeByAPIKeyPayloads (cyclomatic 17) · ×1
  • DeepSeekUsageCostParser.decodeByAPIKeyPayloads (cyclomatic 17) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:923 — DeepSeekUsageCostParser.decodeByAPIKeyPayloads 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 · FactoryStatusProbe.fetch (cyclomatic 17) · ×1
  • FactoryStatusProbe.fetch (cyclomatic 17) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:635 — FactoryStatusProbe.fetch 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 · GrokLocalSessionScanner.summarize (cyclomatic 17) · ×1
  • GrokLocalSessionScanner.summarize (cyclomatic 17) Sources/CodexBarCore/Providers/Grok/GrokLocalSessionScanner.swift:80 — GrokLocalSessionScanner.summarize 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 · OpenCodeGoUsageFetcher.parseWindow (cyclomatic 17) · ×1
  • OpenCodeGoUsageFetcher.parseWindow (cyclomatic 17) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:704 — OpenCodeGoUsageFetcher.parseWindow 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 · ClaudeSubscriptionMetadata.parse (cyclomatic 17) · ×1
  • ClaudeSubscriptionMetadata.parse (cyclomatic 17) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeSubscriptionMetadata.swift:24 — ClaudeSubscriptionMetadata.parse has cyclomatic complexity 17 (threshold 15). Of this number, 10 points are the body's own statements and 7 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 · ci_swiftpm_cache.read_metadata (cyclomatic 17) · ×1
  • ci_swiftpm_cache.read_metadata (cyclomatic 17) Scripts/ci_swiftpm_cache.py:213 — ci_swiftpm_cache.read_metadata 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 · ci_swiftpm_cache.restore (cyclomatic 17) · ×1
  • ci_swiftpm_cache.restore (cyclomatic 17) Scripts/ci_swiftpm_cache.py:246 — ci_swiftpm_cache.restore 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 · CursorLoginRunner.runUserInitiated (cyclomatic 16) · ×1
  • CursorLoginRunner.runUserInitiated (cyclomatic 16) Sources/CodexBar/CursorLoginRunner.swift:210 — CursorLoginRunner.runUserInitiated 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 · UsageMenuCardUsageContentView.body (cyclomatic 16) · ×1
  • UsageMenuCardUsageContentView.body (cyclomatic 16) Sources/CodexBar/MenuCardView.swift:655 — UsageMenuCardUsageContentView.body 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 · PlanUtilizationHistoryChartMenuView.seriesPoints (cyclomatic 16) · ×1
  • PlanUtilizationHistoryChartMenuView.seriesPoints (cyclomatic 16) Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:331 — PlanUtilizationHistoryChartMenuView.seriesPoints 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 · ShareStatsSanitizer.safeLabel (cyclomatic 16) · ×1
  • ShareStatsSanitizer.safeLabel (cyclomatic 16) Sources/CodexBar/ShareStatsPayload.swift:184 — ShareStatsSanitizer.safeLabel 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 · ProviderSwitcherView.init (cyclomatic 16) · ×1
  • ProviderSwitcherView.init (cyclomatic 16) Sources/CodexBar/StatusItemController+SwitcherViews.swift:48 — ProviderSwitcherView.init has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 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 · StatusItemController.addMenuCards (cyclomatic 16) · ×1
  • StatusItemController.addMenuCards (cyclomatic 16) Sources/CodexBar/StatusItemController+Menu.swift:686 — StatusItemController.addMenuCards 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 · UsageStore.debugClaudeLog (cyclomatic 16) · ×1
  • UsageStore.debugClaudeLog (cyclomatic 16) Sources/CodexBar/UsageStore+ClaudeDebug.swift:24 — UsageStore.debugClaudeLog 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 · OpenAILiveUsageModel.refresh (cyclomatic 16) · ×1
  • OpenAILiveUsageModel.refresh (cyclomatic 16) Sources/CodexBar/Providers/OpenAI/OpenAILiveUsageModel.swift:121 — OpenAILiveUsageModel.refresh 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 · SpendDashboardProviderBreakdown.swift.spendDashboardProviderBreakdowns (cyclomatic 16) · ×1
  • SpendDashboardProviderBreakdown.swift.spendDashboardProviderBreakdowns (cyclomatic 16) Sources/CodexBar/SpendDashboardProviderBreakdown.swift:33 — SpendDashboardProviderBreakdown.swift.spendDashboardProviderBreakdowns has cyclomatic complexity 16 (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 · CodexBarCLI.dailyCostLines (cyclomatic 16) · ×1
  • CodexBarCLI.dailyCostLines (cyclomatic 16) Sources/CodexBarCLI/CLICostCommand.swift:325 — CodexBarCLI.dailyCostLines 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 · ToonSerializer.looksNumeric (cyclomatic 16) · ×1
  • ToonSerializer.looksNumeric (cyclomatic 16) Sources/CodexBarCLI/ToonFormatter.swift:402 — ToonSerializer.looksNumeric has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentSessionNameFormatter.agentPath (cyclomatic 16) · ×1
  • AgentSessionNameFormatter.agentPath (cyclomatic 16) Sources/CodexBarCore/AgentSession.swift:690 — AgentSessionNameFormatter.agentPath 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 · CodexThreadMetadataReader.projectMetadata (cyclomatic 16) · ×1
  • CodexThreadMetadataReader.projectMetadata (cyclomatic 16) Sources/CodexBarCore/CodexThreadMetadataReader+Projects.swift:12 — CodexThreadMetadataReader.projectMetadata 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 · LocalAgentSessionScanner.sessions (cyclomatic 16) · ×1
  • LocalAgentSessionScanner.sessions (cyclomatic 16) Sources/CodexBarCore/LocalAgentSessionScanner.swift:375 — LocalAgentSessionScanner.sessions 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 · PiFamilySessionFileParser.parse (cyclomatic 16) · ×1
  • PiFamilySessionFileParser.parse (cyclomatic 16) Sources/CodexBarCore/PiFamilySessionScanner.swift:25 — PiFamilySessionFileParser.parse has cyclomatic complexity 16 (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 · PiSessionCostScanner.extractUsage (cyclomatic 16) · ×1
  • PiSessionCostScanner.extractUsage (cyclomatic 16) Sources/CodexBarCore/PiSessionCostScanner.swift:1151 — PiSessionCostScanner.extractUsage has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a 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 · SessionToolActivityStore.scan (cyclomatic 16) · ×1
  • SessionToolActivityStore.scan (cyclomatic 16) Sources/CodexBarCore/SessionToolActivityStore.swift:130 — SessionToolActivityStore.scan 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 · UsageLimitsAvailability.resolve (cyclomatic 16) · ×1
  • UsageLimitsAvailability.resolve (cyclomatic 16) Sources/CodexBarCore/UsageFetcher.swift:718 — UsageLimitsAvailability.resolve 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 · OpenAIDashboardWebViewCache.acquire (cyclomatic 16) · ×1
  • OpenAIDashboardWebViewCache.acquire (cyclomatic 16) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardWebViewCache.swift:314 — OpenAIDashboardWebViewCache.acquire 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 · ProviderPluginHTTPResponse.fetch (cyclomatic 16) · ×1
  • ProviderPluginHTTPResponse.fetch (cyclomatic 16) Sources/CodexBarCore/Plugins/ProviderPluginHTTPResponse.swift:112 — ProviderPluginHTTPResponse.fetch 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 · ProviderPluginSnapshotMapper.map (cyclomatic 16) · ×1
  • ProviderPluginSnapshotMapper.map (cyclomatic 16) Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:37 — ProviderPluginSnapshotMapper.map 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 · ProviderPluginSnapshotMapper.costUsage (cyclomatic 16) · ×1
  • ProviderPluginSnapshotMapper.costUsage (cyclomatic 16) Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:337 — ProviderPluginSnapshotMapper.costUsage 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 · AntigravityCLISession.finishProbe (cyclomatic 16) · ×1
  • AntigravityCLISession.finishProbe (cyclomatic 16) Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:306 — AntigravityCLISession.finishProbe 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 · AntigravityLocalReader.inspectSQLiteTableSupport (cyclomatic 16) · ×1
  • AntigravityLocalReader.inspectSQLiteTableSupport (cyclomatic 16) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLiteSchema.swift:21 — AntigravityLocalReader.inspectSQLiteTableSupport 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 · AugmentSessionKeepalive.pingSessionEndpoint (cyclomatic 16) · ×1
  • AugmentSessionKeepalive.pingSessionEndpoint (cyclomatic 16) Sources/CodexBarCore/Providers/Augment/AugmentSessionKeepalive.swift:397 — AugmentSessionKeepalive.pingSessionEndpoint 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 · ClaudeCLIScreen.write (cyclomatic 16) · ×1
  • ClaudeCLIScreen.write (cyclomatic 16) Sources/CodexBarCore/Providers/Claude/ClaudeCLIScreen.swift:59 — ClaudeCLIScreen.write 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 · ClaudeCLISession.workspaceTrustKeys (cyclomatic 16) · ×1
  • ClaudeCLISession.workspaceTrustKeys (cyclomatic 16) Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:257 — ClaudeCLISession.workspaceTrustKeys 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 · ClaudeStatusProbe.extractUsageError (cyclomatic 16) · ×1
  • ClaudeStatusProbe.extractUsageError (cyclomatic 16) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:652 — ClaudeStatusProbe.extractUsageError 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 · CursorStatusProbe.fetchTeamSpend (cyclomatic 16) · ×1
  • CursorStatusProbe.fetchTeamSpend (cyclomatic 16) Sources/CodexBarCore/Providers/Cursor/CursorTeamSpend.swift:65 — CursorStatusProbe.fetchTeamSpend 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 · DeepSeekUsageCostParser.parse (cyclomatic 16) · ×1
  • DeepSeekUsageCostParser.parse (cyclomatic 16) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:296 — DeepSeekUsageCostParser.parse 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 · DeepSeekUsageCostParser.aggregateMonth (cyclomatic 16) · ×1
  • DeepSeekUsageCostParser.aggregateMonth (cyclomatic 16) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:582 — DeepSeekUsageCostParser.aggregateMonth 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 shape REPEATS in the file: one other method here (DeepSeekUsageCostParser.buildDailyUsages) 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 · DeepSeekUsageCostParser.buildDailyUsages (cyclomatic 16) · ×1
  • DeepSeekUsageCostParser.buildDailyUsages (cyclomatic 16) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:713 — DeepSeekUsageCostParser.buildDailyUsages 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 shape REPEATS in the file: one other method here (DeepSeekUsageCostParser.aggregateMonth) 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 · DevinUsageParser.percent (cyclomatic 16) · ×1
  • DevinUsageParser.percent (cyclomatic 16) Sources/CodexBarCore/Providers/Devin/DevinUsageSnapshot.swift:204 — DevinUsageParser.percent 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 · KimiUsageSnapshot.toUsageSnapshot (cyclomatic 16) · ×1
  • KimiUsageSnapshot.toUsageSnapshot (cyclomatic 16) Sources/CodexBarCore/Providers/Kimi/KimiUsageSnapshot.swift:73 — KimiUsageSnapshot.toUsageSnapshot 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 · KiroUsageLimitsAPI.parse (cyclomatic 16) · ×1
  • KiroUsageLimitsAPI.parse (cyclomatic 16) Sources/CodexBarCore/Providers/Kiro/KiroUsageLimitsAPI.swift:207 — KiroUsageLimitsAPI.parse 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 · OpenAILiveUsageBuilder.build (cyclomatic 16) · ×1
  • OpenAILiveUsageBuilder.build (cyclomatic 16) Sources/CodexBarCore/Providers/OpenAI/OpenAILiveUsageBuilder.swift:5 — OpenAILiveUsageBuilder.build 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 · OpenAIOrgRateLimitsFetcher.pages (cyclomatic 16) · ×1
  • OpenAIOrgRateLimitsFetcher.pages (cyclomatic 16) Sources/CodexBarCore/Providers/OpenAI/OpenAIOrgRateLimitsFetcher.swift:64 — OpenAIOrgRateLimitsFetcher.pages 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 · OpenCodeGoLocalUsageReader.readRows (cyclomatic 16) · ×1
  • OpenCodeGoLocalUsageReader.readRows (cyclomatic 16) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoLocalUsageReader.swift:95 — OpenCodeGoLocalUsageReader.readRows 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 · OpenCodeGoZenBalanceParser.parseConsoleBillingStatus (cyclomatic 16) · ×1
  • OpenCodeGoZenBalanceParser.parseConsoleBillingStatus (cyclomatic 16) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoZenBalanceParser.swift:6 — OpenCodeGoZenBalanceParser.parseConsoleBillingStatus 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 · ClaudeOAuthCredentialsStore.claudeKeychainCandidatesProbeWithoutPrompt (cyclomatic 16) · ×1
  • ClaudeOAuthCredentialsStore.claudeKeychainCandidatesProbeWithoutPrompt (cyclomatic 16) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:2309 — ClaudeOAuthCredentialsStore.claudeKeychainCandidatesProbeWithoutPrompt 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 · ClaudeOAuthCredentialsStore.readRawClaudeKeychainPayloadViaSecurityCLIIfEnabled (cyclomatic 16) · ×1
  • ClaudeOAuthCredentialsStore.readRawClaudeKeychainPayloadViaSecurityCLIIfEnabled (cyclomatic 16) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials+SecurityCLIReader.swift:88 — ClaudeOAuthCredentialsStore.readRawClaudeKeychainPayloadViaSecurityCLIIfEnabled 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 · WidgetUsageRow.rows (cyclomatic 16) · ×1
  • WidgetUsageRow.rows (cyclomatic 16) Sources/CodexBarWidget/CodexBarWidgetViews.swift:364 — WidgetUsageRow.rows 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 · Survey.recordLine (cyclomatic 16) · ×1
  • Survey.recordLine (cyclomatic 16) Scripts/cost_jsonl_shape_survey.swift:34 — Survey.recordLine 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 · acknowledgements.check (cyclomatic 16) · ×1
  • acknowledgements.check (cyclomatic 16) Scripts/acknowledgements.py:134 — acknowledgements.check 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 · mimo-usage.aggregate_usage (cyclomatic 16) · ×1
  • mimo-usage.aggregate_usage (cyclomatic 16) Scripts/mimo-usage.py:85 — mimo-usage.aggregate_usage 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 · Notifications.transition (cyclomatic 16) · ×1
  • Notifications.transition (cyclomatic 16) Integrations/Linux/Shared/Notifications.js:2 — Notifications.transition has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 10, 8, 5). 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 · localization-formats.printfSignature (cyclomatic 16) · ×1
  • localization-formats.printfSignature (cyclomatic 16) Scripts/localization-formats.mjs:12 — localization-formats.printfSignature has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · docs-list.extractMetadata (cyclomatic 16) · ×1
  • docs-list.extractMetadata (cyclomatic 16) Scripts/docs-list.mjs:28 — docs-list.extractMetadata 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.
D17 · Explicit Debt · TodoComment · ×1
  • TodoComment Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:567 — // TODO: Confirm usedRatio contract (0.0-1.0 vs 0.0-100.0) and tighten this fallback. — 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 · fetchUsage (cognitive 222) · ×1
  • fetchUsage (cognitive 222) Sources/CodexBarCore/Resources/Plugins/openrouter.js:24 — fetchUsage has cognitive complexity 222 (threshold 15). Drivers by points: if/else 59 (124 pts), boolean chains 41, ternaries 14 (30 pts), loops 4 (12 pts), error handling 6 (10 pts), other 5 (nesting depth added 93). Of this number, 202 points are the body's own statements and 20 belong to 9 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TTYCommandRunner.run (cognitive 141) · ×1
  • TTYCommandRunner.run (cognitive 141) Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:455 — TTYCommandRunner.run has cognitive complexity 141 (threshold 15). Drivers by points: if/else 81 (155 pts), boolean chains 38, loops 8 (15 pts), ternaries 4 (7 pts), match/switch 1 (3 pts), error handling 2 (nesting depth added 86). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (TTYCommandRunner.run::processNonCodexChunk) 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 · ProviderPluginManifest.init (cognitive 112) · ×1
  • ProviderPluginManifest.init (cognitive 112) REDACTED:127 — ProviderPluginManifest.init has cognitive complexity 112 (threshold 15). Drivers by points: if/else 45 (72 pts), boolean chains 31, loops 5 (7 pts), match/switch 1 (2 pts) (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 · AntigravityOAuthConfig.binaryClient (cognitive 108) · ×1
  • AntigravityOAuthConfig.binaryClient (cognitive 108) Sources/CodexBarCore/Providers/Antigravity/AntigravityOAuthCredentialsStore.swift:322 — AntigravityOAuthConfig.binaryClient has cognitive complexity 108 (threshold 15). Drivers by points: if/else 18 (59 pts), boolean chains 32, ternaries 3 (11 pts), loops 3 (6 pts) (nesting depth added 52). Of this number, 92 points are the body's own statements and 16 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 · fetchUsage (cognitive 95) · ×1
  • fetchUsage (cognitive 95) Sources/CodexBarCore/Resources/Plugins/poe.js:15 — fetchUsage has cognitive complexity 95 (threshold 15). Drivers by points: ternaries 18 (31 pts), if/else 20 (30 pts), boolean chains 24, other 5, loops 3 (4 pts), error handling 1 (nesting depth added 24). Of this number, 74 points are the body's own statements and 21 belong to 17 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 · fetchUsage (cognitive 89) · ×1
  • fetchUsage (cognitive 89) Sources/CodexBarCore/Resources/Plugins/zai.js:24 — fetchUsage has cognitive complexity 89 (threshold 15). Drivers by points: if/else 53 (75 pts), boolean chains 57, ternaries 33 (48 pts), loops 3 (5 pts), error handling 2 (4 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetchUsage (cognitive 87) · ×1
  • fetchUsage (cognitive 87) Sources/CodexBarCore/Resources/Plugins/openai.js:14 — fetchUsage has cognitive complexity 87 (threshold 15). Drivers by points: if/else 42 (80 pts), boolean chains 61, ternaries 25 (41 pts), loops 10 (16 pts), error handling 4 (5 pts) (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetchUsage (cognitive 82) · ×1
  • fetchUsage (cognitive 82) Sources/CodexBarCore/Resources/Plugins/sub2api.js:10 — fetchUsage has cognitive complexity 82 (threshold 15). Drivers by points: boolean chains 41, if/else 30 (34 pts), error handling 3, ternaries 3, loops 1 (nesting depth added 4). Of this number, 55 points are the body's own statements and 27 belong to 9 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ClaudeCLISession.captureExclusive (cognitive 79) · ×1
  • ClaudeCLISession.captureExclusive (cognitive 79) Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:143 — ClaudeCLISession.captureExclusive has cognitive complexity 79 (threshold 15). Drivers by points: if/else 18 (46 pts), boolean chains 21, loops 3 (7 pts), ternaries 1 (5 pts) (nesting depth added 36). Of this number, 78 points are the body's own statements and 1 belongs 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 · CostUsageFetcher.loadTokenResult (cognitive 78) · ×1
  • CostUsageFetcher.loadTokenResult (cognitive 78) Sources/CodexBarCore/CostUsageFetcher.swift:466 — CostUsageFetcher.loadTokenResult has cognitive complexity 78 (threshold 15). Drivers by points: if/else 33 (52 pts), boolean chains 20, loops 1 (3 pts), ternaries 1 (2 pts), error handling 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 · applyProviderPluginPrelude (cognitive 72) · ×1
  • applyProviderPluginPrelude (cognitive 72) REDACTED:2 — applyProviderPluginPrelude has cognitive complexity 72 (threshold 15). Drivers by points: if/else 24 (36 pts), boolean chains 17, ternaries 11, loops 6, error handling 2 (nesting depth added 12). None of this is in the body itself: all 72 points belong to 52 function items inside it that branch (postOptions, a function literal at line 105, formatNumber, …). 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 · UsageStore.runCodexCostCatchUp (cognitive 71) · ×1
  • UsageStore.runCodexCostCatchUp (cognitive 71) Sources/CodexBar/UsageStore+CodexCostCatchUp.swift:107 — UsageStore.runCodexCostCatchUp has cognitive complexity 71 (threshold 15). Drivers by points: if/else 11 (41 pts), error handling 4 (10 pts), boolean chains 7, ternaries 2 (6 pts), match/switch 1 (4 pts), loops 2 (3 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProviderPluginCookiePolicy.init (cognitive 71) · ×1
  • ProviderPluginCookiePolicy.init (cognitive 71) Sources/CodexBarCore/Plugins/ProviderPluginCookiePolicy.swift:42 — ProviderPluginCookiePolicy.init has cognitive complexity 71 (threshold 15). Drivers by points: boolean chains 45, if/else 19 (25 pts), ternaries 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 · SpendDashboardSource.load (cognitive 67) · ×1
  • SpendDashboardSource.load (cognitive 67) Sources/CodexBar/SpendDashboardController.swift:489 — SpendDashboardSource.load has cognitive complexity 67 (threshold 15). Drivers by points: if/else 10 (36 pts), error handling 4 (16 pts), loops 4 (14 pts), ternaries 1 (nesting depth added 48). 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 · StatusItemController.applyIcon (cognitive 66) · ×1
  • StatusItemController.applyIcon (cognitive 66) Sources/CodexBar/StatusItemController+Animation.swift:340 — StatusItemController.applyIcon has cognitive complexity 66 (threshold 15). Drivers by points: ternaries 23 (35 pts), if/else 14 (19 pts), boolean chains 12 (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 · fetchUsage (cognitive 65) · ×1
  • fetchUsage (cognitive 65) Sources/CodexBarCore/Resources/Plugins/deepgram.js:11 — fetchUsage has cognitive complexity 65 (threshold 15). Drivers by points: if/else 25 (31 pts), boolean chains 26, loops 3 (4 pts), error handling 2, ternaries 2 (nesting depth added 7). Of this number, 29 points are the body's own statements and 36 belong to 8 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · UsageStore.limitResetDetectorTransition (cognitive 64) · ×1
  • UsageStore.limitResetDetectorTransition (cognitive 64) Sources/CodexBar/UsageStore+LimitResetCelebration.swift:299 — UsageStore.limitResetDetectorTransition has cognitive complexity 64 (threshold 15). Drivers by points: boolean chains 32, if/else 24 (25 pts), ternaries 5 (7 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 · CodexCLISession.captureStatus (cognitive 64) · ×1
  • CodexCLISession.captureStatus (cognitive 64) Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:52 — CodexCLISession.captureStatus has cognitive complexity 64 (threshold 15). Drivers by points: if/else 21 (45 pts), boolean chains 16, loops 2 (3 pts) (nesting depth added 25). Of this number, 63 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CostHistoryChartMenuView.body (cognitive 62) · ×1
  • CostHistoryChartMenuView.body (cognitive 62) Sources/CodexBar/CostHistoryChartMenuView.swift:119 — CostHistoryChartMenuView.body has cognitive complexity 62 (threshold 15). Drivers by points: if/else 21 (43 pts), ternaries 9 (17 pts), boolean chains 2 (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 · CodexBarCLI.topCostModelLines (cognitive 62) · ×1
  • CodexBarCLI.topCostModelLines (cognitive 62) Sources/CodexBarCLI/CLICostCommand.swift:363 — CodexBarCLI.topCostModelLines has cognitive complexity 62 (threshold 15). Drivers by points: if/else 14 (30 pts), ternaries 11 (19 pts), boolean chains 9, loops 3 (4 pts) (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 · StatusItemController.addActionableSections (cognitive 60) · ×1
  • StatusItemController.addActionableSections (cognitive 60) Sources/CodexBar/StatusItemController+Menu.swift:850 — StatusItemController.addActionableSections has cognitive complexity 60 (threshold 15). Drivers by points: if/else 12 (41 pts), loops 3 (7 pts), ternaries 1 (5 pts), boolean chains 4, match/switch 1 (3 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PiSessionCostScanner.loadDailyReportResultCancellable (cognitive 59) · ×1
  • PiSessionCostScanner.loadDailyReportResultCancellable (cognitive 59) Sources/CodexBarCore/PiSessionCostScanner.swift:155 — PiSessionCostScanner.loadDailyReportResultCancellable has cognitive complexity 59 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 18, loops 4 (10 pts), ternaries 3 (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 · CodexRequestLedger.load (cognitive 57) · ×1
  • CodexRequestLedger.load (cognitive 57) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift:65 — CodexRequestLedger.load has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (36 pts), boolean chains 17, loops 3 (4 pts) (nesting depth added 19). Of this number, 54 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 · fetchUsage (cognitive 57) · ×1
  • fetchUsage (cognitive 57) REDACTED:11 — fetchUsage has cognitive complexity 57 (threshold 15). Drivers by points: if/else 23 (34 pts), boolean chains 10, ternaries 6 (8 pts), loops 2 (3 pts), error handling 1, other 1 (nesting depth added 14). Of this number, 47 points are the body's own statements and 10 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 · ProviderSettingsTokenAccountsRowView.body (cognitive 55) · ×1
  • ProviderSettingsTokenAccountsRowView.body (cognitive 55) Sources/CodexBar/PreferencesProviderSettingsRows.swift:248 — ProviderSettingsTokenAccountsRowView.body has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (29 pts), ternaries 10 (22 pts), boolean chains 4 (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 · OpenAIDashboardFetcher.collectPageSnapshot (cognitive 55) · ×1
  • OpenAIDashboardFetcher.collectPageSnapshot (cognitive 55) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher+PageScrape.swift:34 — OpenAIDashboardFetcher.collectPageSnapshot has cognitive complexity 55 (threshold 15). Drivers by points: if/else 18 (40 pts), boolean chains 14, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MenuBarLayoutRenderer.renderUncached (cognitive 54) · ×1
  • MenuBarLayoutRenderer.renderUncached (cognitive 54) Sources/CodexBar/MenuBarLayoutRenderer.swift:422 — MenuBarLayoutRenderer.renderUncached has cognitive complexity 54 (threshold 15). Drivers by points: boolean chains 22, if/else 13 (21 pts), ternaries 7 (8 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CostUsageFetcher.loadCachedCodexTokenSnapshotResult (cognitive 54) · ×1
  • CostUsageFetcher.loadCachedCodexTokenSnapshotResult (cognitive 54) Sources/CodexBarCore/CostUsageFetcher.swift:1369 — CostUsageFetcher.loadCachedCodexTokenSnapshotResult has cognitive complexity 54 (threshold 15). Drivers by points: if/else 18 (31 pts), boolean chains 21, ternaries 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · install.main (cognitive 53) · ×1
  • install.main (cognitive 53) Integrations/Linux/install.py:61 — install.main has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (26 pts), loops 6 (14 pts), boolean chains 9, ternaries 4 (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 · UsageStore.handleProviderFetchFailure (cognitive 52) · ×1
  • UsageStore.handleProviderFetchFailure (cognitive 52) Sources/CodexBar/UsageStore+Refresh.swift:1304 — UsageStore.handleProviderFetchFailure has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 26, if/else 21 (26 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 · DeepSeekUsageCostParser.aggregateMonth (cognitive 51) · ×1
  • DeepSeekUsageCostParser.aggregateMonth (cognitive 51) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:582 — DeepSeekUsageCostParser.aggregateMonth has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (34 pts), loops 5 (15 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeepSeekUsageCostParser.buildDailyUsages) 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 · DeepSeekUsageCostParser.buildDailyUsages (cognitive 51) · ×1
  • DeepSeekUsageCostParser.buildDailyUsages (cognitive 51) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:713 — DeepSeekUsageCostParser.buildDailyUsages has cognitive complexity 51 (threshold 15). Drivers by points: if/else 10 (34 pts), loops 5 (15 pts), boolean chains 2 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (DeepSeekUsageCostParser.aggregateMonth) 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 · QoderCookieRouting.preprocessedCurlShellText (cognitive 51) · ×1
  • QoderCookieRouting.preprocessedCurlShellText (cognitive 51) Sources/CodexBarCore/Providers/Qoder/QoderCookieRouting.swift:399 — QoderCookieRouting.preprocessedCurlShellText has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (39 pts), boolean chains 8, match/switch 1 (2 pts), loops 1, ternaries 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · fetchUsage (cognitive 51) · ×1
  • fetchUsage (cognitive 51) REDACTED:10 — fetchUsage has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 14, ternaries 5 (8 pts), loops 2 (5 pts), error handling 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 · UsageStore.menuCardInput (cognitive 50) · ×1
  • UsageStore.menuCardInput (cognitive 50) Sources/CodexBar/UsageStore+MenuCardModel.swift:50 — UsageStore.menuCardInput has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 22 (25 pts), boolean chains 22, if/else 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · BurnTheme.init (cognitive 50) · ×1
  • BurnTheme.init (cognitive 50) Sources/CodexBarWidget/BurnDownWidgetViews.swift:550 — BurnTheme.init has cognitive complexity 50 (threshold 15). Drivers by points: ternaries 24 (48 pts), if/else 2 (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 · MenuDescriptor.usageSection (cognitive 49) · ×1
  • MenuDescriptor.usageSection (cognitive 49) Sources/CodexBar/MenuDescriptor.swift:250 — MenuDescriptor.usageSection has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 11, ternaries 2 (7 pts), match/switch 1 (3 pts), loops 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 · PiSessionCostScanner.parsePiSessionFile (cognitive 49) · ×1
  • PiSessionCostScanner.parsePiSessionFile (cognitive 49) Sources/CodexBarCore/PiSessionCostScanner.swift:832 — PiSessionCostScanner.parsePiSessionFile has cognitive complexity 49 (threshold 15). Drivers by points: if/else 24 (44 pts), boolean chains 3, error handling 2 (nesting depth added 20). Of this number, 43 points are the body's own statements and 6 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 · ProviderPluginCookieBroker.advance (cognitive 49) · ×1
  • ProviderPluginCookieBroker.advance (cognitive 49) Sources/CodexBarCore/Plugins/ProviderPluginCookieBroker.swift:301 — ProviderPluginCookieBroker.advance has cognitive complexity 49 (threshold 15). Drivers by points: if/else 16 (33 pts), boolean chains 7, ternaries 2 (6 pts), loops 2 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpendDashboardModel.modelSummary (cognitive 48) · ×1
  • SpendDashboardModel.modelSummary (cognitive 48) Sources/CodexBar/SpendDashboardModel+ModelBreakdown.swift:31 — SpendDashboardModel.modelSummary has cognitive complexity 48 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 14, loops 3 (6 pts), ternaries 2, match/switch 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 · UsageStore.importOpenAIDashboardCookiesIfNeeded (cognitive 48) · ×1
  • UsageStore.importOpenAIDashboardCookiesIfNeeded (cognitive 48) Sources/CodexBar/UsageStore+OpenAIWeb.swift:1182 — UsageStore.importOpenAIDashboardCookiesIfNeeded has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (28 pts), ternaries 4 (10 pts), boolean chains 4, match/switch 2 (4 pts), error handling 2 (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 · MiniMaxLocalStorageImporter.readLocalStorage (cognitive 47) · ×1
  • MiniMaxLocalStorageImporter.readLocalStorage (cognitive 47) Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:137 — MiniMaxLocalStorageImporter.readLocalStorage has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 7 (13 pts), boolean chains 8 (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 · Usage.rows (cognitive 47) · ×1
  • Usage.rows (cognitive 47) Integrations/Linux/Shared/Usage.js:39 — Usage.rows has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 27, ternaries 16 (17 pts), if/else 3 (nesting depth added 1). Most of this is not in the body itself: 4 of the 47 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 44, 57, 65, …). 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 · localization-formats.pluralCatalogErrors (cognitive 47) · ×1
  • localization-formats.pluralCatalogErrors (cognitive 47) Scripts/localization-formats.mjs:46 — localization-formats.pluralCatalogErrors has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (33 pts), boolean chains 6, loops 3 (6 pts), error handling 1 (2 pts) (nesting depth added 25). Of this number, 37 points are the body's own statements and 10 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 · UsageStore.resolvePlanUtilizationAccountKey (cognitive 45) · ×1
  • UsageStore.resolvePlanUtilizationAccountKey (cognitive 45) Sources/CodexBar/UsageStore+PlanUtilization.swift:1077 — UsageStore.resolvePlanUtilizationAccountKey has cognitive complexity 45 (threshold 15). Drivers by points: if/else 16 (35 pts), boolean chains 10 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · DeepSeekUsageCostParser.parseByAPIKey (cognitive 45) · ×1
  • DeepSeekUsageCostParser.parseByAPIKey (cognitive 45) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:795 — DeepSeekUsageCostParser.parseByAPIKey has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 8 (17 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiniMaxLocalStorageImporter.importAccessTokens (cognitive 45) · ×1
  • MiniMaxLocalStorageImporter.importAccessTokens (cognitive 45) Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:14 — MiniMaxLocalStorageImporter.importAccessTokens has cognitive complexity 45 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 6 (14 pts), ternaries 3 (12 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpendDashboardModel.projectRows (cognitive 43) · ×1
  • SpendDashboardModel.projectRows (cognitive 43) Sources/CodexBar/SpendDashboardModel.swift:835 — SpendDashboardModel.projectRows has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (25 pts), boolean chains 9, loops 3 (6 pts), ternaries 2, match/switch 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 · UsageStore.runSpendDashboardCodexCostCatchUp (cognitive 43) · ×1
  • UsageStore.runSpendDashboardCodexCostCatchUp (cognitive 43) Sources/CodexBar/UsageStore+SpendDashboardCodexCostCatchUp.swift:143 — UsageStore.runSpendDashboardCodexCostCatchUp has cognitive complexity 43 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 6, error handling 2 (4 pts), ternaries 2 (4 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 20). Of this number, 41 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PiFamilySessionScanner.costSessionRoots (cognitive 43) · ×1
  • PiFamilySessionScanner.costSessionRoots (cognitive 43) Sources/CodexBarCore/PiFamilySessionScanner.swift:391 — PiFamilySessionScanner.costSessionRoots has cognitive complexity 43 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 9, loops 4 (7 pts), match/switch 2 (6 pts), ternaries 1 (nesting depth added 17). Of this number, 39 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetchUsage (cognitive 43) · ×1
  • fetchUsage (cognitive 43) Sources/CodexBarCore/Resources/Plugins/clawrouter.js:16 — fetchUsage has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (27 pts), boolean chains 12, ternaries 2 (3 pts), error handling 1 (nesting depth added 7). Of this number, 32 points are the body's own statements and 11 belong to 8 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 · StatusItemController.populateMenu (cognitive 42) · ×1
  • StatusItemController.populateMenu (cognitive 42) Sources/CodexBar/StatusItemController+Menu.swift:221 — StatusItemController.populateMenu has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 32, if/else 6, ternaries 3, match/switch 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 · UsageStore.performOpenAIDashboardRefreshIfNeeded (cognitive 42) · ×1
  • UsageStore.performOpenAIDashboardRefreshIfNeeded (cognitive 42) Sources/CodexBar/UsageStore+OpenAIWeb.swift:539 — UsageStore.performOpenAIDashboardRefreshIfNeeded has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (37 pts), error handling 3, boolean chains 2 (nesting depth added 20). 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 · MenuDescriptor.accountEntries (cognitive 41) · ×1
  • MenuDescriptor.accountEntries (cognitive 41) Sources/CodexBar/MenuDescriptor.swift:434 — MenuDescriptor.accountEntries has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 13, ternaries 1 (3 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.refreshCodexVisibleAccountsForMenu (cognitive 41) · ×1
  • UsageStore.refreshCodexVisibleAccountsForMenu (cognitive 41) Sources/CodexBar/UsageStore+TokenAccounts.swift:150 — UsageStore.refreshCodexVisibleAccountsForMenu has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 8, ternaries 3 (6 pts), loops 1, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenCodeGoLocalUsageFetchStrategy.snapshot (cognitive 41) · ×1
  • OpenCodeGoLocalUsageFetchStrategy.snapshot (cognitive 41) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift:229 — OpenCodeGoLocalUsageFetchStrategy.snapshot has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 9 (14 pts), boolean chains 5, ternaries 1 (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 · UsageMenuCardView.body (cognitive 40) · ×1
  • UsageMenuCardView.body (cognitive 40) Sources/CodexBar/MenuCardView.swift:219 — UsageMenuCardView.body has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 10, ternaries 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QuotaSnapshots.init (cognitive 40) · ×1
  • QuotaSnapshots.init (cognitive 40) Sources/CodexBarCore/CopilotUsageModels.swift:233 — QuotaSnapshots.init has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 9, error handling 1 (3 pts), loops 1 (2 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AlibabaCodingPlanUsageFetcher.parseUsageSnapshot (cognitive 40) · ×1
  • AlibabaCodingPlanUsageFetcher.parseUsageSnapshot (cognitive 40) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:443 — AlibabaCodingPlanUsageFetcher.parseUsageSnapshot has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 13 (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 · AntigravityLocalReader.aggregate (cognitive 40) · ×1
  • AntigravityLocalReader.aggregate (cognitive 40) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalReader.swift:187 — AntigravityLocalReader.aggregate has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 7, ternaries 3, 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 · KiroStatusProbe.runCommand (cognitive 40) · ×1
  • KiroStatusProbe.runCommand (cognitive 40) Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:1209 — KiroStatusProbe.runCommand has cognitive complexity 40 (threshold 15). Drivers by points: if/else 12 (36 pts), match/switch 1 (2 pts), boolean chains 1, 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 · SessionEquivalentBurnEstimator.estimate (cognitive 39) · ×1
  • SessionEquivalentBurnEstimator.estimate (cognitive 39) Sources/CodexBar/SessionEquivalentForecast.swift:172 — SessionEquivalentBurnEstimator.estimate has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 17, loops 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpendDashboardSource.makeRequest (cognitive 39) · ×1
  • SpendDashboardSource.makeRequest (cognitive 39) Sources/CodexBar/SpendDashboardController.swift:223 — SpendDashboardSource.makeRequest has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 9, loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.refreshCreditsIfNeeded (cognitive 39) · ×1
  • UsageStore.refreshCreditsIfNeeded (cognitive 39) Sources/CodexBar/Providers/Codex/UsageStore+CodexRefresh.swift:124 — UsageStore.refreshCreditsIfNeeded has cognitive complexity 39 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 9, 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 · AntigravityCLISession.ensureStartedLocked (cognitive 39) · ×1
  • AntigravityCLISession.ensureStartedLocked (cognitive 39) Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:498 — AntigravityCLISession.ensureStartedLocked has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 6, error handling 2 (4 pts), ternaries 1 (3 pts), loops 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 · AuggieCLIProbe.parse (cognitive 39) · ×1
  • AuggieCLIProbe.parse (cognitive 39) Sources/CodexBarCore/Providers/Augment/AuggieCLIProbe.swift:55 — AuggieCLIProbe.parse has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (33 pts), boolean chains 5, loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KiloUsageFetcher.creditFields (cognitive 39) · ×1
  • KiloUsageFetcher.creditFields (cognitive 39) Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:579 — KiloUsageFetcher.creditFields has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 11, ternaries 2 (6 pts), loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MenuBarLayoutRenderer.removeDuplicateBalanceResets (cognitive 38) · ×1
  • MenuBarLayoutRenderer.removeDuplicateBalanceResets (cognitive 38) Sources/CodexBar/MenuBarLayoutRenderer.swift:564 — MenuBarLayoutRenderer.removeDuplicateBalanceResets has cognitive complexity 38 (threshold 15). Drivers by points: loops 5 (13 pts), boolean chains 12, if/else 6 (9 pts), ternaries 1 (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 · OpenAIDashboardBrowserCookieImporter.importBestCookies (cognitive 38) · ×1
  • OpenAIDashboardBrowserCookieImporter.importBestCookies (cognitive 38) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:119 — OpenAIDashboardBrowserCookieImporter.importBestCookies has cognitive complexity 38 (threshold 15). Drivers by points: if/else 13 (18 pts), error handling 3 (11 pts), match/switch 1 (4 pts), boolean chains 2, loops 2, 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 · AmpUsageParser.parse (cognitive 38) · ×1
  • AmpUsageParser.parse (cognitive 38) Sources/CodexBarCore/Providers/Amp/AmpUsageParser.swift:20 — AmpUsageParser.parse has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 19, if/else 10 (12 pts), ternaries 5 (7 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 · Lexer.number (cognitive 38) · ×1
  • Lexer.number (cognitive 38) Sources/CodexBarCore/Providers/Antigravity/AntigravityJSONLObject.swift:116 — Lexer.number has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (22 pts), loops 4 (7 pts), boolean chains 6, ternaries 2 (3 pts) (nesting depth added 10). Of this number, 34 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetchUsage (cognitive 38) · ×1
  • fetchUsage (cognitive 38) REDACTED:11 — fetchUsage has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 20 (24 pts), boolean chains 16, if/else 11 (16 pts), other 6, loops 3 (4 pts), error handling 2 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Model.extraRateWindowMetrics (cognitive 37) · ×1
  • Model.extraRateWindowMetrics (cognitive 37) Sources/CodexBar/MenuCardView+ModelHelpers.swift:945 — Model.extraRateWindowMetrics has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18, boolean chains 12, ternaries 7. 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 · UsageStore.handleSessionQuotaTransition (cognitive 37) · ×1
  • UsageStore.handleSessionQuotaTransition (cognitive 37) Sources/CodexBar/UsageStore+SessionQuotaTransition.swift:7 — UsageStore.handleSessionQuotaTransition has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 9, ternaries 1 (3 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 · Lexer.object (cognitive 37) · ×1
  • Lexer.object (cognitive 37) Sources/CodexBarCore/Providers/Antigravity/AntigravityJSONLObject.swift:34 — Lexer.object has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 3 (5 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IconRenderer.makeIcon (cognitive 36) · ×1
  • IconRenderer.makeIcon (cognitive 36) Sources/CodexBar/IconRenderer.swift:142 — IconRenderer.makeIcon has cognitive complexity 36 (threshold 15). Drivers by points: if/else 40 (63 pts), ternaries 10 (20 pts), boolean chains 13, loops 5 (12 pts) (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (IconRenderer.makeIcon::drawBar) 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 · StatusItemController.menuIdentitySignature (cognitive 36) · ×1
  • StatusItemController.menuIdentitySignature (cognitive 36) Sources/CodexBar/StatusItemController+MenuTracking.swift:391 — StatusItemController.menuIdentitySignature has cognitive complexity 36 (threshold 15). Drivers by points: loops 6 (15 pts), ternaries 3 (12 pts), if/else 4 (8 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.applyProviderRefreshSuccess (cognitive 36) · ×1
  • UsageStore.applyProviderRefreshSuccess (cognitive 36) Sources/CodexBar/UsageStore+Refresh.swift:630 — UsageStore.applyProviderRefreshSuccess has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20, boolean chains 13, 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 · SessionToolActivityStore.scan (cognitive 36) · ×1
  • SessionToolActivityStore.scan (cognitive 36) Sources/CodexBarCore/SessionToolActivityStore.swift:130 — SessionToolActivityStore.scan has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (28 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · ProviderPluginHTTPResponse.request (cognitive 36) · ×1
  • ProviderPluginHTTPResponse.request (cognitive 36) Sources/CodexBarCore/Plugins/ProviderPluginHTTPResponse.swift:224 — ProviderPluginHTTPResponse.request has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 6, ternaries 2 (4 pts), loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FactoryStatusProbe.fetchWithCookies (cognitive 36) · ×1
  • FactoryStatusProbe.fetchWithCookies (cognitive 36) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:930 — FactoryStatusProbe.fetchWithCookies has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (14 pts), error handling 5 (11 pts), boolean chains 5, match/switch 1 (4 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionUsagePresentation.sessions (cognitive 35) · ×1
  • SessionUsagePresentation.sessions (cognitive 35) Sources/CodexBar/SessionUsagePresentation.swift:17 — SessionUsagePresentation.sessions has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (20 pts), ternaries 5 (13 pts), boolean chains 1, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpendDashboardController.handleBuiltRequest (cognitive 35) · ×1
  • SpendDashboardController.handleBuiltRequest (cognitive 35) Sources/CodexBar/SpendDashboardController.swift:1415 — SpendDashboardController.handleBuiltRequest has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 9, ternaries 1 (3 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StatusItemController.addOverviewRows (cognitive 35) · ×1
  • StatusItemController.addOverviewRows (cognitive 35) Sources/CodexBar/StatusItemController+Menu.swift:545 — StatusItemController.addOverviewRows has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (23 pts), ternaries 3 (8 pts), boolean chains 3, 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 · UsageStore.reconcileClaudeRefreshAfterFetch (cognitive 35) · ×1
  • UsageStore.reconcileClaudeRefreshAfterFetch (cognitive 35) Sources/CodexBar/UsageStore+Refresh.swift:492 — UsageStore.reconcileClaudeRefreshAfterFetch has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 19, if/else 13 (15 pts), ternaries 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 · UsageStore.refreshTokenUsage (cognitive 35) · ×1
  • UsageStore.refreshTokenUsage (cognitive 35) Sources/CodexBar/UsageStore.swift:1447 — UsageStore.refreshTokenUsage has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20 (27 pts), boolean chains 7, error handling 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 · SignatureReader.validate (cognitive 35) · ×1
  • SignatureReader.validate (cognitive 35) Sources/CodexBarCore/CodexLaunchPreflight+SignatureIdentity.swift:131 — SignatureReader.validate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 13, 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 · PiFamilySessionScanner.scan (cognitive 35) · ×1
  • PiFamilySessionScanner.scan (cognitive 35) Sources/CodexBarCore/PiFamilySessionScanner.swift:223 — PiFamilySessionScanner.scan has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 5, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AntigravityLocalReader.discover (cognitive 35) · ×1
  • AntigravityLocalReader.discover (cognitive 35) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalScan.swift:132 — AntigravityLocalReader.discover has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (26 pts), error handling 2 (5 pts), loops 2 (3 pts), boolean chains 1 (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 · DeepSeekUsageCostParser.aggregateDay (cognitive 35) · ×1
  • DeepSeekUsageCostParser.aggregateDay (cognitive 35) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:540 — DeepSeekUsageCostParser.aggregateDay has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (25 pts), loops 4 (10 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 · ClaudeOAuthPendingCacheClearUserDefaultsStore.withCacheTransaction (cognitive 35) · ×1
  • ClaudeOAuthPendingCacheClearUserDefaultsStore.withCacheTransaction (cognitive 35) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthPendingCacheClearStore.swift:151 — ClaudeOAuthPendingCacheClearUserDefaultsStore.withCacheTransaction has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 5, ternaries 1 (3 pts), match/switch 1 (2 pts), error handling 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 · fetchUsage (cognitive 35) · ×1
  • fetchUsage (cognitive 35) Sources/CodexBarCore/Resources/Plugins/traecn.js:9 — fetchUsage has cognitive complexity 35 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 6 (10 pts), boolean chains 8, error handling 1, loops 1, other 1 (nesting depth added 9). Of this number, 25 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 · HistoricalUsageHistoryStore.backfillCodexWeeklyFromUsageBreakdown (cognitive 34) · ×1
  • HistoricalUsageHistoryStore.backfillCodexWeeklyFromUsageBreakdown (cognitive 34) Sources/CodexBar/HistoricalUsagePace.swift:154 — HistoricalUsageHistoryStore.backfillCodexWeeklyFromUsageBreakdown has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 8, 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 · UsageStore.resolvedClaudeOAuthHistoryOwner (cognitive 34) · ×1
  • UsageStore.resolvedClaudeOAuthHistoryOwner (cognitive 34) Sources/CodexBar/UsageStore+PlanUtilization.swift:998 — UsageStore.resolvedClaudeOAuthHistoryOwner has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 7, ternaries 3 (6 pts), loops 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexBarCLI.runStandardCost (cognitive 34) · ×1
  • CodexBarCLI.runStandardCost (cognitive 34) Sources/CodexBarCLI/CLICostCommand.swift:18 — CodexBarCLI.runStandardCost has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 4, match/switch 2 (4 pts), error handling 2 (3 pts), loops 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SignatureReader.slice (cognitive 34) · ×1
  • SignatureReader.slice (cognitive 34) Sources/CodexBarCore/CodexLaunchPreflight+SignatureIdentity.swift:89 — SignatureReader.slice has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 16, if/else 8 (14 pts), ternaries 2 (3 pts), 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 · CostUsageFetcher.codexBreakdownsWithMetadata (cognitive 34) · ×1
  • CostUsageFetcher.codexBreakdownsWithMetadata (cognitive 34) Sources/CodexBarCore/CostUsageFetcher.swift:1009 — CostUsageFetcher.codexBreakdownsWithMetadata has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 5 (7 pts), boolean chains 6 (nesting depth added 14). Of this number, 33 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MuseLocalUsageReader.parseLine (cognitive 34) · ×1
  • MuseLocalUsageReader.parseLine (cognitive 34) Sources/CodexBarCore/Providers/Muse/MuseLocalUsageReader.swift:496 — MuseLocalUsageReader.parseLine has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 21, if/else 11, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CodexHistoricalPaceEvaluator.evaluate (cognitive 33) · ×1
  • CodexHistoricalPaceEvaluator.evaluate (cognitive 33) Sources/CodexBar/HistoricalUsagePace.swift:758 — CodexHistoricalPaceEvaluator.evaluate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (20 pts), loops 4 (6 pts), boolean chains 5, ternaries 2 (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 · MenuBarLayoutPersistence.preferredLibrary (cognitive 33) · ×1
  • MenuBarLayoutPersistence.preferredLibrary (cognitive 33) Sources/CodexBar/MenuBarLayout.swift:1303 — MenuBarLayoutPersistence.preferredLibrary has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 8 (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 · SpendDashboardModel.buildCurrencyGroup (cognitive 33) · ×1
  • SpendDashboardModel.buildCurrencyGroup (cognitive 33) Sources/CodexBar/SpendDashboardModel.swift:588 — SpendDashboardModel.buildCurrencyGroup has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (11 pts), loops 3 (4 pts), match/switch 2 (4 pts), ternaries 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 · UsageStore.shouldExcludeFromHighestUsage (cognitive 33) · ×1
  • UsageStore.shouldExcludeFromHighestUsage (cognitive 33) Sources/CodexBar/UsageStore+HighestUsage.swift:92 — UsageStore.shouldExcludeFromHighestUsage has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 11, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.handleQuotaWarningTransitions (cognitive 33) · ×1
  • UsageStore.handleQuotaWarningTransitions (cognitive 33) Sources/CodexBar/UsageStore+QuotaWarnings.swift:36 — UsageStore.handleQuotaWarningTransitions has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 6 (9 pts), boolean chains 8, loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · PiSessionCostScanner.buildReport (cognitive 33) · ×1
  • PiSessionCostScanner.buildReport (cognitive 33) Sources/CodexBarCore/PiSessionCostScanner+Aggregation.swift:17 — PiSessionCostScanner.buildReport has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 11 (18 pts), if/else 5 (11 pts), loops 2 (3 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 · AntigravityLocalReader.readDatabase (cognitive 33) · ×1
  • AntigravityLocalReader.readDatabase (cognitive 33) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift:133 — AntigravityLocalReader.readDatabase has cognitive complexity 33 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AugmentSessionKeepalive.pingSessionEndpoint (cognitive 33) · ×1
  • AugmentSessionKeepalive.pingSessionEndpoint (cognitive 33) Sources/CodexBarCore/Providers/Augment/AugmentSessionKeepalive.swift:397 — AugmentSessionKeepalive.pingSessionEndpoint has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MenuBarLayoutRenderer.renderItem (cognitive 32) · ×1
  • MenuBarLayoutRenderer.renderItem (cognitive 32) Sources/CodexBar/MenuBarLayoutRenderer.swift:727 — MenuBarLayoutRenderer.renderItem has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 9 (20 pts), if/else 4 (6 pts), boolean chains 5, match/switch 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 · SessionQuotaTransitionReducer.evaluate (cognitive 32) · ×1
  • SessionQuotaTransitionReducer.evaluate (cognitive 32) Sources/CodexBar/SessionQuotaNotifications.swift:155 — SessionQuotaTransitionReducer.evaluate has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 13, match/switch 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.makeWidgetEntry (cognitive 32) · ×1
  • UsageStore.makeWidgetEntry (cognitive 32) Sources/CodexBar/UsageStore+WidgetSnapshot.swift:235 — UsageStore.makeWidgetEntry has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12, boolean chains 10, ternaries 7 (9 pts), match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · CodexWeeklyResetConfirmation.confirmationDecision (cognitive 32) · ×1
  • CodexWeeklyResetConfirmation.confirmationDecision (cognitive 32) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:152 — CodexWeeklyResetConfirmation.confirmationDecision has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 18, if/else 9 (11 pts), ternaries 1 (3 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 · CopilotLoginFlow.run (cognitive 32) · ×1
  • CopilotLoginFlow.run (cognitive 32) Sources/CodexBar/Providers/Copilot/CopilotLoginFlow.swift:7 — CopilotLoginFlow.run has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (18 pts), ternaries 2 (7 pts), error handling 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AmpUsageSnapshot.toUsageSnapshot (cognitive 32) · ×1
  • AmpUsageSnapshot.toUsageSnapshot (cognitive 32) Sources/CodexBarCore/Providers/Amp/AmpUsageSnapshot.swift:91 — AmpUsageSnapshot.toUsageSnapshot has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 6, ternaries 4 (6 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · mimo-usage.aggregate_usage (cognitive 32) · ×1
  • mimo-usage.aggregate_usage (cognitive 32) Scripts/mimo-usage.py:85 — mimo-usage.aggregate_usage has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 5 (9 pts), boolean chains 3, error handling 1 (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 · docs-list.extractMetadata (cognitive 32) · ×1
  • docs-list.extractMetadata (cognitive 32) Scripts/docs-list.mjs:28 — docs-list.extractMetadata has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (26 pts), error handling 1 (4 pts), boolean chains 1, loops 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 · fetchUsage (cognitive 32) · ×1
  • fetchUsage (cognitive 32) Sources/CodexBarCore/Resources/Plugins/venice.js:15 — fetchUsage has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 15, if/else 14, ternaries 3. Of this number, 27 points are the body's own statements and 5 belong to one function item 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 · Model.metrics (cognitive 31) · ×1
  • Model.metrics (cognitive 31) Sources/CodexBar/MenuCardView.swift:1206 — Model.metrics has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 13, if/else 10 (11 pts), ternaries 4 (7 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Model.secondaryMetric (cognitive 31) · ×1
  • Model.secondaryMetric (cognitive 31) Sources/CodexBar/MenuCardView.swift:1382 — Model.secondaryMetric has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 15, if/else 13 (14 pts), ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · UsageStore.planUtilizationSeriesSamples (cognitive 31) · ×1
  • UsageStore.planUtilizationSeriesSamples (cognitive 31) Sources/CodexBar/UsageStore+PlanUtilization.swift:561 — UsageStore.planUtilizationSeriesSamples has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, loops 1 (2 pts), match/switch 2 (nesting depth added 9). Of this number, 24 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.refreshSpendDashboardTokenUsageNow (cognitive 31) · ×1
  • UsageStore.refreshSpendDashboardTokenUsageNow (cognitive 31) Sources/CodexBar/UsageStore+SpendDashboardTokenCost.swift:70 — UsageStore.refreshSpendDashboardTokenUsageNow has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 6, 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 · CodexWeeklyResetConfirmation.evaluateDelayedCandidateCreation (cognitive 31) · ×1
  • CodexWeeklyResetConfirmation.evaluateDelayedCandidateCreation (cognitive 31) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:231 — CodexWeeklyResetConfirmation.evaluateDelayedCandidateCreation has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18, boolean chains 13. 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 · CodexWeeklyResetConfirmation.evaluateDelayedCandidate (cognitive 31) · ×1
  • CodexWeeklyResetConfirmation.evaluateDelayedCandidate (cognitive 31) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:292 — CodexWeeklyResetConfirmation.evaluateDelayedCandidate has cognitive complexity 31 (threshold 15). Drivers by points: if/else 19, boolean chains 11, ternaries 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 · CodexBarCLI.fetchUsageOutput (cognitive 31) · ×1
  • CodexBarCLI.fetchUsageOutput (cognitive 31) Sources/CodexBarCLI/CLIUsageCommand.swift:423 — CodexBarCLI.fetchUsageOutput has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, ternaries 2 (3 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PiFamilySessionScanner.retainedSettingsRootResolution (cognitive 31) · ×1
  • PiFamilySessionScanner.retainedSettingsRootResolution (cognitive 31) Sources/CodexBarCore/PiFamilySessionScanner.swift:756 — PiFamilySessionScanner.retainedSettingsRootResolution has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 6, ternaries 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexBarConfigValidator.validateProvider (cognitive 31) · ×1
  • CodexBarConfigValidator.validateProvider (cognitive 31) Sources/CodexBarCore/Config/CodexBarConfigValidation.swift:112 — CodexBarConfigValidator.validateProvider has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 20, if/else 11. To reduce it, name the conditions: bind each compound test to a 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 · JavaScriptCoreProviderPluginEngine.makeContext (cognitive 31) · ×1
  • JavaScriptCoreProviderPluginEngine.makeContext (cognitive 31) Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:639 — JavaScriptCoreProviderPluginEngine.makeContext has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 8, error handling 6, ternaries 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AntigravityLocalReader.readStepTimestamps (cognitive 31) · ×1
  • AntigravityLocalReader.readStepTimestamps (cognitive 31) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift:322 — AntigravityLocalReader.readStepTimestamps has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 7, 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 · AntigravityLocalReader.appendRecoveredEvents (cognitive 31) · ×1
  • AntigravityLocalReader.appendRecoveredEvents (cognitive 31) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift:619 — AntigravityLocalReader.appendRecoveredEvents has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 2, loops 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GrokLocalSessionScanner.summarize (cognitive 31) · ×1
  • GrokLocalSessionScanner.summarize (cognitive 31) Sources/CodexBarCore/Providers/Grok/GrokLocalSessionScanner.swift:80 — GrokLocalSessionScanner.summarize has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (7 pts), boolean chains 4 (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 · Repository.loadRecord (cognitive 31) · ×1
  • Repository.loadRecord (cognitive 31) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:336 — Repository.loadRecord has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 5, error handling 3 (4 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeSubscriptionMetadataFetcher.fetchVerified (cognitive 31) · ×1
  • ClaudeSubscriptionMetadataFetcher.fetchVerified (cognitive 31) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeSubscriptionMetadata.swift:113 — ClaudeSubscriptionMetadataFetcher.fetchVerified has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 8, ternaries 1 (2 pts), error handling 1 (nesting depth added 11). Of this number, 18 points are the body's own statements and 13 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 · BurnChartCanvas.body (cognitive 31) · ×1
  • BurnChartCanvas.body (cognitive 31) Sources/CodexBarWidget/BurnDownWidgetViews.swift:320 — BurnChartCanvas.body has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (24 pts), ternaries 3 (5 pts), loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.swift.top-level code (cognitive 31) · ×1
  • main.swift.top-level code (cognitive 31) Scripts/StoreStress/main.swift:25 — main.swift.top-level code has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 12 (26 pts), error handling 1 (2 pts), if/else 2, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpendProviderBreakdownRows.providerGroup (cognitive 30) · ×1
  • SpendProviderBreakdownRows.providerGroup (cognitive 30) Sources/CodexBar/SpendDashboardProviderBreakdown.swift:128 — SpendProviderBreakdownRows.providerGroup has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 5 (10 pts), boolean chains 4 (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 · StatusItemController.tickBlink (cognitive 30) · ×1
  • StatusItemController.tickBlink (cognitive 30) Sources/CodexBar/StatusItemController+Animation.swift:122 — StatusItemController.tickBlink has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 1 (4 pts), boolean chains 3, loops 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 · UsageStore.applySelectedOutcome (cognitive 30) · ×1
  • UsageStore.applySelectedOutcome (cognitive 30) Sources/CodexBar/UsageStore+TokenAccounts.swift:1462 — UsageStore.applySelectedOutcome has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 8, ternaries 3 (6 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexThreadMetadataReader.tomlString (cognitive 30) · ×1
  • CodexThreadMetadataReader.tomlString (cognitive 30) Sources/CodexBarCore/CodexThreadMetadataReader.swift:327 — CodexThreadMetadataReader.tomlString has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 3 (8 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AntigravityCLIHTTPSFetchStrategy.waitForSnapshot (cognitive 30) · ×1
  • AntigravityCLIHTTPSFetchStrategy.waitForSnapshot (cognitive 30) Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:841 — AntigravityCLIHTTPSFetchStrategy.waitForSnapshot has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (22 pts), error handling 3 (7 pts), loops 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 · DeepSeekPlatformTokenImporter.resolve (cognitive 30) · ×1
  • DeepSeekPlatformTokenImporter.resolve (cognitive 30) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekPlatformTokenImporter.swift:139 — DeepSeekPlatformTokenImporter.resolve has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (18 pts), ternaries 3 (6 pts), boolean chains 4, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GrokWebBillingFetcher.parseGRPCWebResponse (cognitive 30) · ×1
  • GrokWebBillingFetcher.parseGRPCWebResponse (cognitive 30) Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:312 — GrokWebBillingFetcher.parseGRPCWebResponse has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 21, if/else 6, ternaries 2, loops 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 · MistralSubscriptionBudgetParser.collectModels (cognitive 30) · ×1
  • MistralSubscriptionBudgetParser.collectModels (cognitive 30) Sources/CodexBarCore/Providers/Mistral/MistralSubscriptionBudgetParser.swift:91 — MistralSubscriptionBudgetParser.collectModels has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 9, ternaries 2 (5 pts), loops 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 · ReplayEngine.runDetailed (cognitive 29) · ×1
  • ReplayEngine.runDetailed (cognitive 29) Sources/AdaptiveReplayKit/ReplayEngine.swift:53 — ReplayEngine.runDetailed has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 8, ternaries 2, 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 · Model.costHistoryInlineDashboard (cognitive 29) · ×1
  • Model.costHistoryInlineDashboard (cognitive 29) Sources/CodexBar/InlineUsageDashboardContent.swift:272 — Model.costHistoryInlineDashboard has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 17, if/else 7 (8 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 · StatusItemController.menuWillOpen (cognitive 29) · ×1
  • StatusItemController.menuWillOpen (cognitive 29) Sources/CodexBar/StatusItemController+Menu.swift:66 — StatusItemController.menuWillOpen has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexThreadMetadataReader.decodeMultilineBasicString (cognitive 29) · ×1
  • CodexThreadMetadataReader.decodeMultilineBasicString (cognitive 29) Sources/CodexBarCore/CodexThreadMetadataReader.swift:373 — CodexThreadMetadataReader.decodeMultilineBasicString has cognitive complexity 29 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (7 pts), boolean chains 6, ternaries 1 (3 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 · CodexThreadMetadataReader.assignedProjectSessionIDs (cognitive 29) · ×1
  • CodexThreadMetadataReader.assignedProjectSessionIDs (cognitive 29) Sources/CodexBarCore/CodexThreadMetadataReader+Projects.swift:79 — CodexThreadMetadataReader.assignedProjectSessionIDs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 3, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIDashboardWebViewCache.acquire (cognitive 29) · ×1
  • OpenAIDashboardWebViewCache.acquire (cognitive 29) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardWebViewCache.swift:314 — OpenAIDashboardWebViewCache.acquire has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 5, error handling 1 (2 pts), loops 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 · OpenAISubscription.fetch (cognitive 29) · ×1
  • OpenAISubscription.fetch (cognitive 29) Sources/CodexBarCore/OpenAIWeb/OpenAISubscriptionMetadata.swift:94 — OpenAISubscription.fetch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (17 pts), ternaries 2 (6 pts), boolean chains 5, 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 · TTYCommandRunner.run · ×1
  • TTYCommandRunner.run::processNonCodexChunk (cognitive 29) Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:739 — TTYCommandRunner.run::processNonCodexChunk has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (TTYCommandRunner.run) 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 · AntigravityLocalReader.readRows (cognitive 29) · ×1
  • AntigravityLocalReader.readRows (cognitive 29) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift:535 — AntigravityLocalReader.readRows has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 4, loops 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 · AntigravityCLIHTTPSFetchStrategy.tryWarmAgyFetch (cognitive 29) · ×1
  • AntigravityCLIHTTPSFetchStrategy.tryWarmAgyFetch (cognitive 29) Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:350 — AntigravityCLIHTTPSFetchStrategy.tryWarmAgyFetch has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (15 pts), error handling 6 (10 pts), boolean chains 3, 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 · BedrockUsageFetcher.parseDailyResponse (cognitive 29) · ×1
  • BedrockUsageFetcher.parseDailyResponse (cognitive 29) Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:320 — BedrockUsageFetcher.parseDailyResponse has cognitive complexity 29 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 8, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CursorStatusProbe.resolveSession (cognitive 29) · ×1
  • CursorStatusProbe.resolveSession (cognitive 29) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe+SessionResolution.swift:37 — CursorStatusProbe.resolveSession has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (12 pts), match/switch 5 (9 pts), boolean chains 6, ternaries 2 (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 · CursorStatusProbe.parseUsageSummary (cognitive 29) · ×1
  • CursorStatusProbe.parseUsageSummary (cognitive 29) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe+UsageSummary.swift:5 — CursorStatusProbe.parseUsageSummary has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15, boolean chains 8, ternaries 6. Of this number, 28 points are the body's own statements and 1 belongs to one function item 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 · KiroUsageSnapshot.toUsageSnapshot (cognitive 29) · ×1
  • KiroUsageSnapshot.toUsageSnapshot (cognitive 29) Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:108 — KiroUsageSnapshot.toUsageSnapshot has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 11, ternaries 3 (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 · Recovery.repairFromClaudeKeychainWithoutPromptIfAllowed (cognitive 29) · ×1
  • Recovery.repairFromClaudeKeychainWithoutPromptIfAllowed (cognitive 29) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1152 — Recovery.repairFromClaudeKeychainWithoutPromptIfAllowed has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 8, ternaries 3 (6 pts), error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetchUsage (cognitive 29) · ×1
  • fetchUsage (cognitive 29) REDACTED:8 — fetchUsage has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 7, boolean chains 6, error handling 2, loops 1 (nesting depth added 2). Of this number, 16 points are the body's own statements and 13 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 · IconRenderer.makeIcon · ×1
  • IconRenderer.makeIcon::drawBar (cognitive 28) Sources/CodexBar/IconRenderer.swift:168 — IconRenderer.makeIcon::drawBar has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (24 pts), loops 1 (2 pts), ternaries 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. This shape REPEATS in the file: one other method here (IconRenderer.makeIcon) 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 · StatusItemController.performStoreRefresh (cognitive 28) · ×1
  • StatusItemController.performStoreRefresh (cognitive 28) Sources/CodexBar/StatusItemController+Actions.swift:74 — StatusItemController.performStoreRefresh has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (20 pts), boolean chains 8 (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 · StatusItemController.startManualRefresh (cognitive 28) · ×1
  • StatusItemController.startManualRefresh (cognitive 28) Sources/CodexBar/StatusItemController+Actions.swift:180 — StatusItemController.startManualRefresh has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 10, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · UsageStore.applyOpenAIDashboardAuthorityDecision (cognitive 28) · ×1
  • UsageStore.applyOpenAIDashboardAuthorityDecision (cognitive 28) Sources/CodexBar/UsageStore+OpenAIWeb.swift:231 — UsageStore.applyOpenAIDashboardAuthorityDecision has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, ternaries 2 (5 pts), 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 · CodexWeeklyResetConfirmation.initialDecision (cognitive 28) · ×1
  • CodexWeeklyResetConfirmation.initialDecision (cognitive 28) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:87 — CodexWeeklyResetConfirmation.initialDecision has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexBarCLI.runCacheClear (cognitive 28) · ×1
  • CodexBarCLI.runCacheClear (cognitive 28) Sources/CodexBarCLI/CLICacheCommand.swift:6 — CodexBarCLI.runCacheClear has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 3, error handling 1 (3 pts), loops 1 (2 pts), match/switch 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 · CookieHeaderCache.currentObservationMatch (cognitive 28) · ×1
  • CookieHeaderCache.currentObservationMatch (cognitive 28) Sources/CodexBarCore/CookieHeaderCache.swift:1396 — CookieHeaderCache.currentObservationMatch has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 5 (15 pts), if/else 3 (7 pts), match/switch 3 (5 pts), boolean chains 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 · PiSessionCostScanner.appendingPreviousSessionRoots (cognitive 28) · ×1
  • PiSessionCostScanner.appendingPreviousSessionRoots (cognitive 28) Sources/CodexBarCore/PiSessionCostScanner.swift:496 — PiSessionCostScanner.appendingPreviousSessionRoots has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 10, match/switch 1 (3 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 8). Of this number, 24 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PreferencesDocument.validate (cognitive 28) · ×1
  • PreferencesDocument.validate (cognitive 28) Sources/CodexBarCore/Config/PreferencesDocument.swift:132 — PreferencesDocument.validate has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 6, match/switch 1 (2 pts), loops 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 · ProviderIntentPayload.applying (cognitive 28) · ×1
  • ProviderIntentPayload.applying (cognitive 28) Sources/CodexBarCore/Sync/SyncModels.swift:77 — ProviderIntentPayload.applying has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (19 pts), ternaries 4 (8 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AntigravityLocalReader.readJSONLFile (cognitive 28) · ×1
  • AntigravityLocalReader.readJSONLFile (cognitive 28) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalJSONL.swift:24 — AntigravityLocalReader.readJSONLFile has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (19 pts), error handling 3 (4 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DoubaoUsageFetcher.decodeArkcliUsage (cognitive 28) · ×1
  • DoubaoUsageFetcher.decodeArkcliUsage (cognitive 28) Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:504 — DoubaoUsageFetcher.decodeArkcliUsage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (5 pts), boolean chains 4, loops 2 (3 pts), match/switch 1 (2 pts), 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 · Repository.loadFromClaudeKeychainWithPromptIfAllowed (cognitive 28) · ×1
  • Repository.loadFromClaudeKeychainWithPromptIfAllowed (cognitive 28) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:542 — Repository.loadFromClaudeKeychainWithPromptIfAllowed has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, error handling 3 (4 pts), match/switch 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetchUsage (cognitive 28) · ×1
  • fetchUsage (cognitive 28) Sources/CodexBarCore/Resources/Plugins/fal.js:8 — fetchUsage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9, ternaries 6 (9 pts), boolean chains 8, error handling 1, other 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 · Model.providerCostSection (cognitive 27) · ×1
  • Model.providerCostSection (cognitive 27) Sources/CodexBar/MenuCardView+Costs.swift:471 — Model.providerCostSection has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 3, ternaries 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · MenuBarLayoutBalanceResolver.balance (cognitive 27) · ×1
  • MenuBarLayoutBalanceResolver.balance (cognitive 27) Sources/CodexBar/MenuBarLayout.swift:684 — MenuBarLayoutBalanceResolver.balance has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 7, ternaries 2 (4 pts), match/switch 1 (nesting depth added 9). 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 · StatusItemController.menuBarDisplayText (cognitive 27) · ×1
  • StatusItemController.menuBarDisplayText (cognitive 27) Sources/CodexBar/StatusItemController+Animation.swift:748 — StatusItemController.menuBarDisplayText has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 12, if/else 9 (10 pts), ternaries 2 (3 pts), match/switch 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 · UsageStore.emitUserPluginHooks (cognitive 27) · ×1
  • UsageStore.emitUserPluginHooks (cognitive 27) Sources/CodexBar/UsageStore+UserPlugins.swift:120 — UsageStore.emitUserPluginHooks has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 5 (9 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.widgetAccounts (cognitive 27) · ×1
  • UsageStore.widgetAccounts (cognitive 27) Sources/CodexBar/UsageStore+WidgetAccounts.swift:42 — UsageStore.widgetAccounts has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 8, ternaries 3 (5 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CLIClaudeSwapText.sanitize (cognitive 27) · ×1
  • CLIClaudeSwapText.sanitize (cognitive 27) Sources/CodexBarCLI/CLIClaudeSwapCards.swift:24 — CLIClaudeSwapText.sanitize has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 2 (5 pts), ternaries 1 (3 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 · CodexBarCLI.runCodexIdentifiedUsage (cognitive 27) · ×1
  • CodexBarCLI.runCodexIdentifiedUsage (cognitive 27) Sources/CodexBarCLI/CLICodexIdentifiedUsage.swift:20 — CodexBarCLI.runCodexIdentifiedUsage has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 15, if/else 6 (7 pts), error handling 2 (3 pts), ternaries 1 (2 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 · CostUsageFetcher.loadLocalTokenScanResult (cognitive 27) · ×1
  • CostUsageFetcher.loadLocalTokenScanResult (cognitive 27) Sources/CodexBarCore/CostUsageFetcher.swift:879 — CostUsageFetcher.loadLocalTokenScanResult has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 13 (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 · AugmentSessionKeepalive.performRefreshPass (cognitive 27) · ×1
  • AugmentSessionKeepalive.performRefreshPass (cognitive 27) Sources/CodexBarCore/Providers/Augment/AugmentSessionKeepalive.swift:266 — AugmentSessionKeepalive.performRefreshPass has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), error handling 2, boolean chains 1, ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FactoryStatusProbe.fetch (cognitive 27) · ×1
  • FactoryStatusProbe.fetch (cognitive 27) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:635 — FactoryStatusProbe.fetch has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 2 (6 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 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 · QoderCookieRouting.httpRequestRoute (cognitive 27) · ×1
  • QoderCookieRouting.httpRequestRoute (cognitive 27) Sources/CodexBarCore/Providers/Qoder/QoderCookieRouting.swift:75 — QoderCookieRouting.httpRequestRoute has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 5, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Model.tokenUsageSection (cognitive 26) · ×1
  • Model.tokenUsageSection (cognitive 26) Sources/CodexBar/MenuCardView+Costs.swift:210 — Model.tokenUsageSection has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (14 pts), ternaries 8, boolean chains 3, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · QuotaBurndownModel.init (cognitive 26) · ×1
  • QuotaBurndownModel.init (cognitive 26) Sources/CodexBar/QuotaBurndownModel.swift:17 — QuotaBurndownModel.init has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (12 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.
D2 · Cognitive Complexity · ManualRefreshViewportMovementTracker.settlePendingGeometryChanges (cognitive 26) · ×1
  • ManualRefreshViewportMovementTracker.settlePendingGeometryChanges (cognitive 26) Sources/CodexBar/StatusItemController+MenuViewportRestore.swift:142 — ManualRefreshViewportMovementTracker.settlePendingGeometryChanges has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · UsageStore.runRefresh (cognitive 26) · ×1
  • UsageStore.runRefresh (cognitive 26) Sources/CodexBar/UsageStore.swift:766 — UsageStore.runRefresh has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 4, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · UsageStore.prepareLimitResetNotification (cognitive 26) · ×1
  • UsageStore.prepareLimitResetNotification (cognitive 26) Sources/CodexBar/LimitResetNotifications.swift:31 — UsageStore.prepareLimitResetNotification has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 9 (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 · UsageStore.recordPlanUtilizationHistorySample (cognitive 26) · ×1
  • UsageStore.recordPlanUtilizationHistorySample (cognitive 26) Sources/CodexBar/UsageStore+PlanUtilization.swift:210 — UsageStore.recordPlanUtilizationHistorySample has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 7, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · UsageStore.refreshProviderPass (cognitive 26) · ×1
  • UsageStore.refreshProviderPass (cognitive 26) Sources/CodexBar/UsageStore+Refresh.swift:293 — UsageStore.refreshProviderPass has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 5, ternaries 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, 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 · UsageStore.switchClaudeSwapAccount (cognitive 26) · ×1
  • UsageStore.switchClaudeSwapAccount (cognitive 26) Sources/CodexBar/Providers/Claude/UsageStore+ClaudeSwapRefresh.swift:181 — UsageStore.switchClaudeSwapAccount has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (9 pts), ternaries 3 (4 pts), loops 1 (2 pts), 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 · UsageStore.shouldApplyCodexUsageResult (cognitive 26) · ×1
  • UsageStore.shouldApplyCodexUsageResult (cognitive 26) Sources/CodexBar/Providers/Codex/UsageStore+CodexAccountState.swift:263 — UsageStore.shouldApplyCodexUsageResult has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 4, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CLIServeOperationCoordinator.sourceProduced (cognitive 26) · ×1
  • CLIServeOperationCoordinator.sourceProduced (cognitive 26) Sources/CodexBarCLI/CLIServeOperationCoordinator.swift:471 — CLIServeOperationCoordinator.sourceProduced has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 9, 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 · CostUsageFetcher.unknownPricingRefreshRequest (cognitive 26) · ×1
  • CostUsageFetcher.unknownPricingRefreshRequest (cognitive 26) Sources/CodexBarCore/CostUsageFetcher.swift:1212 — CostUsageFetcher.unknownPricingRefreshRequest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PiFamilySessionScanner.records (cognitive 26) · ×1
  • PiFamilySessionScanner.records (cognitive 26) Sources/CodexBarCore/PiFamilySessionScanner.swift:1234 — PiFamilySessionScanner.records has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIDashboardBrowserCookieImporter.evaluateCandidate (cognitive 26) · ×1
  • OpenAIDashboardBrowserCookieImporter.evaluateCandidate (cognitive 26) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:581 — OpenAIDashboardBrowserCookieImporter.evaluateCandidate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 2, error handling 2 (nesting depth added 12). 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 · OpenAIDashboardParser.parseSignedInEmailFromClientBootstrap (cognitive 26) · ×1
  • OpenAIDashboardParser.parseSignedInEmailFromClientBootstrap (cognitive 26) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:9 — OpenAIDashboardParser.parseSignedInEmailFromClientBootstrap has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 8, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QuickJSProviderPluginEngine.hostCookieHeader (cognitive 26) · ×1
  • QuickJSProviderPluginEngine.hostCookieHeader (cognitive 26) Sources/CodexBarCore/Plugins/QuickJSProviderPluginEngine.swift:702 — QuickJSProviderPluginEngine.hostCookieHeader has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7, loops 2 (5 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 · AntigravityLocalReader.consumeJSONLLine (cognitive 26) · ×1
  • AntigravityLocalReader.consumeJSONLLine (cognitive 26) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalJSONL.swift:85 — AntigravityLocalReader.consumeJSONLLine has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 7, 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 · AntigravityRemoteUsageFetcher.fetch (cognitive 26) · ×1
  • AntigravityRemoteUsageFetcher.fetch (cognitive 26) Sources/CodexBarCore/Providers/Antigravity/AntigravityRemoteUsageFetcher.swift:100 — AntigravityRemoteUsageFetcher.fetch has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 7, error handling 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 · ManagedCodexAccountCredentialResolver.resolve (cognitive 26) · ×1
  • ManagedCodexAccountCredentialResolver.resolve (cognitive 26) Sources/CodexBarCore/Providers/Codex/ManagedCodexAccountCredentialResolver.swift:155 — ManagedCodexAccountCredentialResolver.resolve has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 7, error handling 4, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CopilotDeviceFlow.pollForToken (cognitive 26) · ×1
  • CopilotDeviceFlow.pollForToken (cognitive 26) Sources/CodexBarCore/Providers/Copilot/CopilotDeviceFlow.swift:115 — CopilotDeviceFlow.pollForToken has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 2, loops 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 · DeepSeekUsageCostParser.buildBreakdowns (cognitive 26) · ×1
  • DeepSeekUsageCostParser.buildBreakdowns (cognitive 26) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:626 — DeepSeekUsageCostParser.buildBreakdowns has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 5 (7 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MuseLocalUsageReader.parseSessionLog (cognitive 26) · ×1
  • MuseLocalUsageReader.parseSessionLog (cognitive 26) Sources/CodexBarCore/Providers/Muse/MuseLocalUsageReader.swift:423 — MuseLocalUsageReader.parseSessionLog has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 2 (3 pts), boolean chains 2, error handling 1 (2 pts), match/switch 1 (nesting depth added 7). Of this number, 21 points are the body's own statements and 5 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 · OllamaUsageParser.looksSignedOut (cognitive 26) · ×1
  • OllamaUsageParser.looksSignedOut (cognitive 26) Sources/CodexBarCore/Providers/Ollama/OllamaUsageParser.swift:216 — OllamaUsageParser.looksSignedOut has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 23, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · QoderCookieRouting.curlHeaderHostSites (cognitive 26) · ×1
  • QoderCookieRouting.curlHeaderHostSites (cognitive 26) Sources/CodexBarCore/Providers/Qoder/QoderCookieRouting.swift:276 — QoderCookieRouting.curlHeaderHostSites has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 2 (5 pts), boolean chains 4, 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 · Recovery.syncWithClaudeKeychainIfChanged (cognitive 26) · ×1
  • Recovery.syncWithClaudeKeychainIfChanged (cognitive 26) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1075 — Recovery.syncWithClaudeKeychainIfChanged has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 7, error handling 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeOAuthRefreshFailureGate.reloadPersistedState (cognitive 26) · ×1
  • ClaudeOAuthRefreshFailureGate.reloadPersistedState (cognitive 26) REDACTED:374 — ClaudeOAuthRefreshFailureGate.reloadPersistedState has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 8, ternaries 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AliyunOneConsoleCookieImporter.importSession (cognitive 26) · ×1
  • AliyunOneConsoleCookieImporter.importSession (cognitive 26) Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieImporter.swift:66 — AliyunOneConsoleCookieImporter.importSession has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (17 pts), error handling 2 (4 pts), loops 2 (4 pts), 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 · main.swift.runReader (cognitive 26) · ×1
  • main.swift.runReader (cognitive 26) Scripts/StoreStress/main.swift:147 — main.swift.runReader has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 12). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ci_swiftpm_cache.restore (cognitive 26) · ×1
  • ci_swiftpm_cache.restore (cognitive 26) Scripts/ci_swiftpm_cache.py:246 — ci_swiftpm_cache.restore has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (18 pts), error handling 3 (5 pts), loops 2, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mimo-usage.parse_session_usage (cognitive 26) · ×1
  • mimo-usage.parse_session_usage (cognitive 26) Scripts/mimo-usage.py:36 — mimo-usage.parse_session_usage has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 8, error handling 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 · CursorLoginRunner.runUserInitiated (cognitive 25) · ×1
  • CursorLoginRunner.runUserInitiated (cognitive 25) Sources/CodexBar/CursorLoginRunner.swift:210 — CursorLoginRunner.runUserInitiated has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (21 pts), error handling 1 (2 pts), loops 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 · StatusItemController.attachMenus (cognitive 25) · ×1
  • StatusItemController.attachMenus (cognitive 25) Sources/CodexBar/StatusItemController.swift:834 — StatusItemController.attachMenus has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (23 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.codexWeeklyResetDecision (cognitive 25) · ×1
  • UsageStore.codexWeeklyResetDecision (cognitive 25) Sources/CodexBar/UsageStore+LimitResetCelebration.swift:438 — UsageStore.codexWeeklyResetDecision has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 25. To reduce it, name the conditions: bind each compound test to a 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 · UsageStore.hydrateCachedTokenSnapshots (cognitive 25) · ×1
  • UsageStore.hydrateCachedTokenSnapshots (cognitive 25) Sources/CodexBar/UsageStore+TokenCost.swift:387 — UsageStore.hydrateCachedTokenSnapshots has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 14, if/else 11. To reduce it, name the conditions: bind each compound test to a 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 · CLICardsRenderer.renderCard (cognitive 25) · ×1
  • CLICardsRenderer.renderCard (cognitive 25) Sources/CodexBarCLI/CLICardsRenderer.swift:296 — CLICardsRenderer.renderCard has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 5 (7 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexBarCLI.runCodexAccounts (cognitive 25) · ×1
  • CodexBarCLI.runCodexAccounts (cognitive 25) Sources/CodexBarCLI/CLICodexAccountsCommand.swift:27 — CodexBarCLI.runCodexAccounts has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 2 (8 pts), loops 1 (4 pts), boolean chains 1, error handling 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 · CodexBarCLI.runHooksTest (cognitive 25) · ×1
  • CodexBarCLI.runHooksTest (cognitive 25) Sources/CodexBarCLI/CLIHooksCommand.swift:75 — CodexBarCLI.runHooksTest has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 4 (10 pts), boolean chains 2, error handling 1 (2 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 · CodexBarCLI.fetchPlugin (cognitive 25) · ×1
  • CodexBarCLI.fetchPlugin (cognitive 25) Sources/CodexBarCLI/CLIPluginsCommand.swift:41 — CodexBarCLI.fetchPlugin has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 1 (3 pts), boolean chains 2, 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 · CodexBarCLI.handleServeRequest (cognitive 25) · ×1
  • CodexBarCLI.handleServeRequest (cognitive 25) Sources/CodexBarCLI/CLIServeCommand.swift:854 — CodexBarCLI.handleServeRequest has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 4 (10 pts), error handling 4 (6 pts), boolean chains 4, if/else 2 (4 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexThreadMetadataReader.multilineQuote (cognitive 25) · ×1
  • CodexThreadMetadataReader.multilineQuote (cognitive 25) Sources/CodexBarCore/CodexThreadMetadataReader.swift:237 — CodexThreadMetadataReader.multilineQuote has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (7 pts), match/switch 3 (4 pts), loops 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 · KeychainCacheStore.storeResult (cognitive 25) · ×1
  • KeychainCacheStore.storeResult (cognitive 25) Sources/CodexBarCore/KeychainCacheStore.swift:171 — KeychainCacheStore.storeResult has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 4, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Scanner.value (cognitive 25) · ×1
  • Scanner.value (cognitive 25) Sources/CodexBarCore/Config/OpaqueConfigJSON.swift:82 — Scanner.value has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AugmentSessionKeepalive.shouldRefreshSession (cognitive 25) · ×1
  • AugmentSessionKeepalive.shouldRefreshSession (cognitive 25) Sources/CodexBarCore/Providers/Augment/AugmentSessionKeepalive.swift:184 — AugmentSessionKeepalive.shouldRefreshSession has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (18 pts), ternaries 1 (4 pts), loops 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 · CodexDashboardAuthority.evaluate (cognitive 25) · ×1
  • CodexDashboardAuthority.evaluate (cognitive 25) Sources/CodexBarCore/Providers/Codex/CodexDashboardAuthority.swift:170 — CodexDashboardAuthority.evaluate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 3, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexRequestLedger.validate (cognitive 25) · ×1
  • CodexRequestLedger.validate (cognitive 25) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift:31 — CodexRequestLedger.validate has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 19, if/else 3 (5 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 · CopilotBudgetWebFetcher.normalizedBillingIdentifier (cognitive 25) · ×1
  • CopilotBudgetWebFetcher.normalizedBillingIdentifier (cognitive 25) Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:651 — CopilotBudgetWebFetcher.normalizedBillingIdentifier has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 15, if/else 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · JetBrainsQuotaLogReader.latestEntry (cognitive 25) · ×1
  • JetBrainsQuotaLogReader.latestEntry (cognitive 25) Sources/CodexBarCore/Providers/JetBrains/JetBrainsQuotaLogReader.swift:52 — JetBrainsQuotaLogReader.latestEntry has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 3, ternaries 1 (3 pts), loops 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 · OpenAILiveUsageFetcher.fetch (cognitive 25) · ×1
  • OpenAILiveUsageFetcher.fetch (cognitive 25) Sources/CodexBarCore/Providers/OpenAI/OpenAILiveUsageFetcher.swift:44 — OpenAILiveUsageFetcher.fetch has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (8 pts), boolean chains 2, error handling 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BurnDownLayout.body (cognitive 25) · ×1
  • BurnDownLayout.body (cognitive 25) Sources/CodexBarWidget/BurnDownWidgetViews.swift:66 — BurnDownLayout.body has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 17, boolean chains 5, if/else 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 · chutes.chutesQuota (cognitive 25) · ×1
  • chutes.chutesQuota (cognitive 25) Sources/CodexBarCore/Resources/Plugins/chutes.ts:149 — chutes.chutesQuota has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (13 pts), boolean chains 8, if/else 4 (nesting depth added 5). Of this number, 15 points are the body's own statements and 10 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 · AgentSessionsStore.reconcilePeriodicTasks (cognitive 24) · ×1
  • AgentSessionsStore.reconcilePeriodicTasks (cognitive 24) Sources/CodexBar/AgentSessionsStore.swift:289 — AgentSessionsStore.reconcilePeriodicTasks has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (10 pts), error handling 2 (6 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PlanUtilizationHistoryChartMenuView.seriesPoints (cognitive 24) · ×1
  • PlanUtilizationHistoryChartMenuView.seriesPoints (cognitive 24) Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:331 — PlanUtilizationHistoryChartMenuView.seriesPoints has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 4 (8 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 · SpendDashboardModel.inputSummary (cognitive 24) · ×1
  • SpendDashboardModel.inputSummary (cognitive 24) Sources/CodexBar/SpendDashboardModel.swift:740 — SpendDashboardModel.inputSummary has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 10, ternaries 7, if/else 3 (6 pts), loops 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 · StatusItemController.scheduleOpenMenuRefresh (cognitive 24) · ×1
  • StatusItemController.scheduleOpenMenuRefresh (cognitive 24) Sources/CodexBar/StatusItemController+Menu.swift:1158 — StatusItemController.scheduleOpenMenuRefresh has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (18 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · UsageStore.providerWithHighestUsage (cognitive 24) · ×1
  • UsageStore.providerWithHighestUsage (cognitive 24) Sources/CodexBar/UsageStore+HighestUsage.swift:8 — UsageStore.providerWithHighestUsage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), ternaries 2 (5 pts), boolean chains 4, 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 · CloudSyncEngine.processEvent (cognitive 24) · ×1
  • CloudSyncEngine.processEvent (cognitive 24) Sources/CodexBar/Sync/CloudSyncEngine.swift:803 — CloudSyncEngine.processEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, loops 2 (4 pts), match/switch 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexBarCLI.dailyCostLines (cognitive 24) · ×1
  • CodexBarCLI.dailyCostLines (cognitive 24) Sources/CodexBarCLI/CLICostCommand.swift:325 — CodexBarCLI.dailyCostLines has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4 (8 pts), boolean chains 4, 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 · CLIServeResponseCache.mergeLastGoodUsageItems (cognitive 24) · ×1
  • CLIServeResponseCache.mergeLastGoodUsageItems (cognitive 24) Sources/CodexBarCLI/CLIServeCommand.swift:394 — CLIServeResponseCache.mergeLastGoodUsageItems has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 5, loops 2, 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 · SignatureReader.digest (cognitive 24) · ×1
  • SignatureReader.digest (cognitive 24) Sources/CodexBarCore/CodexLaunchPreflight+SignatureIdentity.swift:55 — SignatureReader.digest has cognitive complexity 24 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 3 (8 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexThreadCatalogReader.loadResult (cognitive 24) · ×1
  • CodexThreadCatalogReader.loadResult (cognitive 24) Sources/CodexBarCore/CodexThreadCatalogReader.swift:66 — CodexThreadCatalogReader.loadResult has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 7, if/else 5 (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 · LocalAgentSessionScanner.sessions (cognitive 24) · ×1
  • LocalAgentSessionScanner.sessions (cognitive 24) Sources/CodexBarCore/LocalAgentSessionScanner.swift:375 — LocalAgentSessionScanner.sessions has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 4 (7 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 · PiSessionCostScanner.loadCachedDailyReportResult (cognitive 24) · ×1
  • PiSessionCostScanner.loadCachedDailyReportResult (cognitive 24) Sources/CodexBarCore/PiSessionCostScanner.swift:343 — PiSessionCostScanner.loadCachedDailyReportResult has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 6, ternaries 2 (3 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 · UsagePace.weekly (cognitive 24) · ×1
  • UsagePace.weekly (cognitive 24) Sources/CodexBarCore/UsagePace.swift:60 — UsagePace.weekly has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (17 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, 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 · ProviderPluginSnapshotMapper.aggregateCostUsageEntries (cognitive 24) · ×1
  • ProviderPluginSnapshotMapper.aggregateCostUsageEntries (cognitive 24) Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:458 — ProviderPluginSnapshotMapper.aggregateCostUsageEntries has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (6 pts), boolean chains 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 · AntigravityLocalReader.resolveStepTimestamps (cognitive 24) · ×1
  • AntigravityLocalReader.resolveStepTimestamps (cognitive 24) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift:493 — AntigravityLocalReader.resolveStepTimestamps has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AntigravityLocalReader.inspectSQLiteTableSupport (cognitive 24) · ×1
  • AntigravityLocalReader.inspectSQLiteTableSupport (cognitive 24) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLiteSchema.swift:21 — AntigravityLocalReader.inspectSQLiteTableSupport has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 5, ternaries 2 (5 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 · ClaudeCLIScreen.write (cognitive 24) · ×1
  • ClaudeCLIScreen.write (cognitive 24) Sources/CodexBarCore/Providers/Claude/ClaudeCLIScreen.swift:59 — ClaudeCLIScreen.write has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ClaudeCLISession.workspaceTrustKeys (cognitive 24) · ×1
  • ClaudeCLISession.workspaceTrustKeys (cognitive 24) Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:257 — ClaudeCLISession.workspaceTrustKeys has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (10 pts), boolean chains 2, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeStatusProbe.exactLocalOccurrences (cognitive 24) · ×1
  • ClaudeStatusProbe.exactLocalOccurrences (cognitive 24) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1130 — ClaudeStatusProbe.exactLocalOccurrences has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 15, if/else 6 (8 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 · IBMBobUsageFetcher.fetchUsage (cognitive 24) · ×1
  • IBMBobUsageFetcher.fetchUsage (cognitive 24) Sources/CodexBarCore/Providers/IBMBob/IBMBobUsageFetcher.swift:197 — IBMBobUsageFetcher.fetchUsage has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (5 pts), error handling 4, ternaries 1 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KimiDesktopSessionDiscovery.accessToken (cognitive 24) · ×1
  • KimiDesktopSessionDiscovery.accessToken (cognitive 24) Sources/CodexBarCore/Providers/Kimi/KimiDesktopSessionDiscovery.swift:55 — KimiDesktopSessionDiscovery.accessToken has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 18, if/else 5 (6 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 · KiroStatusProbe.runViaPipe (cognitive 24) · ×1
  • KiroStatusProbe.runViaPipe (cognitive 24) Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:662 — KiroStatusProbe.runViaPipe has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3, error handling 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KiroStatusProbe.parse (cognitive 24) · ×1
  • KiroStatusProbe.parse (cognitive 24) Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:884 — KiroStatusProbe.parse has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 10 (12 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 · MiniMaxUsageParser.parseCodingPlanRemains (cognitive 24) · ×1
  • MiniMaxUsageParser.parseCodingPlanRemains (cognitive 24) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift:774 — MiniMaxUsageParser.parseCodingPlanRemains has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, ternaries 3, 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 · ClaudeOAuthCredentialsStore.loadCodexBarOAuthKeychainCache (cognitive 24) · ×1
  • ClaudeOAuthCredentialsStore.loadCodexBarOAuthKeychainCache (cognitive 24) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:2635 — ClaudeOAuthCredentialsStore.loadCodexBarOAuthKeychainCache has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (19 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Repository.invalidateCacheIfCredentialsFileChanged (cognitive 24) · ×1
  • Repository.invalidateCacheIfCredentialsFileChanged (cognitive 24) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:820 — Repository.invalidateCacheIfCredentialsFileChanged has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12 (20 pts), match/switch 1 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Recovery.syncFromClaudeKeychainWithoutPrompt (cognitive 24) · ×1
  • Recovery.syncFromClaudeKeychainWithoutPrompt (cognitive 24) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:1232 — Recovery.syncFromClaudeKeychainWithoutPrompt has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 10 (12 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 · acknowledgements.check (cognitive 24) · ×1
  • acknowledgements.check (cognitive 24) Scripts/acknowledgements.py:134 — acknowledgements.check has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CLIArguments.parse (cognitive 23) · ×1
  • CLIArguments.parse (cognitive 23) Sources/AdaptiveReplayCLI/CLIArguments.swift:46 — CLIArguments.parse has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, match/switch 1 (2 pts), 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 · ProviderDetailView.body (cognitive 23) · ×1
  • ProviderDetailView.body (cognitive 23) Sources/CodexBar/PreferencesProviderDetailView.swift:135 — ProviderDetailView.body has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), ternaries 2 (6 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionEquivalentBurnEstimator.normalizedBurn (cognitive 23) · ×1
  • SessionEquivalentBurnEstimator.normalizedBurn (cognitive 23) Sources/CodexBar/SessionEquivalentForecast.swift:286 — SessionEquivalentBurnEstimator.normalizedBurn has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (9 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SpendDashboardController.startLoad (cognitive 23) · ×1
  • SpendDashboardController.startLoad (cognitive 23) Sources/CodexBar/SpendDashboardController.swift:1283 — SpendDashboardController.startLoad has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 7, loops 1 (2 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · StatusItemController.hydrateHostedSubviewMenuIfNeeded (cognitive 23) · ×1
  • StatusItemController.hydrateHostedSubviewMenuIfNeeded (cognitive 23) Sources/CodexBar/StatusItemController+HostedSubmenus.swift:91 — StatusItemController.hydrateHostedSubviewMenuIfNeeded has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, 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 · UsageStore.planUtilizationIdentityAccountKey (cognitive 23) · ×1
  • UsageStore.planUtilizationIdentityAccountKey (cognitive 23) Sources/CodexBar/UsageStore+PlanUtilization.swift:812 — UsageStore.planUtilizationIdentityAccountKey has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.handleQuotaWarningTransition (cognitive 23) · ×1
  • UsageStore.handleQuotaWarningTransition (cognitive 23) Sources/CodexBar/UsageStore+QuotaWarnings.swift:138 — UsageStore.handleQuotaWarningTransition has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 10 (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 · CLILocalHTTPServer.run (cognitive 23) · ×1
  • CLILocalHTTPServer.run (cognitive 23) Sources/CodexBarCLI/CLILocalHTTPServer.swift:328 — CLILocalHTTPServer.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 3, 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 · ProviderDiagnosticFetchAttempt.errorCategoryLabel (cognitive 23) · ×1
  • ProviderDiagnosticFetchAttempt.errorCategoryLabel (cognitive 23) Sources/CodexBarCore/Providers/ProviderDiagnosticExport.swift:328 — ProviderDiagnosticFetchAttempt.errorCategoryLabel has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 16, if/else 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 · CursorLocalCSVReader.parseFile (cognitive 23) · ×1
  • CursorLocalCSVReader.parseFile (cognitive 23) Sources/CodexBarCore/Providers/Cursor/CursorLocalCSVReader.swift:36 — CursorLocalCSVReader.parseFile has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 7, ternaries 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 · CursorStatusSnapshot.toUsageSnapshot (cognitive 23) · ×1
  • CursorStatusSnapshot.toUsageSnapshot (cognitive 23) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:448 — CursorStatusSnapshot.toUsageSnapshot has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, if/else 7, ternaries 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CursorStatusProbe.fetchWithCookieHeader (cognitive 23) · ×1
  • CursorStatusProbe.fetchWithCookieHeader (cognitive 23) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:1221 — CursorStatusProbe.fetchWithCookieHeader has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, error handling 1 (2 pts), match/switch 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 · MistralUsageSnapshot.toCostUsageTokenSnapshot (cognitive 23) · ×1
  • MistralUsageSnapshot.toCostUsageTokenSnapshot (cognitive 23) Sources/CodexBarCore/Providers/Mistral/MistralModels.swift:264 — MistralUsageSnapshot.toCostUsageTokenSnapshot has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 13, ternaries 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · OpenAILiveUsageBuilder.build (cognitive 23) · ×1
  • OpenAILiveUsageBuilder.build (cognitive 23) Sources/CodexBarCore/Providers/OpenAI/OpenAILiveUsageBuilder.swift:5 — OpenAILiveUsageBuilder.build has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIOrgRateLimitsFetcher.pages (cognitive 23) · ×1
  • OpenAIOrgRateLimitsFetcher.pages (cognitive 23) Sources/CodexBarCore/Providers/OpenAI/OpenAIOrgRateLimitsFetcher.swift:64 — OpenAIOrgRateLimitsFetcher.pages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, loops 2 (3 pts), error handling 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenCodeGoUsageFetcher.parseWindow (cognitive 23) · ×1
  • OpenCodeGoUsageFetcher.parseWindow (cognitive 23) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageFetcher.swift:704 — OpenCodeGoUsageFetcher.parseWindow has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 3 (6 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenCodeSubscriptionParser.parseUsageNested (cognitive 23) · ×1
  • OpenCodeSubscriptionParser.parseUsageNested (cognitive 23) Sources/CodexBarCore/Providers/Shared/OpenCodeSubscriptionParser.swift:65 — OpenCodeSubscriptionParser.parseUsageNested has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 9, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OneConsoleCookieRouting.redirectedRequest (cognitive 23) · ×1
  • OneConsoleCookieRouting.redirectedRequest (cognitive 23) Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleCookieRouting.swift:31 — OneConsoleCookieRouting.redirectedRequest has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 10 (11 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CombinedBurnRow.body (cognitive 23) · ×1
  • CombinedBurnRow.body (cognitive 23) Sources/CodexBarWidget/CombinedBurnDownWidgetViews.swift:141 — CombinedBurnRow.body has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 15, if/else 7, 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 · Survey.recordLine (cognitive 23) · ×1
  • Survey.recordLine (cognitive 23) Scripts/cost_jsonl_shape_survey.swift:34 — Survey.recordLine has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (20 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 · fetchUsage (cognitive 23) · ×1
  • fetchUsage (cognitive 23) Sources/CodexBarCore/Resources/Plugins/tavily.js:8 — fetchUsage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8, boolean chains 7, ternaries 7, error handling 1. Of this number, 16 points are the body's own statements and 7 belong to 6 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 · ProviderSwitcherView.init (cognitive 22) · ×1
  • ProviderSwitcherView.init (cognitive 22) Sources/CodexBar/StatusItemController+SwitcherViews.swift:48 — ProviderSwitcherView.init has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 3, boolean chains 2, loops 1 (nesting depth added 3). Of this number, 11 points are the body's own statements and 11 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 · UsageStore.presentationSnapshot (cognitive 22) · ×1
  • UsageStore.presentationSnapshot (cognitive 22) Sources/CodexBar/UsageStore+Accessors.swift:42 — UsageStore.presentationSnapshot has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (11 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 · UsageStore.debugClaudeLog (cognitive 22) · ×1
  • UsageStore.debugClaudeLog (cognitive 22) Sources/CodexBar/UsageStore+ClaudeDebug.swift:24 — UsageStore.debugClaudeLog has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), error handling 1 (2 pts), match/switch 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 · UsageStore.handleCredentialOutcome (cognitive 22) · ×1
  • UsageStore.handleCredentialOutcome (cognitive 22) Sources/CodexBar/UsageStore+CredentialNotifications.swift:50 — UsageStore.handleCredentialOutcome has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 10, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CloudSyncEngine.pushPendingSnapshots (cognitive 22) · ×1
  • CloudSyncEngine.pushPendingSnapshots (cognitive 22) Sources/CodexBar/Sync/CloudSyncEngine.swift:1425 — CloudSyncEngine.pushPendingSnapshots has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 1 (2 pts), boolean chains 1, 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 · CodexWorkspaceUsageSidecar.loadLatestSnapshot (cognitive 22) · ×1
  • CodexWorkspaceUsageSidecar.loadLatestSnapshot (cognitive 22) Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:73 — CodexWorkspaceUsageSidecar.loadLatestSnapshot 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 · CostUsageTokenSnapshot.quotaWindowCoverage (cognitive 22) · ×1
  • CostUsageTokenSnapshot.quotaWindowCoverage (cognitive 22) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:523 — CostUsageTokenSnapshot.quotaWindowCoverage has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (9 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.
D2 · Cognitive Complexity · KeychainAccessPreflight.evaluateDecryptACL (cognitive 22) · ×1
  • KeychainAccessPreflight.evaluateDecryptACL (cognitive 22) Sources/CodexBarCore/KeychainAccessPreflight.swift:347 — KeychainAccessPreflight.evaluateDecryptACL has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 6, match/switch 1 (2 pts), 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 · WidgetExtensionRecovery.launch (cognitive 22) · ×1
  • WidgetExtensionRecovery.launch (cognitive 22) Sources/CodexBarCore/WidgetExtensionRecovery.swift:40 — WidgetExtensionRecovery.launch has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 17, 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 · ProviderPluginPersistentCookies.next (cognitive 22) · ×1
  • ProviderPluginPersistentCookies.next (cognitive 22) Sources/CodexBarCore/Plugins/ProviderPluginPersistentCookies.swift:41 — ProviderPluginPersistentCookies.next has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, ternaries 1 (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 · ProviderFetchPipeline.fetch (cognitive 22) · ×1
  • ProviderFetchPipeline.fetch (cognitive 22) Sources/CodexBarCore/Providers/ProviderFetchPlan.swift:396 — ProviderFetchPipeline.fetch has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, error handling 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AlibabaTokenPlanUsageFetcher.throwIfErrorPayload (cognitive 22) · ×1
  • AlibabaTokenPlanUsageFetcher.throwIfErrorPayload (cognitive 22) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:743 — AlibabaTokenPlanUsageFetcher.throwIfErrorPayload has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5 (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 · AntigravityCLISession.finishProbe (cognitive 22) · ×1
  • AntigravityCLISession.finishProbe (cognitive 22) Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:306 — AntigravityCLISession.finishProbe has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 8 (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 · AugmentSessionKeepalive.attemptSessionRecovery (cognitive 22) · ×1
  • AugmentSessionKeepalive.attemptSessionRecovery (cognitive 22) Sources/CodexBarCore/Providers/Augment/AugmentSessionKeepalive.swift:342 — AugmentSessionKeepalive.attemptSessionRecovery has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 12). 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 · ClaudeOAuthFetchStrategy.isPlausiblyAvailable (cognitive 22) · ×1
  • ClaudeOAuthFetchStrategy.isPlausiblyAvailable (cognitive 22) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:656 — ClaudeOAuthFetchStrategy.isPlausiblyAvailable has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, 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 · ClaudeStatusProbe.extractScopedWeeklyUsages (cognitive 22) · ×1
  • ClaudeStatusProbe.extractScopedWeeklyUsages (cognitive 22) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:472 — ClaudeStatusProbe.extractScopedWeeklyUsages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DevinUsageParser.percent (cognitive 22) · ×1
  • DevinUsageParser.percent (cognitive 22) Sources/CodexBarCore/Providers/Devin/DevinUsageSnapshot.swift:204 — DevinUsageParser.percent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (8 pts), boolean chains 4, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiStatusProbe.fetchViaAPI (cognitive 22) · ×1
  • GeminiStatusProbe.fetchViaAPI (cognitive 22) Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:268 — GeminiStatusProbe.fetchViaAPI has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · GrokWebFetchStrategy.fetchLegacyWebBilling (cognitive 22) · ×1
  • GrokWebFetchStrategy.fetchLegacyWebBilling (cognitive 22) Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift:577 — GrokWebFetchStrategy.fetchLegacyWebBilling has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 3 (6 pts), boolean chains 4 (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 · KiloUsageFetcher.parseOrganizations (cognitive 22) · ×1
  • KiloUsageFetcher.parseOrganizations (cognitive 22) Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:358 — KiloUsageFetcher.parseOrganizations has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeOAuthRefreshFailureGate.shouldAttempt (cognitive 22) · ×1
  • ClaudeOAuthRefreshFailureGate.shouldAttempt (cognitive 22) REDACTED:141 — ClaudeOAuthRefreshFailureGate.shouldAttempt has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 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 · ci_swiftpm_cache.read_metadata (cognitive 22) · ×1
  • ci_swiftpm_cache.read_metadata (cognitive 22) Scripts/ci_swiftpm_cache.py:213 — ci_swiftpm_cache.read_metadata has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, 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 · Model.visibleProviderDetails (cognitive 21) · ×1
  • Model.visibleProviderDetails (cognitive 21) Sources/CodexBar/MenuCardView+ProviderDetailVisibility.swift:5 — Model.visibleProviderDetails has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, 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 · PlanUtilizationHistoryChartMenuView.updateSelection (cognitive 21) · ×1
  • PlanUtilizationHistoryChartMenuView.updateSelection (cognitive 21) Sources/CodexBar/PlanUtilizationHistoryChartMenuView.swift:785 — PlanUtilizationHistoryChartMenuView.updateSelection has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 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 · SessionEquivalentForecast.make (cognitive 21) · ×1
  • SessionEquivalentForecast.make (cognitive 21) Sources/CodexBar/SessionEquivalentForecast.swift:40 — SessionEquivalentForecast.make has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SpendDashboardModel.hasConsistentCostHistory (cognitive 21) · ×1
  • SpendDashboardModel.hasConsistentCostHistory (cognitive 21) Sources/CodexBar/SpendDashboardModel.swift:1000 — SpendDashboardModel.hasConsistentCostHistory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5, 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 · SpendDashboardModel.hourlyPoints (cognitive 21) · ×1
  • SpendDashboardModel.hourlyPoints (cognitive 21) Sources/CodexBar/SpendDashboardModel.swift:1583 — SpendDashboardModel.hourlyPoints has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpendTrendChart.chart (cognitive 21) · ×1
  • SpendTrendChart.chart (cognitive 21) Sources/CodexBar/SpendDashboardTrendPanel.swift:272 — SpendTrendChart.chart has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (12 pts), ternaries 5 (7 pts), boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SpendToolOperationRow.body (cognitive 21) · ×1
  • SpendToolOperationRow.body (cognitive 21) Sources/CodexBar/SpendSessionToolActivityView.swift:225 — SpendToolOperationRow.body has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 3 (5 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 · StatusItemController.scheduleMenuBarCountdownRefreshIfNeeded (cognitive 21) · ×1
  • StatusItemController.scheduleMenuBarCountdownRefreshIfNeeded (cognitive 21) Sources/CodexBar/StatusItemController+CountdownRefresh.swift:7 — StatusItemController.scheduleMenuBarCountdownRefreshIfNeeded has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, match/switch 1 (2 pts), error handling 1, 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 · StatusItemController.addMenuCardSections (cognitive 21) · ×1
  • StatusItemController.addMenuCardSections (cognitive 21) Sources/CodexBar/StatusItemController+Menu.swift:1290 — StatusItemController.addMenuCardSections has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, ternaries 3 (5 pts) (nesting depth added 3). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · UsageStore.postLimitResetCelebrationIfNeeded (cognitive 21) · ×1
  • UsageStore.postLimitResetCelebrationIfNeeded (cognitive 21) Sources/CodexBar/UsageStore+LimitResetCelebration.swift:174 — UsageStore.postLimitResetCelebrationIfNeeded has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, match/switch 2 (3 pts), 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 · UsageStore.refreshTokenAccounts (cognitive 21) · ×1
  • UsageStore.refreshTokenAccounts (cognitive 21) Sources/CodexBar/UsageStore+TokenAccounts.swift:513 — UsageStore.refreshTokenAccounts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 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 · UsageStore.debugLog (cognitive 21) · ×1
  • UsageStore.debugLog (cognitive 21) Sources/CodexBar/UsageStore.swift:1043 — UsageStore.debugLog has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (12 pts), if/else 6 (7 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 · CodexBarCLI.runCodexHostCosts (cognitive 21) · ×1
  • CodexBarCLI.runCodexHostCosts (cognitive 21) Sources/CodexBarCLI/CLICodexHostCosts.swift:6 — CodexBarCLI.runCodexHostCosts has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), error handling 2 (3 pts), ternaries 2 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodexBarCLI.renderCostText (cognitive 21) · ×1
  • CodexBarCLI.renderCostText (cognitive 21) Sources/CodexBarCLI/CLICostCommand.swift:191 — CodexBarCLI.renderCostText has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 9, if/else 6, 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 · CodexBarCLI.collectAccountUsage (cognitive 21) · ×1
  • CodexBarCLI.collectAccountUsage (cognitive 21) Sources/CodexBarCLI/DashboardAccountCollector.swift:97 — CodexBarCLI.collectAccountUsage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 2 (4 pts), ternaries 1 (4 pts), error handling 1 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CostUsageFetcher.codexScanProgressKey (cognitive 21) · ×1
  • CostUsageFetcher.codexScanProgressKey (cognitive 21) Sources/CodexBarCore/CostUsageFetcher.swift:1989 — CostUsageFetcher.codexScanProgressKey has cognitive complexity 21 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 8 (10 pts) (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · CostUsageTokenSnapshot.quotaHourlyResidualSlices (cognitive 21) · ×1
  • CostUsageTokenSnapshot.quotaHourlyResidualSlices (cognitive 21) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:429 — CostUsageTokenSnapshot.quotaHourlyResidualSlices has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 8, loops 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 · SessionToolActivityParser.operation (cognitive 21) · ×1
  • SessionToolActivityParser.operation (cognitive 21) Sources/CodexBarCore/SessionToolActivityParser.swift:13 — SessionToolActivityParser.operation has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 15, ternaries 3, if/else 2, match/switch 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 · SessionWindowFocuser.application (cognitive 21) · ×1
  • SessionWindowFocuser.application (cognitive 21) Sources/CodexBarCore/SessionWindowFocuser.swift:47 — SessionWindowFocuser.application has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageLimitsAvailability.resolve (cognitive 21) · ×1
  • UsageLimitsAvailability.resolve (cognitive 21) Sources/CodexBarCore/UsageFetcher.swift:718 — UsageLimitsAvailability.resolve has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (7 pts), boolean chains 6 (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 · OpenAIDashboardParser.parseResetDate (cognitive 21) · ×1
  • OpenAIDashboardParser.parseResetDate (cognitive 21) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:358 — OpenAIDashboardParser.parseResetDate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 2, 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 · ProcessPipeCapture.handleLinuxReadableData (cognitive 21) · ×1
  • ProcessPipeCapture.handleLinuxReadableData (cognitive 21) Sources/CodexBarCore/Host/Process/ProcessPipeCapture.swift:216 — ProcessPipeCapture.handleLinuxReadableData has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeProviderDescriptor.makeDescriptor (cognitive 21) · ×1
  • ClaudeProviderDescriptor.makeDescriptor (cognitive 21) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:88 — ClaudeProviderDescriptor.makeDescriptor has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11, boolean chains 6, match/switch 1 (2 pts), ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · OAuthExecutor.load (cognitive 21) · ×1
  • OAuthExecutor.load (cognitive 21) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:269 — OAuthExecutor.load has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), error handling 6, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MistralSubscriptionBudgetParser.jsonContainerEnd (cognitive 21) · ×1
  • MistralSubscriptionBudgetParser.jsonContainerEnd (cognitive 21) Sources/CodexBarCore/Providers/Mistral/MistralSubscriptionBudgetParser.swift:148 — MistralSubscriptionBudgetParser.jsonContainerEnd has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (17 pts), match/switch 1 (3 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 · OpenCodeGoZenBalanceParser.findRawBillingBalance (cognitive 21) · ×1
  • OpenCodeGoZenBalanceParser.findRawBillingBalance (cognitive 21) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoZenBalanceParser.swift:94 — OpenCodeGoZenBalanceParser.findRawBillingBalance has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QoderCookieRouting.shellTokens (cognitive 21) · ×1
  • QoderCookieRouting.shellTokens (cognitive 21) Sources/CodexBarCore/Providers/Qoder/QoderCookieRouting.swift:566 — QoderCookieRouting.shellTokens has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (19 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 · VertexAITokenRefresher.refresh (cognitive 21) · ×1
  • VertexAITokenRefresher.refresh (cognitive 21) Sources/CodexBarCore/Providers/VertexAI/VertexAIOAuth/VertexAITokenRefresher.swift:33 — VertexAITokenRefresher.refresh has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 1 (4 pts), boolean chains 2, 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 · Model.hasCompatibleTrackedLayout (cognitive 20) · ×1
  • Model.hasCompatibleTrackedLayout (cognitive 20) Sources/CodexBar/MenuCardView+ModelHelpers.swift:426 — Model.hasCompatibleTrackedLayout has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 18, 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 · UsageMenuCardUsageContentView.body (cognitive 20) · ×1
  • UsageMenuCardUsageContentView.body (cognitive 20) Sources/CodexBar/MenuCardView.swift:655 — UsageMenuCardUsageContentView.body has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 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 · SpendDashboardController.publishCurrentState (cognitive 20) · ×1
  • SpendDashboardController.publishCurrentState (cognitive 20) Sources/CodexBar/SpendDashboardController.swift:1731 — SpendDashboardController.publishCurrentState has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), match/switch 2 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SpendDashboardPublication.coverageSources (cognitive 20) · ×1
  • SpendDashboardPublication.coverageSources (cognitive 20) Sources/CodexBar/SpendDashboardPublication.swift:153 — SpendDashboardPublication.coverageSources has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 14, 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 · ProviderSwitcherView.applyLayout (cognitive 20) · ×1
  • ProviderSwitcherView.applyLayout (cognitive 20) Sources/CodexBar/StatusItemController+SwitcherViews.swift:355 — ProviderSwitcherView.applyLayout has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (9 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KiloProviderImplementation.settingsOrganizations (cognitive 20) · ×1
  • KiloProviderImplementation.settingsOrganizations (cognitive 20) Sources/CodexBar/Providers/Kilo/KiloProviderImplementation.swift:91 — KiloProviderImplementation.settingsOrganizations has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, error handling 4, loops 1, match/switch 1 (nesting depth added 3). Of this number, 16 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 · OpenAILiveUsageModel.refresh (cognitive 20) · ×1
  • OpenAILiveUsageModel.refresh (cognitive 20) Sources/CodexBar/Providers/OpenAI/OpenAILiveUsageModel.swift:121 — OpenAILiveUsageModel.refresh has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 5, error handling 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 · CodexBarCLI.runConfigPreferences (cognitive 20) · ×1
  • CodexBarCLI.runConfigPreferences (cognitive 20) Sources/CodexBarCLI/CLIConfigPreferences.swift:21 — CodexBarCLI.runConfigPreferences has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (19 pts), 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 · CLILocalHTTPRequest.parse (cognitive 20) · ×1
  • CLILocalHTTPRequest.parse (cognitive 20) Sources/CodexBarCLI/CLILocalHTTPServer.swift:39 — CLILocalHTTPRequest.parse has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (4 pts), boolean chains 1, loops 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 · BrowserCookieAccessGate.shouldAttemptWithPolicy (cognitive 20) · ×1
  • BrowserCookieAccessGate.shouldAttemptWithPolicy (cognitive 20) Sources/CodexBarCore/BrowserCookieAccessGate.swift:108 — BrowserCookieAccessGate.shouldAttemptWithPolicy has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (20 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 · ShellCommandLocator.runShellCommand (cognitive 20) · ×1
  • ShellCommandLocator.runShellCommand (cognitive 20) Sources/CodexBarCore/PathEnvironment.swift:889 — ShellCommandLocator.runShellCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 5, boolean chains 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.
D2 · Cognitive Complexity · PiSessionCostScanner.scanPiSessionFile (cognitive 20) · ×1
  • PiSessionCostScanner.scanPiSessionFile (cognitive 20) Sources/CodexBarCore/PiSessionCostScanner.swift:745 — PiSessionCostScanner.scanPiSessionFile has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, 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 · TailscaleStatusParser.parseHosts (cognitive 20) · ×1
  • TailscaleStatusParser.parseHosts (cognitive 20) Sources/CodexBarCore/RemoteSessionFetcher.swift:29 — TailscaleStatusParser.parseHosts has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SubprocessRunner.run (cognitive 20) · ×1
  • SubprocessRunner.run (cognitive 20) Sources/CodexBarCore/Host/Process/SubprocessRunner.swift:133 — SubprocessRunner.run has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, ternaries 3, error handling 2 (nesting depth added 4). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AlibabaTokenPlanWebFetchStrategy.resolveCookieHeaders (cognitive 20) · ×1
  • AlibabaTokenPlanWebFetchStrategy.resolveCookieHeaders (cognitive 20) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:230 — AlibabaTokenPlanWebFetchStrategy.resolveCookieHeaders has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 5 (7 pts), boolean chains 4, error handling 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 · AmpUsageParser.extractObject (cognitive 20) · ×1
  • AmpUsageParser.extractObject (cognitive 20) Sources/CodexBarCore/Providers/Amp/AmpUsageParser.swift:227 — AmpUsageParser.extractObject has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 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 · AugmentStatusProbe.fetch (cognitive 20) · ×1
  • AugmentStatusProbe.fetch (cognitive 20) Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift:360 — AugmentStatusProbe.fetch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (9 pts), error handling 4 (7 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 7). 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 · BedrockCloudWatchUsageFetcher.parsePage (cognitive 20) · ×1
  • BedrockCloudWatchUsageFetcher.parsePage (cognitive 20) Sources/CodexBarCore/Providers/Bedrock/BedrockCloudWatchUsage.swift:196 — BedrockCloudWatchUsageFetcher.parsePage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeCLIScreen.applyCSI (cognitive 20) · ×1
  • ClaudeCLIScreen.applyCSI (cognitive 20) Sources/CodexBarCore/Providers/Claude/ClaudeCLIScreen.swift:86 — ClaudeCLIScreen.applyCSI has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 5 (9 pts), boolean chains 4, if/else 4, loops 1 (2 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 · ClaudeDesktopProjectsLocator.roots (cognitive 20) · ×1
  • ClaudeDesktopProjectsLocator.roots (cognitive 20) Sources/CodexBarCore/Providers/Claude/ClaudeDesktopProjectsLocator.swift:32 — ClaudeDesktopProjectsLocator.roots has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexCLIBackendConfiguration.init (cognitive 20) · ×1
  • CodexCLIBackendConfiguration.init (cognitive 20) Sources/CodexBarCore/Providers/Codex/CodexCLIBackendConfiguration.swift:61 — CodexCLIBackendConfiguration.init has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3, match/switch 1 (2 pts), 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 · CopilotBudgetWebFetcher.fetchBudgetWindows (cognitive 20) · ×1
  • CopilotBudgetWebFetcher.fetchBudgetWindows (cognitive 20) Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:354 — CopilotBudgetWebFetcher.fetchBudgetWindows has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), error handling 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CopilotBudgetWebFetcher.extractMetaContent (cognitive 20) · ×1
  • CopilotBudgetWebFetcher.extractMetaContent (cognitive 20) Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:562 — CopilotBudgetWebFetcher.extractMetaContent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 6, loops 3 (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 · CursorStatusProbe.fetchBrowserLoginCandidates (cognitive 20) · ×1
  • CursorStatusProbe.fetchBrowserLoginCandidates (cognitive 20) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:929 — CursorStatusProbe.fetchBrowserLoginCandidates has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (4 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CursorStatusProbe.fetchTeamSpend (cognitive 20) · ×1
  • CursorStatusProbe.fetchTeamSpend (cognitive 20) Sources/CodexBarCore/Providers/Cursor/CursorTeamSpend.swift:65 — CursorStatusProbe.fetchTeamSpend has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 8, loops 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 · DeepSeekUsageCostParser.decodeByAPIKeyPayloads (cognitive 20) · ×1
  • DeepSeekUsageCostParser.decodeByAPIKeyPayloads (cognitive 20) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:923 — DeepSeekUsageCostParser.decodeByAPIKeyPayloads has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, error handling 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DoubaoUsageFetcher.apiErrorSummary (cognitive 20) · ×1
  • DoubaoUsageFetcher.apiErrorSummary (cognitive 20) Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:839 — DoubaoUsageFetcher.apiErrorSummary has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, ternaries 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FactoryStatusProbe.attemptWorkOSCookies (cognitive 20) · ×1
  • FactoryStatusProbe.attemptWorkOSCookies (cognitive 20) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:850 — FactoryStatusProbe.attemptWorkOSCookies has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (10 pts), error handling 2 (6 pts), loops 2 (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 · MiMoFirefoxSessionCookieImporter.decodeLZ4Block (cognitive 20) · ×1
  • MiMoFirefoxSessionCookieImporter.decodeLZ4Block (cognitive 20) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:592 — MiMoFirefoxSessionCookieImporter.decodeLZ4Block has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · QwenCloudWebFetchStrategy.resolveCookieHeaders (cognitive 20) · ×1
  • QwenCloudWebFetchStrategy.resolveCookieHeaders (cognitive 20) Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:157 — QwenCloudWebFetchStrategy.resolveCookieHeaders has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 5 (7 pts), boolean chains 4, error handling 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 · Repository.hasCachedCredentials (cognitive 20) · ×1
  • Repository.hasCachedCredentials (cognitive 20) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:900 — Repository.hasCachedCredentials has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), match/switch 2 (nesting depth added 2). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a 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 · ClaudeSwapAccountProjection.usageSnapshot (cognitive 20) · ×1
  • ClaudeSwapAccountProjection.usageSnapshot (cognitive 20) Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountProjection.swift:154 — ClaudeSwapAccountProjection.usageSnapshot has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), ternaries 1 (3 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · VertexAIUsageFetcher.fetchTimeSeries (cognitive 20) · ×1
  • VertexAIUsageFetcher.fetchTimeSeries (cognitive 20) Sources/CodexBarCore/Providers/VertexAI/VertexAIOAuth/VertexAIUsageFetcher.swift:214 — VertexAIUsageFetcher.fetchTimeSeries has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, error handling 1 (2 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · localization-formats.printfSignature (cognitive 20) · ×1
  • localization-formats.printfSignature (cognitive 20) Scripts/localization-formats.mjs:12 — localization-formats.printfSignature has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 6). Of this number, 13 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · social-card.imageDimensions (cognitive 20) · ×1
  • social-card.imageDimensions (cognitive 20) REDACTED:30 — social-card.imageDimensions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, loops 2, 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 · Model.applyingUsageItemVisibility (cognitive 19) · ×1
  • Model.applyingUsageItemVisibility (cognitive 19) Sources/CodexBar/ProviderUsageItemVisibility.swift:188 — Model.applyingUsageItemVisibility has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · MetricRow.body (cognitive 19) · ×1
  • MetricRow.body (cognitive 19) Sources/CodexBar/MenuCardMetricRow.swift:12 — MetricRow.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (8 pts), ternaries 6 (8 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MenuDescriptor.build (cognitive 19) · ×1
  • MenuDescriptor.build (cognitive 19) Sources/CodexBar/MenuDescriptor.swift:91 — MenuDescriptor.build has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, 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 · SpendDashboardPane.codexCostCatchUpPanel (cognitive 19) · ×1
  • SpendDashboardPane.codexCostCatchUpPanel (cognitive 19) Sources/CodexBar/PreferencesSpendDashboardPane.swift:276 — SpendDashboardPane.codexCostCatchUpPanel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 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 · SpendDashboardModel.hasRetainablePartialCodexModelCostCoverage (cognitive 19) · ×1
  • SpendDashboardModel.hasRetainablePartialCodexModelCostCoverage (cognitive 19) Sources/CodexBar/SpendDashboardModel+ModelBreakdown.swift:207 — SpendDashboardModel.hasRetainablePartialCodexModelCostCoverage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StatusItemController.scheduleDeferredMenuInteractionRefreshIfNeeded (cognitive 19) · ×1
  • StatusItemController.scheduleDeferredMenuInteractionRefreshIfNeeded (cognitive 19) Sources/CodexBar/StatusItemController+MenuInteractionRefresh.swift:112 — StatusItemController.scheduleDeferredMenuInteractionRefreshIfNeeded has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 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.
D2 · Cognitive Complexity · StatusItemController.scheduleManualRefreshViewportRestore (cognitive 19) · ×1
  • StatusItemController.scheduleManualRefreshViewportRestore (cognitive 19) Sources/CodexBar/StatusItemController+MenuViewportRestore.swift:510 — StatusItemController.scheduleManualRefreshViewportRestore has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (12 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 · StatusItemController.handleOverviewScrollWheel (cognitive 19) · ×1
  • StatusItemController.handleOverviewScrollWheel (cognitive 19) Sources/CodexBar/StatusItemController+OverviewScroll.swift:17 — StatusItemController.handleOverviewScrollWheel has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 2 (4 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.widgetUsageRows (cognitive 19) · ×1
  • UsageStore.widgetUsageRows (cognitive 19) Sources/CodexBar/UsageStore+WidgetSnapshot.swift:445 — UsageStore.widgetUsageRows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3, ternaries 2 (3 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 · UsageStore.resolvedCodexRefreshOutcome (cognitive 19) · ×1
  • UsageStore.resolvedCodexRefreshOutcome (cognitive 19) Sources/CodexBar/Providers/Codex/UsageStore+CodexPATRefresh.swift:46 — UsageStore.resolvedCodexRefreshOutcome has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 9 (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 · CodexConsumerProjection.make (cognitive 19) · ×1
  • CodexConsumerProjection.make (cognitive 19) Sources/CodexBar/Providers/Codex/CodexConsumerProjection.swift:275 — CodexConsumerProjection.make has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, ternaries 6, if/else 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodexWeeklyResetConfirmation.resetCreditEvidence (cognitive 19) · ×1
  • CodexWeeklyResetConfirmation.resetCreditEvidence (cognitive 19) Sources/CodexBar/Providers/Codex/CodexWeeklyResetConfirmation.swift:460 — CodexWeeklyResetConfirmation.resetCreditEvidence has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, if/else 3, ternaries 2 (3 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 · OpenAIAPIProviderImplementation.throughputPresentation (cognitive 19) · ×1
  • OpenAIAPIProviderImplementation.throughputPresentation (cognitive 19) Sources/CodexBar/Providers/OpenAI/OpenAIAPIProviderImplementation.swift:75 — OpenAIAPIProviderImplementation.throughputPresentation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 2, ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CLILocalHTTPRequest.isAllowedHost (cognitive 19) · ×1
  • CLILocalHTTPRequest.isAllowedHost (cognitive 19) Sources/CodexBarCLI/CLILocalHTTPServer.swift:117 — CLILocalHTTPRequest.isAllowedHost has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), match/switch 3 (5 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 · CLIServeResponseCache.mergeLastGoodCostItems (cognitive 19) · ×1
  • CLIServeResponseCache.mergeLastGoodCostItems (cognitive 19) Sources/CodexBarCLI/CLIServeCommand.swift:487 — CLIServeResponseCache.mergeLastGoodCostItems has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6, loops 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 · TokenAccountCLIContext.resolvedAccounts (cognitive 19) · ×1
  • TokenAccountCLIContext.resolvedAccounts (cognitive 19) Sources/CodexBarCLI/TokenAccountCLI.swift:89 — TokenAccountCLIContext.resolvedAccounts has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 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 · AgentSessionNameFormatter.agentPath (cognitive 19) · ×1
  • AgentSessionNameFormatter.agentPath (cognitive 19) Sources/CodexBarCore/AgentSession.swift:690 — AgentSessionNameFormatter.agentPath has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 7, 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 · CodexModelsAnalyticsBuilder.parityMismatches (cognitive 19) · ×1
  • CodexModelsAnalyticsBuilder.parityMismatches (cognitive 19) Sources/CodexBarCore/CodexModelsAnalyticsModels.swift:708 — CodexModelsAnalyticsBuilder.parityMismatches has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 8, ternaries 2, loops 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 · CodexThreadMetadataReader.projectMetadata (cognitive 19) · ×1
  • CodexThreadMetadataReader.projectMetadata (cognitive 19) Sources/CodexBarCore/CodexThreadMetadataReader+Projects.swift:12 — CodexThreadMetadataReader.projectMetadata has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, 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 · PiFamilySessionScanner.ompSessionRootResolution (cognitive 19) · ×1
  • PiFamilySessionScanner.ompSessionRootResolution (cognitive 19) Sources/CodexBarCore/PiFamilySessionScanner.swift:853 — PiFamilySessionScanner.ompSessionRootResolution has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7, loops 2 (3 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 · ProviderStorageScanner.scanDirectory (cognitive 19) · ×1
  • ProviderStorageScanner.scanDirectory (cognitive 19) Sources/CodexBarCore/ProviderStorageFootprint.swift:444 — ProviderStorageScanner.scanDirectory has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 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 · SessionToolJSONProjection.punctuation (cognitive 19) · ×1
  • SessionToolJSONProjection.punctuation (cognitive 19) Sources/CodexBarCore/SessionToolJSONProjection.swift:117 — SessionToolJSONProjection.punctuation has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, 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 · ProviderPluginIconSVG.hasBoundedCanvas (cognitive 19) · ×1
  • ProviderPluginIconSVG.hasBoundedCanvas (cognitive 19) Sources/CodexBarCore/Plugins/ProviderPluginIconSVG.swift:43 — ProviderPluginIconSVG.hasBoundedCanvas has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (6 pts), ternaries 1 (2 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 · JavaScriptCoreProviderPluginEngine.makeCookieBlock (cognitive 19) · ×1
  • JavaScriptCoreProviderPluginEngine.makeCookieBlock (cognitive 19) Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift:952 — JavaScriptCoreProviderPluginEngine.makeCookieBlock has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 2 (4 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, 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 · ClaudeCLIFetchStrategy.fetch (cognitive 19) · ×1
  • ClaudeCLIFetchStrategy.fetch (cognitive 19) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:1119 — ClaudeCLIFetchStrategy.fetch has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (9 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 · ClaudeUsageFetcher.applyWebExtrasIfNeeded (cognitive 19) · ×1
  • ClaudeUsageFetcher.applyWebExtrasIfNeeded (cognitive 19) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:1251 — ClaudeUsageFetcher.applyWebExtrasIfNeeded has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 1 (2 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StepExecutor.loadViaCLI (cognitive 19) · ×1
  • StepExecutor.loadViaCLI (cognitive 19) Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:603 — StepExecutor.loadViaCLI has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 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 · CodexDisplacedLivePreservationExecutor.refreshExistingManagedAccount (cognitive 19) · ×1
  • CodexDisplacedLivePreservationExecutor.refreshExistingManagedAccount (cognitive 19) Sources/CodexBarCore/Providers/Codex/CodexAccountPromotionExecution.swift:203 — CodexDisplacedLivePreservationExecutor.refreshExistingManagedAccount has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 3 (4 pts), ternaries 1 (2 pts), 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 · CodexVisibleAccountProjection.make (cognitive 19) · ×1
  • CodexVisibleAccountProjection.make (cognitive 19) Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift:152 — CodexVisibleAccountProjection.make has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, match/switch 2 (3 pts), loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DeepSeekUsageCostParser.parse (cognitive 19) · ×1
  • DeepSeekUsageCostParser.parse (cognitive 19) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:296 — DeepSeekUsageCostParser.parse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4, error handling 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DoubaoUsageFetcher.fetchCodingPlanUsage (cognitive 19) · ×1
  • DoubaoUsageFetcher.fetchCodingPlanUsage (cognitive 19) Sources/CodexBarCore/Providers/Doubao/DoubaoUsageFetcher.swift:302 — DoubaoUsageFetcher.fetchCodingPlanUsage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5, error handling 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, 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 · MiMoWebFetchStrategy.fetchFromWeb (cognitive 19) · ×1
  • MiMoWebFetchStrategy.fetchFromWeb (cognitive 19) Sources/CodexBarCore/Providers/MiMo/MiMoProviderDescriptor.swift:112 — MiMoWebFetchStrategy.fetchFromWeb has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), error handling 2 (4 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 · MiniMaxCodingPlanFetchStrategy.fetch (cognitive 19) · ×1
  • MiniMaxCodingPlanFetchStrategy.fetch (cognitive 19) Sources/CodexBarCore/Providers/MiniMax/MiniMaxProviderDescriptor.swift:219 — MiniMaxCodingPlanFetchStrategy.fetch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 2 (4 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 · MiniMaxUsageFetcher.fetchUsageOnce (cognitive 19) · ×1
  • MiniMaxUsageFetcher.fetchUsageOnce (cognitive 19) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift:137 — MiniMaxUsageFetcher.fetchUsageOnce has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 2, error handling 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OllamaUsageFetcher.fetchUsingCookieCandidates (cognitive 19) · ×1
  • OllamaUsageFetcher.fetchUsingCookieCandidates (cognitive 19) Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:465 — OllamaUsageFetcher.fetchUsingCookieCandidates has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), error handling 4 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ReplicateWebFetchStrategy.fetch (cognitive 19) · ×1
  • ReplicateWebFetchStrategy.fetch (cognitive 19) Sources/CodexBarCore/Providers/Replicate/ReplicateWebFetchStrategy.swift:51 — ReplicateWebFetchStrategy.fetch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 2, error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeOAuthCredentialsStore.loadFromClaudeKeychainUsingSecurityFramework (cognitive 19) · ×1
  • ClaudeOAuthCredentialsStore.loadFromClaudeKeychainUsingSecurityFramework (cognitive 19) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:2236 — ClaudeOAuthCredentialsStore.loadFromClaudeKeychainUsingSecurityFramework has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 3, error handling 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 · ClaudeOAuthCredentialsStore.claudeKeychainCandidatesProbeWithoutPrompt (cognitive 19) · ×1
  • ClaudeOAuthCredentialsStore.claudeKeychainCandidatesProbeWithoutPrompt (cognitive 19) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:2309 — ClaudeOAuthCredentialsStore.claudeKeychainCandidatesProbeWithoutPrompt has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 4, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ClaudeWebAPIFetcher.extractSessionKeyInfo (cognitive 19) · ×1
  • ClaudeWebAPIFetcher.extractSessionKeyInfo (cognitive 19) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:531 — ClaudeWebAPIFetcher.extractSessionKeyInfo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts), error handling 1 (2 pts), ternaries 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeWebAPIFetcher.extractNotableFields (cognitive 19) · ×1
  • ClaudeWebAPIFetcher.extractNotableFields (cognitive 19) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:1003 — ClaudeWebAPIFetcher.extractNotableFields has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (5 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 7). Most of this is not in the body itself: 1 of the 19 points is its own statement and the rest belongs to 2 function items inside it that branch (walk, appendValue). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · OllamaUsageFetcher.swift.normalizedOllamaTokenAccountHeader (cognitive 19) · ×1
  • OllamaUsageFetcher.swift.normalizedOllamaTokenAccountHeader (cognitive 19) Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:37 — OllamaUsageFetcher.swift.normalizedOllamaTokenAccountHeader has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 1 (2 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 · WidgetUsageRow.rows (cognitive 19) · ×1
  • WidgetUsageRow.rows (cognitive 19) Sources/CodexBarWidget/CodexBarWidgetViews.swift:364 — WidgetUsageRow.rows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (5 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Model.localizedZaiCountdown (cognitive 18) · ×1
  • Model.localizedZaiCountdown (cognitive 18) Sources/CodexBar/MenuCardView+ProviderDetailLocalization.swift:206 — Model.localizedZaiCountdown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShareStatsBuilder.make (cognitive 18) · ×1
  • ShareStatsBuilder.make (cognitive 18) Sources/CodexBar/ShareStatsPayload.swift:216 — ShareStatsBuilder.make has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 2, match/switch 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 · SpendDashboardController.update (cognitive 18) · ×1
  • SpendDashboardController.update (cognitive 18) Sources/CodexBar/SpendDashboardController.swift:1232 — SpendDashboardController.update has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 5, 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 · SpendDashboardModel.tokenActivityInputSummary (cognitive 18) · ×1
  • SpendDashboardModel.tokenActivityInputSummary (cognitive 18) Sources/CodexBar/SpendDashboardModel.swift:1242 — SpendDashboardModel.tokenActivityInputSummary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 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 · StatusItemController.addCompactAccountMenuRows (cognitive 18) · ×1
  • StatusItemController.addCompactAccountMenuRows (cognitive 18) Sources/CodexBar/StatusItemController+CompactAccountMenu.swift:101 — StatusItemController.addCompactAccountMenuRows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 1 (3 pts), match/switch 1 (2 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 · StatusItemController.refreshHostedSubviewMenu (cognitive 18) · ×1
  • StatusItemController.refreshHostedSubviewMenu (cognitive 18) Sources/CodexBar/StatusItemController+HostedSubmenus.swift:163 — StatusItemController.refreshHostedSubviewMenu has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 1, 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 · StatusItemController.switcherWeeklyMetricPercent (cognitive 18) · ×1
  • StatusItemController.switcherWeeklyMetricPercent (cognitive 18) Sources/CodexBar/StatusItemController+SwitcherMetrics.swift:27 — StatusItemController.switcherWeeklyMetricPercent has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 6, ternaries 3 (4 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · UsageBreakdownChartMenuView.makeModel (cognitive 18) · ×1
  • UsageBreakdownChartMenuView.makeModel (cognitive 18) Sources/CodexBar/UsageBreakdownChartMenuView.swift:223 — UsageBreakdownChartMenuView.makeModel has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.openAIDashboardFriendlyError (cognitive 18) · ×1
  • UsageStore.openAIDashboardFriendlyError (cognitive 18) Sources/CodexBar/UsageStore+OpenAIWeb.swift:1539 — UsageStore.openAIDashboardFriendlyError has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · UsageStore.scheduleStorageFootprintRefresh (cognitive 18) · ×1
  • UsageStore.scheduleStorageFootprintRefresh (cognitive 18) Sources/CodexBar/UsageStore+ProviderStorage.swift:86 — UsageStore.scheduleStorageFootprintRefresh has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 8 (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 · UsageStore.loadLatestCodexCredits (cognitive 18) · ×1
  • UsageStore.loadLatestCodexCredits (cognitive 18) Sources/CodexBar/Providers/Codex/UsageStore+CodexRefresh.swift:218 — UsageStore.loadLatestCodexCredits has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 1 (3 pts), error handling 1 (2 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 · UsageStore.codexOutcomeAdmittedForPublication (cognitive 18) · ×1
  • UsageStore.codexOutcomeAdmittedForPublication (cognitive 18) Sources/CodexBar/Providers/Codex/UsageStore+CodexWeeklyResetConfirmation.swift:31 — UsageStore.codexOutcomeAdmittedForPublication has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, match/switch 3 (4 pts), boolean chains 3, ternaries 3 (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 · AntigravityLoginRunner.run (cognitive 18) · ×1
  • AntigravityLoginRunner.run (cognitive 18) Sources/CodexBar/Providers/Antigravity/AntigravityLoginRunner.swift:24 — AntigravityLoginRunner.run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), error handling 4, 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 · CodexBarCLI.runHooksWatch (cognitive 18) · ×1
  • CodexBarCLI.runHooksWatch (cognitive 18) Sources/CodexBarCLI/CLIHooksWatchCommand.swift:14 — CodexBarCLI.runHooksWatch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 3 (6 pts), match/switch 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 · ToonSerializer.looksNumeric (cognitive 18) · ×1
  • ToonSerializer.looksNumeric (cognitive 18) Sources/CodexBarCLI/ToonFormatter.swift:402 — ToonSerializer.looksNumeric has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 1 (nesting depth added 3). Of this number, 16 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexModelsAnalyticsBuilder.modelParityMismatches (cognitive 18) · ×1
  • CodexModelsAnalyticsBuilder.modelParityMismatches (cognitive 18) Sources/CodexBarCore/CodexModelsAnalyticsModels.swift:793 — CodexModelsAnalyticsBuilder.modelParityMismatches has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Entry.coverageCounts (cognitive 18) · ×1
  • Entry.coverageCounts (cognitive 18) Sources/CodexBarCore/CostUsageModels.swift:565 — Entry.coverageCounts has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (7 pts), boolean chains 6, if/else 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.
D2 · Cognitive Complexity · PiFamilySessionScanner.piSessionRootResolution (cognitive 18) · ×1
  • PiFamilySessionScanner.piSessionRootResolution (cognitive 18) Sources/CodexBarCore/PiFamilySessionScanner.swift:957 — PiFamilySessionScanner.piSessionRootResolution has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PiSessionCostScanner.cachedSourceFilesAreCurrent (cognitive 18) · ×1
  • PiSessionCostScanner.cachedSourceFilesAreCurrent (cognitive 18) Sources/CodexBarCore/PiSessionCostScanner.swift:633 — PiSessionCostScanner.cachedSourceFilesAreCurrent has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 6, 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 · PiSessionCostScanner.rebuildDailyUsage (cognitive 18) · ×1
  • PiSessionCostScanner.rebuildDailyUsage (cognitive 18) Sources/CodexBarCore/PiSessionCostScanner.swift:1018 — PiSessionCostScanner.rebuildDailyUsage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProviderStatusFetcher.parseIncidentIOSummary (cognitive 18) · ×1
  • ProviderStatusFetcher.parseIncidentIOSummary (cognitive 18) Sources/CodexBarCore/ProviderStatusFetcher.swift:119 — ProviderStatusFetcher.parseIncidentIOSummary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionToolActivityParser.outcome (cognitive 18) · ×1
  • SessionToolActivityParser.outcome (cognitive 18) Sources/CodexBarCore/SessionToolActivityParser.swift:74 — SessionToolActivityParser.outcome has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (7 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 · OpenAIDashboardBrowserCookieImporter.trySafari (cognitive 18) · ×1
  • OpenAIDashboardBrowserCookieImporter.trySafari (cognitive 18) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:342 — OpenAIDashboardBrowserCookieImporter.trySafari has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 5 (6 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIDashboardBrowserCookieImporter.tryBrowser) 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 · OpenAIDashboardBrowserCookieImporter.tryBrowser (cognitive 18) · ×1
  • OpenAIDashboardBrowserCookieImporter.tryBrowser (cognitive 18) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:407 — OpenAIDashboardBrowserCookieImporter.tryBrowser has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (10 pts), error handling 5 (6 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (OpenAIDashboardBrowserCookieImporter.trySafari) 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 · OpenAIDashboardBrowserCookieImporter.findFirstEmail (cognitive 18) · ×1
  • OpenAIDashboardBrowserCookieImporter.findFirstEmail (cognitive 18) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:724 — OpenAIDashboardBrowserCookieImporter.findFirstEmail has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIDashboardFetcher.findFirstEmail (cognitive 18) · ×1
  • OpenAIDashboardFetcher.findFirstEmail (cognitive 18) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:749 — OpenAIDashboardFetcher.findFirstEmail has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProviderPluginHTTPResponse.fetch (cognitive 18) · ×1
  • ProviderPluginHTTPResponse.fetch (cognitive 18) Sources/CodexBarCore/Plugins/ProviderPluginHTTPResponse.swift:112 — ProviderPluginHTTPResponse.fetch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, match/switch 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 · ProviderPluginSnapshotMapper.mapResult (cognitive 18) · ×1
  • ProviderPluginSnapshotMapper.mapResult (cognitive 18) Sources/CodexBarCore/Plugins/ProviderPluginResult.swift:87 — ProviderPluginSnapshotMapper.mapResult has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AlibabaTokenPlanUsageFetcher.fetchUsage (cognitive 18) · ×1
  • AlibabaTokenPlanUsageFetcher.fetchUsage (cognitive 18) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:102 — AlibabaTokenPlanUsageFetcher.fetchUsage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, ternaries 2, 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 · BedrockUsageFetcher.parseGroupedResults (cognitive 18) · ×1
  • BedrockUsageFetcher.parseGroupedResults (cognitive 18) Sources/CodexBarCore/Providers/Bedrock/BedrockUsageStats.swift:372 — BedrockUsageFetcher.parseGroupedResults has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 6, 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 · ClaudeAdminAPIUsageFetcher.makeSnapshot (cognitive 18) · ×1
  • ClaudeAdminAPIUsageFetcher.makeSnapshot (cognitive 18) Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageFetcher.swift:162 — ClaudeAdminAPIUsageFetcher.makeSnapshot has cognitive complexity 18 (threshold 15). Drivers by points: loops 6 (11 pts), if/else 3 (5 pts), boolean chains 1, ternaries 1 (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · ClaudeStatusProbe.extractUsageError (cognitive 18) · ×1
  • ClaudeStatusProbe.extractUsageError (cognitive 18) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:652 — ClaudeStatusProbe.extractUsageError has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ClaudeStatusProbe.extractUsageErrorJSON (cognitive 18) · ×1
  • ClaudeStatusProbe.extractUsageErrorJSON (cognitive 18) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1333 — ClaudeStatusProbe.extractUsageErrorJSON has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 8, ternaries 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 · CodexRequestLedger.merge (cognitive 18) · ×1
  • CodexRequestLedger.merge (cognitive 18) Sources/CodexBarCore/Providers/Codex/CodexRequestLedger.swift:189 — CodexRequestLedger.merge has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CursorStatusProbe.fetchCachedSession (cognitive 18) · ×1
  • CursorStatusProbe.fetchCachedSession (cognitive 18) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe+SessionResolution.swift:342 — CursorStatusProbe.fetchCachedSession has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, 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 · CursorUsageEventsFetcher.fetchAllEvents (cognitive 18) · ×1
  • CursorUsageEventsFetcher.fetchAllEvents (cognitive 18) Sources/CodexBarCore/Providers/Cursor/CursorUsageEventsFetcher.swift:392 — CursorUsageEventsFetcher.fetchAllEvents has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DevinSessionImporter.findAccessToken (cognitive 18) · ×1
  • DevinSessionImporter.findAccessToken (cognitive 18) Sources/CodexBarCore/Providers/Devin/DevinSessionImporter.swift:243 — DevinSessionImporter.findAccessToken has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DevinUsageParser.findPlanName (cognitive 18) · ×1
  • DevinUsageParser.findPlanName (cognitive 18) Sources/CodexBarCore/Providers/Devin/DevinUsageSnapshot.swift:247 — DevinUsageParser.findPlanName has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FactoryCookieImporter.importSessions (cognitive 18) · ×1
  • FactoryCookieImporter.importSessions (cognitive 18) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:77 — FactoryCookieImporter.importSessions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), ternaries 2 (8 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 · GeminiStatusProbe.extractOAuthCredentialsFromBundle (cognitive 18) · ×1
  • GeminiStatusProbe.extractOAuthCredentialsFromBundle (cognitive 18) Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:672 — GeminiStatusProbe.extractOAuthCredentialsFromBundle has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (4 pts), 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 · MiMoCookieHeader.header (cognitive 18) · ×1
  • MiMoCookieHeader.header (cognitive 18) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:37 — MiMoCookieHeader.header has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 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 · OpenCodeLegacyFallback.fetch (cognitive 18) · ×1
  • OpenCodeLegacyFallback.fetch (cognitive 18) Sources/CodexBarCore/Providers/Shared/OpenCodeLegacyFallback.swift:4 — OpenCodeLegacyFallback.fetch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 6, error handling 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 · TypeSafeWebFetchStrategy.fetch (cognitive 18) · ×1
  • TypeSafeWebFetchStrategy.fetch (cognitive 18) Sources/CodexBarCore/Providers/TypeSafe/TypeSafeWebFetchStrategy.swift:72 — TypeSafeWebFetchStrategy.fetch has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WarpUsageSnapshot.toUsageSnapshot (cognitive 18) · ×1
  • WarpUsageSnapshot.toUsageSnapshot (cognitive 18) Sources/CodexBarCore/Providers/Warp/WarpUsageFetcher.swift:41 — WarpUsageSnapshot.toUsageSnapshot has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · ClaudeWebAPIFetcher.fetchUsageSerialized (cognitive 18) · ×1
  • ClaudeWebAPIFetcher.fetchUsageSerialized (cognitive 18) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:1397 — ClaudeWebAPIFetcher.fetchUsageSerialized has cognitive complexity 18 (threshold 15). Drivers by points: error handling 3 (5 pts), if/else 4 (5 pts), ternaries 1 (4 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AliyunOneConsoleChromiumCookieFallbackImporter.readCookies (cognitive 18) · ×1
  • AliyunOneConsoleChromiumCookieFallbackImporter.readCookies (cognitive 18) Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleChromiumCookieFallbackImporter.swift:98 — AliyunOneConsoleChromiumCookieFallbackImporter.readCookies has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 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 · OneConsoleCookieHeaderBuilder.header (cognitive 18) · ×1
  • OneConsoleCookieHeaderBuilder.header (cognitive 18) Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieHeaders.swift:90 — OneConsoleCookieHeaderBuilder.header has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (16 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 · Usage.laneSegments (cognitive 18) · ×1
  • Usage.laneSegments (cognitive 18) Integrations/Linux/Shared/Usage.js:303 — Usage.laneSegments has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7 (nesting depth added 3). Of this number, 12 points are the body's own statements and 6 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 · fetchUsage (cognitive 18) · ×1
  • fetchUsage (cognitive 18) Sources/CodexBarCore/Resources/Plugins/tinyapi.js:8 — fetchUsage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 3, ternaries 1 (2 pts), error handling 1, 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 · CodexAccountSwitcherView.compactButtonTitle (cognitive 17) · ×1
  • CodexAccountSwitcherView.compactButtonTitle (cognitive 17) Sources/CodexBar/CodexAccountSwitcherView.swift:137 — CodexAccountSwitcherView.compactButtonTitle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, 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 · CostHistoryChartMenuView.makeModel (cognitive 17) · ×1
  • CostHistoryChartMenuView.makeModel (cognitive 17) Sources/CodexBar/CostHistoryChartMenuView.swift:618 — CostHistoryChartMenuView.makeModel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 3 (5 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CreditsHistoryChartMenuView.makeModel (cognitive 17) · ×1
  • CreditsHistoryChartMenuView.makeModel (cognitive 17) Sources/CodexBar/CreditsHistoryChartMenuView.swift:144 — CreditsHistoryChartMenuView.makeModel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 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 · DockIconController.reevaluatePolicy (cognitive 17) · ×1
  • DockIconController.reevaluatePolicy (cognitive 17) Sources/CodexBar/DockIconController.swift:244 — DockIconController.reevaluatePolicy has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 1 (3 pts), boolean chains 1, match/switch 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 · HTTPServerController.restart (cognitive 17) · ×1
  • HTTPServerController.restart (cognitive 17) Sources/CodexBar/HTTPServerController.swift:85 — HTTPServerController.restart has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1 (2 pts), error handling 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 · HistoricalUsageHistoryStore.reconstructWeekCurve (cognitive 17) · ×1
  • HistoricalUsageHistoryStore.reconstructWeekCurve (cognitive 17) Sources/CodexBar/HistoricalUsagePace.swift:455 — HistoricalUsageHistoryStore.reconstructWeekCurve has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 5 (6 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 · MenuDescriptor.actionsSection (cognitive 17) · ×1
  • MenuDescriptor.actionsSection (cognitive 17) Sources/CodexBar/MenuDescriptor.swift:554 — MenuDescriptor.actionsSection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 1 (3 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 · SettingsStore.init (cognitive 17) · ×1
  • SettingsStore.init (cognitive 17) Sources/CodexBar/SettingsStore.swift:308 — SettingsStore.init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 2 (4 pts), boolean chains 3, 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, 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 · SpendDashboardModel.hasRetainableUnpricedModelRows (cognitive 17) · ×1
  • SpendDashboardModel.hasRetainableUnpricedModelRows (cognitive 17) Sources/CodexBar/SpendDashboardModel+ModelBreakdown.swift:180 — SpendDashboardModel.hasRetainableUnpricedModelRows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 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 · SpendDashboardModel.hasCompleteModelTokenCoverage (cognitive 17) · ×1
  • SpendDashboardModel.hasCompleteModelTokenCoverage (cognitive 17) Sources/CodexBar/SpendDashboardModel+ModelBreakdown.swift:291 — SpendDashboardModel.hasCompleteModelTokenCoverage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), 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 · StatusItemController.addStackedCodexMenuCards (cognitive 17) · ×1
  • StatusItemController.addStackedCodexMenuCards (cognitive 17) Sources/CodexBar/StatusItemController+CodexStackedMenu.swift:5 — StatusItemController.addStackedCodexMenuCards has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 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 · StatusItemController.addMenuCards (cognitive 17) · ×1
  • StatusItemController.addMenuCards (cognitive 17) Sources/CodexBar/StatusItemController+Menu.swift:686 — StatusItemController.addMenuCards has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · StatusItemController.harvestRecyclableMenuCardViews (cognitive 17) · ×1
  • StatusItemController.harvestRecyclableMenuCardViews (cognitive 17) Sources/CodexBar/StatusItemController+MenuCardRecycling.swift:14 — StatusItemController.harvestRecyclableMenuCardViews has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 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 · UsageStore.publishAvailableCodexCostCatchUpSnapshot (cognitive 17) · ×1
  • UsageStore.publishAvailableCodexCostCatchUpSnapshot (cognitive 17) Sources/CodexBar/UsageStore+CodexCostCatchUp.swift:237 — UsageStore.publishAvailableCodexCostCatchUpSnapshot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, 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 · UsageStore.weeklyPace (cognitive 17) · ×1
  • UsageStore.weeklyPace (cognitive 17) Sources/CodexBar/UsageStore+HistoricalPace.swift:8 — UsageStore.weeklyPace has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6 (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 · UsageStore.codexAccountEmailForOpenAIDashboard (cognitive 17) · ×1
  • UsageStore.codexAccountEmailForOpenAIDashboard (cognitive 17) Sources/CodexBar/UsageStore+OpenAIWeb.swift:1402 — UsageStore.codexAccountEmailForOpenAIDashboard has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, match/switch 1 (nesting depth added 6). 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 · UsageStore.materializeCodexPlanUtilizationHistoryIfNeeded (cognitive 17) · ×1
  • UsageStore.materializeCodexPlanUtilizationHistoryIfNeeded (cognitive 17) Sources/CodexBar/UsageStore+PlanUtilization.swift:1210 — UsageStore.materializeCodexPlanUtilizationHistoryIfNeeded has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 7, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.checkSpendDashboardCodexCostCatchUpCompletion (cognitive 17) · ×1
  • UsageStore.checkSpendDashboardCodexCostCatchUpCompletion (cognitive 17) Sources/CodexBar/UsageStore+SpendDashboardCodexCostCatchUp.swift:292 — UsageStore.checkSpendDashboardCodexCostCatchUpCompletion has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.codexVisibleAccountMatchesCurrentProjection (cognitive 17) · ×1
  • UsageStore.codexVisibleAccountMatchesCurrentProjection (cognitive 17) Sources/CodexBar/UsageStore+TokenAccounts.swift:452 — UsageStore.codexVisibleAccountMatchesCurrentProjection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4 (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 · UsageStore.fetchTokenAccountOutcomes (cognitive 17) · ×1
  • UsageStore.fetchTokenAccountOutcomes (cognitive 17) Sources/CodexBar/UsageStore+TokenAccounts.swift:685 — UsageStore.fetchTokenAccountOutcomes has cognitive complexity 17 (threshold 15). Drivers by points: loops 4 (9 pts), error handling 1 (4 pts), if/else 2 (4 pts) (nesting depth added 10). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · CLICardsBriefRenderer.styledProviderCell (cognitive 17) · ×1
  • CLICardsBriefRenderer.styledProviderCell (cognitive 17) Sources/CodexBarCLI/CLICardsBriefRenderer.swift:289 — CLICardsBriefRenderer.styledProviderCell has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CLICardsBriefRenderer.dataRow (cognitive 17) · ×1
  • CLICardsBriefRenderer.dataRow (cognitive 17) Sources/CodexBarCLI/CLICardsBriefRenderer.swift:391 — CLICardsBriefRenderer.dataRow 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, 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 · CodexBarCLI.runDiagnose (cognitive 17) · ×1
  • CodexBarCLI.runDiagnose (cognitive 17) Sources/CodexBarCLI/CLIDiagnoseCommand.swift:6 — CodexBarCLI.runDiagnose has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 2, error handling 2, loops 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 · CookieHeaderCache.loadSerialized (cognitive 17) · ×1
  • CookieHeaderCache.loadSerialized (cognitive 17) Sources/CodexBarCore/CookieHeaderCache.swift:415 — CookieHeaderCache.loadSerialized has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 1 (2 pts), 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 · CostUsageFetcher.tokenSnapshot (cognitive 17) · ×1
  • CostUsageFetcher.tokenSnapshot (cognitive 17) Sources/CodexBarCore/CostUsageFetcher.swift:1749 — CostUsageFetcher.tokenSnapshot has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 11, boolean chains 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CostUsageFetcher.codexBreakdownsWithProjectlessMetadata (cognitive 17) · ×1
  • CostUsageFetcher.codexBreakdownsWithProjectlessMetadata (cognitive 17) Sources/CodexBarCore/CostUsageFetcher+Projectless.swift:4 — CostUsageFetcher.codexBreakdownsWithProjectlessMetadata has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 4, ternaries 1 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CostUsageTokenSnapshot.projectQuotaWindow (cognitive 17) · ×1
  • CostUsageTokenSnapshot.projectQuotaWindow (cognitive 17) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:487 — CostUsageTokenSnapshot.projectQuotaWindow has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (8 pts), boolean chains 6, if/else 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 · CodexLaunchPreflight.isLaunchCandidateAllowed (cognitive 17) · ×1
  • CodexLaunchPreflight.isLaunchCandidateAllowed (cognitive 17) Sources/CodexBarCore/PathEnvironment.swift:495 — CodexLaunchPreflight.isLaunchCandidateAllowed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 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, 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 · ShellCommandLocator.parseAliasPath (cognitive 17) · ×1
  • ShellCommandLocator.parseAliasPath (cognitive 17) Sources/CodexBarCore/PathEnvironment.swift:1058 — ShellCommandLocator.parseAliasPath has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (14 pts), boolean chains 2, 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 · ProviderStorageScanner.scan (cognitive 17) · ×1
  • ProviderStorageScanner.scan (cognitive 17) Sources/CodexBarCore/ProviderStorageFootprint.swift:375 — ProviderStorageScanner.scan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 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 · UsageSnapshot.backfillingResetTimes (cognitive 17) · ×1
  • UsageSnapshot.backfillingResetTimes (cognitive 17) Sources/CodexBarCore/UsageFetcher.swift:525 — UsageSnapshot.backfillingResetTimes has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 10, if/else 7. Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (eligibleCachedReset). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · OpenAIDashboardFetcher.fetchWorkspaceRemainingBalanceIfNeeded (cognitive 17) · ×1
  • OpenAIDashboardFetcher.fetchWorkspaceRemainingBalanceIfNeeded (cognitive 17) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:931 — OpenAIDashboardFetcher.fetchWorkspaceRemainingBalanceIfNeeded has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 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 · Request.init (cognitive 17) · ×1
  • Request.init (cognitive 17) Sources/CodexBarCore/Plugins/ProviderPluginHTTPResponse.swift:23 — Request.init has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, 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 · ProviderPluginSnapshotMapper.costUsage (cognitive 17) · ×1
  • ProviderPluginSnapshotMapper.costUsage (cognitive 17) Sources/CodexBarCore/Plugins/ProviderPluginSnapshotMapper.swift:337 — ProviderPluginSnapshotMapper.costUsage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, 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 · ProviderPluginApprovalBinding.init (cognitive 17) · ×1
  • ProviderPluginApprovalBinding.init (cognitive 17) Sources/CodexBarCore/Plugins/UserProviderPlugins.swift:19 — ProviderPluginApprovalBinding.init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 4, match/switch 1 (2 pts), 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 · AntigravityCLISession.reapRecordedSessionsIfNeeded (cognitive 17) · ×1
  • AntigravityCLISession.reapRecordedSessionsIfNeeded (cognitive 17) Sources/CodexBarCore/Providers/Antigravity/AntigravityCLISession.swift:771 — AntigravityCLISession.reapRecordedSessionsIfNeeded 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 · AntigravityCLIHTTPSFetchStrategy.fetchWithReportFallback (cognitive 17) · ×1
  • AntigravityCLIHTTPSFetchStrategy.fetchWithReportFallback (cognitive 17) Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:561 — AntigravityCLIHTTPSFetchStrategy.fetchWithReportFallback has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 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 · AntigravityStatusSnapshot.normalizeModel (cognitive 17) · ×1
  • AntigravityStatusSnapshot.normalizeModel (cognitive 17) Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:528 — AntigravityStatusSnapshot.normalizeModel has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (5 pts), ternaries 1 (2 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 · CodexDisplacedLivePreservationPlanner.makePlan (cognitive 17) · ×1
  • CodexDisplacedLivePreservationPlanner.makePlan (cognitive 17) Sources/CodexBarCore/Providers/Codex/CodexAccountPromotionPlanning.swift:43 — CodexDisplacedLivePreservationPlanner.makePlan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, match/switch 1, 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 · DefaultCodexAccountReconciler.loadSnapshot (cognitive 17) · ×1
  • DefaultCodexAccountReconciler.loadSnapshot (cognitive 17) Sources/CodexBarCore/Providers/Codex/CodexAccountReconciliation.swift:246 — DefaultCodexAccountReconciler.loadSnapshot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 1 (2 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 · CodexStatusProbe.parseResetDate (cognitive 17) · ×1
  • CodexStatusProbe.parseResetDate (cognitive 17) Sources/CodexBarCore/Providers/Codex/CodexStatusProbe.swift:172 — CodexStatusProbe.parseResetDate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 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 · DevinUsageParser.findWindow (cognitive 17) · ×1
  • DevinUsageParser.findWindow (cognitive 17) Sources/CodexBarCore/Providers/Devin/DevinUsageSnapshot.swift:160 — DevinUsageParser.findWindow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeminiStatusProbe.findGeminiPackageRoot (cognitive 17) · ×1
  • GeminiStatusProbe.findGeminiPackageRoot (cognitive 17) Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:590 — GeminiStatusProbe.findGeminiPackageRoot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, 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 · KiloUsageFetcher.dictionaryContexts (cognitive 17) · ×1
  • KiloUsageFetcher.dictionaryContexts (cognitive 17) Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:945 — KiloUsageFetcher.dictionaryContexts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 3 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KiroUsageLimitsAPI.parse (cognitive 17) · ×1
  • KiroUsageLimitsAPI.parse (cognitive 17) Sources/CodexBarCore/Providers/Kiro/KiroUsageLimitsAPI.swift:207 — KiroUsageLimitsAPI.parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 4, ternaries 3, 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 · MiMoFirefoxSessionCookieImporter.hasDefaultOriginAttributes (cognitive 17) · ×1
  • MiMoFirefoxSessionCookieImporter.hasDefaultOriginAttributes (cognitive 17) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:525 — MiMoFirefoxSessionCookieImporter.hasDefaultOriginAttributes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiniMaxUsageFetcher.fetchBillingSummary (cognitive 17) · ×1
  • MiniMaxUsageFetcher.fetchBillingSummary (cognitive 17) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift:404 — MiniMaxUsageFetcher.fetchBillingSummary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, 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 · MiniMaxUsageParser.parseMultiService (cognitive 17) · ×1
  • MiniMaxUsageParser.parseMultiService (cognitive 17) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift:1207 — MiniMaxUsageParser.parseMultiService has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7, 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 · MuseLocalUsageReader.accumulate (cognitive 17) · ×1
  • MuseLocalUsageReader.accumulate (cognitive 17) Sources/CodexBarCore/Providers/Muse/MuseLocalUsageReader.swift:297 — MuseLocalUsageReader.accumulate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 7, 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 · OpenCodeCookieImporter.importSession (cognitive 17) · ×1
  • OpenCodeCookieImporter.importSession (cognitive 17) Sources/CodexBarCore/Providers/OpenCode/OpenCodeCookieImporter.swift:27 — OpenCodeCookieImporter.importSession has cognitive complexity 17 (threshold 15). Drivers by points: if/else 2 (9 pts), loops 2 (4 pts), error handling 1 (2 pts), boolean chains 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 · OpenCodeGoLocalUsageReader.readRows (cognitive 17) · ×1
  • OpenCodeGoLocalUsageReader.readRows (cognitive 17) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoLocalUsageReader.swift:95 — OpenCodeGoLocalUsageReader.readRows has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (7 pts), if/else 5 (6 pts), boolean chains 3, 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 · QoderCookieRouting.curlRequestRoute (cognitive 17) · ×1
  • QoderCookieRouting.curlRequestRoute (cognitive 17) Sources/CodexBarCore/Providers/Qoder/QoderCookieRouting.swift:128 — QoderCookieRouting.curlRequestRoute has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 4, 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 · VeniceCookieHeader.header (cognitive 17) · ×1
  • VeniceCookieHeader.header (cognitive 17) Sources/CodexBarCore/Providers/Venice/VeniceCookieHeader.swift:34 — VeniceCookieHeader.header has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 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 · ClaudeSubscriptionMetadata.parse (cognitive 17) · ×1
  • ClaudeSubscriptionMetadata.parse (cognitive 17) Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeSubscriptionMetadata.swift:24 — ClaudeSubscriptionMetadata.parse has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (7 pts), ternaries 1 (nesting depth added 1). Of this number, 9 points are the body's own statements and 8 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 · CodexOAuthCredentialsStore.integerExpirationClaim (cognitive 17) · ×1
  • CodexOAuthCredentialsStore.integerExpirationClaim (cognitive 17) Sources/CodexBarCore/Providers/Codex/CodexOAuth/CodexOAuthCredentials.swift:530 — CodexOAuthCredentialsStore.integerExpirationClaim has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 6, match/switch 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 · Notifications.transition (cognitive 17) · ×1
  • Notifications.transition (cognitive 17) Integrations/Linux/Shared/Notifications.js:2 — Notifications.transition has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 6 (nesting depth added 3). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 8, 10, 5). 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 · AppDelegate.ensureSingleSettingsApplicationMenuItem (cognitive 16) · ×1
  • AppDelegate.ensureSingleSettingsApplicationMenuItem (cognitive 16) Sources/CodexBar/CodexbarApp.swift:668 — AppDelegate.ensureSingleSettingsApplicationMenuItem has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 2, ternaries 1 (2 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 · Model.bedrockBillingDayKey (cognitive 16) · ×1
  • Model.bedrockBillingDayKey (cognitive 16) Sources/CodexBar/MenuCardView+Costs.swift:429 — Model.bedrockBillingDayKey has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 4, match/switch 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 · Model.rateWindowLabels (cognitive 16) · ×1
  • Model.rateWindowLabels (cognitive 16) Sources/CodexBar/MenuCardView+ModelHelpers.swift:568 — Model.rateWindowLabels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, boolean chains 2, ternaries 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 · Model.make (cognitive 16) · ×1
  • Model.make (cognitive 16) Sources/CodexBar/MenuCardView.swift:880 — Model.make has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 5, ternaries 3 (4 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Model.usageItemDescriptors (cognitive 16) · ×1
  • Model.usageItemDescriptors (cognitive 16) Sources/CodexBar/ProviderUsageItemVisibility.swift:103 — Model.usageItemDescriptors has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 7, 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 · CursorLoginRunner.deduplicatedCandidates (cognitive 16) · ×1
  • CursorLoginRunner.deduplicatedCandidates (cognitive 16) Sources/CodexBar/CursorLoginRunner.swift:371 — CursorLoginRunner.deduplicatedCandidates has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HomebrewUpdateNotifier.postIfNeeded (cognitive 16) · ×1
  • HomebrewUpdateNotifier.postIfNeeded (cognitive 16) Sources/CodexBar/HomebrewUpdateNotifier.swift:48 — HomebrewUpdateNotifier.postIfNeeded 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 · MenuBarLayoutPersistence.preferredLayout (cognitive 16) · ×1
  • MenuBarLayoutPersistence.preferredLayout (cognitive 16) Sources/CodexBar/MenuBarLayout.swift:1064 — MenuBarLayoutPersistence.preferredLayout has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (8 pts), if/else 6 (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 · MenuBarPercentWindowPreference.applied (cognitive 16) · ×1
  • MenuBarPercentWindowPreference.applied (cognitive 16) Sources/CodexBar/MenuBarPercentWindowPreference.swift:158 — MenuBarPercentWindowPreference.applied has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 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 · UsageMenuCardHeaderView.body (cognitive 16) · ×1
  • UsageMenuCardHeaderView.body (cognitive 16) Sources/CodexBar/MenuCardView.swift:348 — UsageMenuCardHeaderView.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (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 · MenuDescriptor.appendProviderUsageSummaries (cognitive 16) · ×1
  • MenuDescriptor.appendProviderUsageSummaries (cognitive 16) Sources/CodexBar/MenuDescriptor.swift:374 — MenuDescriptor.appendProviderUsageSummaries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), loops 2 (5 pts), boolean chains 3, 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 · MenuDescriptor.hasAccount (cognitive 16) · ×1
  • MenuDescriptor.hasAccount (cognitive 16) Sources/CodexBar/MenuDescriptor.swift:672 — MenuDescriptor.hasAccount has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 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 · ProviderSettingsOrganizationsRowView.body (cognitive 16) · ×1
  • ProviderSettingsOrganizationsRowView.body (cognitive 16) Sources/CodexBar/PreferencesProviderSettingsRows.swift:631 — ProviderSettingsOrganizationsRowView.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 3 (6 pts), boolean chains 4 (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 · ShareStatsSanitizer.safeLabel (cognitive 16) · ×1
  • ShareStatsSanitizer.safeLabel (cognitive 16) Sources/CodexBar/ShareStatsPayload.swift:184 — ShareStatsSanitizer.safeLabel has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 3 (4 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 · ShareStatsFormatting.text (cognitive 16) · ×1
  • ShareStatsFormatting.text (cognitive 16) Sources/CodexBar/ShareStatsPayload.swift:428 — ShareStatsFormatting.text has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (5 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 · SpendActivityWeekGrid.body (cognitive 16) · ×1
  • SpendActivityWeekGrid.body (cognitive 16) Sources/CodexBar/SpendActivityHeatmap.swift:768 — SpendActivityWeekGrid.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), ternaries 3 (6 pts), loops 2 (3 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpendDashboardSource.snapshotRevision (cognitive 16) · ×1
  • SpendDashboardSource.snapshotRevision (cognitive 16) Sources/CodexBar/SpendDashboardController.swift:773 — SpendDashboardSource.snapshotRevision has cognitive complexity 16 (threshold 15). Drivers by points: loops 8 (13 pts), if/else 2 (3 pts) (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · SpendDashboardModel.hasCompleteTokenHistory (cognitive 16) · ×1
  • SpendDashboardModel.hasCompleteTokenHistory (cognitive 16) Sources/CodexBar/SpendDashboardModel.swift:1030 — SpendDashboardModel.hasCompleteTokenHistory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpendTrendChartModel.emptyStateTitle (cognitive 16) · ×1
  • SpendTrendChartModel.emptyStateTitle (cognitive 16) Sources/CodexBar/SpendTrendChartModel.swift:118 — SpendTrendChartModel.emptyStateTitle has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 3, 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 · StatusItemController.updateVisibility (cognitive 16) · ×1
  • StatusItemController.updateVisibility (cognitive 16) Sources/CodexBar/StatusItemController.swift:772 — StatusItemController.updateVisibility has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageStore.warningClaudeAccountDiscriminators (cognitive 16) · ×1
  • UsageStore.warningClaudeAccountDiscriminators (cognitive 16) Sources/CodexBar/PredictivePaceWarnings.swift:215 — UsageStore.warningClaudeAccountDiscriminators has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, 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 · UsageStore.applySelectedCodexVisibleAccountOutcome (cognitive 16) · ×1
  • UsageStore.applySelectedCodexVisibleAccountOutcome (cognitive 16) Sources/CodexBar/UsageStore+TokenAccounts.swift:1383 — UsageStore.applySelectedCodexVisibleAccountOutcome has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 1 (3 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 · UsageStore.preservedClaudeWidgetUsage (cognitive 16) · ×1
  • UsageStore.preservedClaudeWidgetUsage (cognitive 16) Sources/CodexBar/UsageStore+WidgetSnapshot.swift:355 — UsageStore.preservedClaudeWidgetUsage has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 6, ternaries 3, match/switch 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 · UsageStore.persistCodexWeeklyResetPublicationCandidate (cognitive 16) · ×1
  • UsageStore.persistCodexWeeklyResetPublicationCandidate (cognitive 16) Sources/CodexBar/Providers/Codex/UsageStore+CodexWeeklyResetCandidatePersistence.swift:5 — UsageStore.persistCodexWeeklyResetPublicationCandidate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, 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 · CloudSyncEngine.applyFetchedRecords (cognitive 16) · ×1
  • CloudSyncEngine.applyFetchedRecords (cognitive 16) Sources/CodexBar/Sync/CloudSyncEngine.swift:888 — CloudSyncEngine.applyFetchedRecords has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 1 (3 pts), error handling 1 (2 pts), 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 · ClaudeSwapAccountSwitcherView.init (cognitive 16) · ×1
  • ClaudeSwapAccountSwitcherView.init (cognitive 16) Sources/CodexBar/Providers/Claude/ClaudeSwapAccountSwitcherView.swift:12 — ClaudeSwapAccountSwitcherView.init has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (13 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAILiveUsageModel.refreshLimits (cognitive 16) · ×1
  • OpenAILiveUsageModel.refreshLimits (cognitive 16) Sources/CodexBar/Providers/OpenAI/OpenAILiveUsageModel.swift:203 — OpenAILiveUsageModel.refreshLimits has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (7 pts), error handling 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 · CLICardsRenderer.render (cognitive 16) · ×1
  • CLICardsRenderer.render (cognitive 16) Sources/CodexBarCLI/CLICardsRenderer.swift:250 — CLICardsRenderer.render has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), 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 · ToonSerializer.needsQuoting (cognitive 16) · ×1
  • ToonSerializer.needsQuoting (cognitive 16) Sources/CodexBarCLI/ToonFormatter.swift:430 — ToonSerializer.needsQuoting has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · CodexThreadMetadataReader.projectRoots (cognitive 16) · ×1
  • CodexThreadMetadataReader.projectRoots (cognitive 16) Sources/CodexBarCore/CodexThreadMetadataReader+Projects.swift:50 — CodexThreadMetadataReader.projectRoots has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 6, 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 · CookieHeaderCache.commitRefreshReadSuppression (cognitive 16) · ×1
  • CookieHeaderCache.commitRefreshReadSuppression (cognitive 16) Sources/CodexBarCore/CookieHeaderCache.swift:1060 — CookieHeaderCache.commitRefreshReadSuppression has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 1 (3 pts), boolean chains 2, error handling 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 · KeychainCacheStore.load (cognitive 16) · ×1
  • KeychainCacheStore.load (cognitive 16) Sources/CodexBarCore/KeychainCacheStore.swift:97 — KeychainCacheStore.load has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, match/switch 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 · LocalAgentSessionScanner.scanWithActivity (cognitive 16) · ×1
  • LocalAgentSessionScanner.scanWithActivity (cognitive 16) Sources/CodexBarCore/LocalAgentSessionScanner.swift:202 — LocalAgentSessionScanner.scanWithActivity has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 6, 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 · ProviderEndpointOverrideValidator.isPrivateNetworkHost (cognitive 16) · ×1
  • ProviderEndpointOverrideValidator.isPrivateNetworkHost (cognitive 16) Sources/CodexBarCore/ProviderEndpointOverrideValidator.swift:150 — ProviderEndpointOverrideValidator.isPrivateNetworkHost has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 4, 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 · SessionToolActivityStore.details (cognitive 16) · ×1
  • SessionToolActivityStore.details (cognitive 16) Sources/CodexBarCore/SessionToolActivityStore.swift:36 — SessionToolActivityStore.details has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, 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 · SessionToolJSONProjection.consume (cognitive 16) · ×1
  • SessionToolJSONProjection.consume (cognitive 16) Sources/CodexBarCore/SessionToolJSONProjection.swift:29 — SessionToolJSONProjection.consume has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · TextParsing.parseNumber (cognitive 16) · ×1
  • TextParsing.parseNumber (cognitive 16) Sources/CodexBarCore/TextParsing.swift:23 — TextParsing.parseNumber has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UsageFetcher.loadLatestCLIAccountSnapshot (cognitive 16) · ×1
  • UsageFetcher.loadLatestCLIAccountSnapshot (cognitive 16) Sources/CodexBarCore/UsageFetcher.swift:1174 — UsageFetcher.loadLatestCLIAccountSnapshot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, ternaries 1 (2 pts), 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 · UsageFetcher.extractJSONObject (cognitive 16) · ×1
  • UsageFetcher.extractJSONObject (cognitive 16) Sources/CodexBarCore/UsageFetcher.swift:1452 — UsageFetcher.extractJSONObject has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), match/switch 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 · UsageFormatter.countdownDescription (cognitive 16) · ×1
  • UsageFormatter.countdownDescription (cognitive 16) Sources/CodexBarCore/UsageFormatter.swift:118 — UsageFormatter.countdownDescription has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 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 · OpenAIDashboardFetcher.fetchDashboardAPIResponse (cognitive 16) · ×1
  • OpenAIDashboardFetcher.fetchDashboardAPIResponse (cognitive 16) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher+SessionAuthorization.swift:29 — OpenAIDashboardFetcher.fetchDashboardAPIResponse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, error handling 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 · SpawnedProcessGroup.launchPTY (cognitive 16) · ×1
  • SpawnedProcessGroup.launchPTY (cognitive 16) Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:402 — SpawnedProcessGroup.launchPTY has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 3, loops 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 · AntigravityLocalReader.embeddedTimestampsAgree (cognitive 16) · ×1
  • AntigravityLocalReader.embeddedTimestampsAgree (cognitive 16) Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSQLite.swift:474 — AntigravityLocalReader.embeddedTimestampsAgree has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AntigravityOAuthConfig.unambiguousClient (cognitive 16) · ×1
  • AntigravityOAuthConfig.unambiguousClient (cognitive 16) Sources/CodexBarCore/Providers/Antigravity/AntigravityOAuthCredentialsStore.swift:280 — AntigravityOAuthConfig.unambiguousClient has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (value). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · AntigravityProtoReader.parseStepMetadata (cognitive 16) · ×1
  • AntigravityProtoReader.parseStepMetadata (cognitive 16) Sources/CodexBarCore/Providers/Antigravity/AntigravityProtoReader.swift:208 — AntigravityProtoReader.parseStepMetadata has cognitive complexity 16 (threshold 15). Drivers by points: error handling 3 (7 pts), if/else 2 (5 pts), match/switch 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeCLISession.cleanup (cognitive 16) · ×1
  • ClaudeCLISession.cleanup (cognitive 16) Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:483 — ClaudeCLISession.cleanup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ClaudeConfigPaths.costProjectsRoots (cognitive 16) · ×1
  • ClaudeConfigPaths.costProjectsRoots (cognitive 16) Sources/CodexBarCore/Providers/Claude/ClaudeConfigPaths.swift:20 — ClaudeConfigPaths.costProjectsRoots has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ClaudeProviderDescriptor.resolveStrategies (cognitive 16) · ×1
  • ClaudeProviderDescriptor.resolveStrategies (cognitive 16) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:287 — ClaudeProviderDescriptor.resolveStrategies has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CodexCLIBackendConfiguration.removingComment (cognitive 16) · ×1
  • CodexCLIBackendConfiguration.removingComment (cognitive 16) Sources/CodexBarCore/Providers/Codex/CodexCLIBackendConfiguration.swift:149 — CodexCLIBackendConfiguration.removingComment 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 · CodexCLISession.cleanup (cognitive 16) · ×1
  • CodexCLISession.cleanup (cognitive 16) Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:300 — CodexCLISession.cleanup has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), loops 2 (5 pts), boolean chains 4 (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 · CodexStatusProbe.runAndParse (cognitive 16) · ×1
  • CodexStatusProbe.runAndParse (cognitive 16) Sources/CodexBarCore/Providers/Codex/CodexStatusProbe.swift:229 — CodexStatusProbe.runAndParse has cognitive complexity 16 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 4 (8 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CursorStatusProbe.fetchIfSessionAccepted (cognitive 16) · ×1
  • CursorStatusProbe.fetchIfSessionAccepted (cognitive 16) Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:1168 — CursorStatusProbe.fetchIfSessionAccepted has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), 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 · GrokWebBillingFetcher.decodeProductUsage (cognitive 16) · ×1
  • GrokWebBillingFetcher.decodeProductUsage (cognitive 16) Sources/CodexBarCore/Providers/Grok/GrokWebBillingFetcher.swift:551 — GrokWebBillingFetcher.decodeProductUsage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiMoCookieImporter.recordsIncludingFirefoxSessionCookies (cognitive 16) · ×1
  • MiMoCookieImporter.recordsIncludingFirefoxSessionCookies (cognitive 16) Sources/CodexBarCore/Providers/MiMo/MiMoCookieImporter.swift:222 — MiMoCookieImporter.recordsIncludingFirefoxSessionCookies has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MiniMaxLocalStorageImporter.extractGroupID (cognitive 16) · ×1
  • MiniMaxLocalStorageImporter.extractGroupID (cognitive 16) Sources/CodexBarCore/Providers/MiniMax/MiniMaxLocalStorageImporter.swift:547 — MiniMaxLocalStorageImporter.extractGroupID has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 8). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · MiniMaxUsageParser.resetDescription (cognitive 16) · ×1
  • MiniMaxUsageParser.resetDescription (cognitive 16) Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift:1309 — MiniMaxUsageParser.resetDescription has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (9 pts), if/else 5 (6 pts), 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 · MistralSubscriptionBudgetParser.flightChunks (cognitive 16) · ×1
  • MistralSubscriptionBudgetParser.flightChunks (cognitive 16) Sources/CodexBarCore/Providers/Mistral/MistralSubscriptionBudgetParser.swift:58 — MistralSubscriptionBudgetParser.flightChunks has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 3 (6 pts), loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIOrgRateLimitsFetcher.fetch (cognitive 16) · ×1
  • OpenAIOrgRateLimitsFetcher.fetch (cognitive 16) Sources/CodexBarCore/Providers/OpenAI/OpenAIOrgRateLimitsFetcher.swift:31 — OpenAIOrgRateLimitsFetcher.fetch has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (7 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (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 · OpenCodeGoZenBalanceParser.findBalanceValue (cognitive 16) · ×1
  • OpenCodeGoZenBalanceParser.findBalanceValue (cognitive 16) Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoZenBalanceParser.swift:70 — OpenCodeGoZenBalanceParser.findBalanceValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 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 · ClaudeOAuthDelegatedRefreshCoordinator.waitForClaudeKeychainChange (cognitive 16) · ×1
  • ClaudeOAuthDelegatedRefreshCoordinator.waitForClaudeKeychainChange (cognitive 16) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthDelegatedRefreshCoordinator.swift:419 — ClaudeOAuthDelegatedRefreshCoordinator.waitForClaudeKeychainChange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), error handling 1 (2 pts), loops 1, match/switch 1 (nesting depth added 6). Of this number, 9 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HeroBlock.body (cognitive 16) · ×1
  • HeroBlock.body (cognitive 16) Sources/CodexBarWidget/WidgetDesignSystem.swift:346 — HeroBlock.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 3 (6 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (8 members, 22 shared lines) · ×1
  • Near-duplicate member family (8 members, 22 shared lines) Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:18 — Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:18-73 | Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift:6-50 | Sources/CodexBarCore/Providers/Kiro/KiroProviderDescriptor.swift:6-56 | Sources/CodexBarCore/Providers/LongCat/LongCatProviderDescriptor.swift:9-60 | Sources/CodexBarCore/Providers/Moonshot/MoonshotProviderDescriptor.swift:31-92 | Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift:11-101 | Sources/CodexBarCore/Providers/TypeSafe/TypeSafeProviderDescriptor.swift:13-74 | Sources/CodexBarCore/Providers/Warp/WarpProviderDescriptor.swift:9-76 — These 8 members are variants of one another: a block of 22 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 8 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 8 times.
D4 · Code Duplication · Near-duplicate member family (6 members, 22 shared lines) · ×1
  • Near-duplicate member family (6 members, 22 shared lines) Sources/CodexBarCore/Providers/Copilot/CopilotProviderDescriptor.swift:18 — Sources/CodexBarCore/Providers/Copilot/CopilotProviderDescriptor.swift:18-96 | Sources/CodexBarCore/Providers/Devin/DevinProviderDescriptor.swift:15-94 | Sources/CodexBarCore/Providers/Kilo/KiloProviderDescriptor.swift:20-98 | Sources/CodexBarCore/Providers/Kimi/KimiProviderDescriptor.swift:52-139 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeProviderDescriptor.swift:13-77 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:9-75 — These 6 members are variants of one another: a block of 22 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 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 6 times.
D4 · Code Duplication · Near-duplicate member family (6 members, 20 shared lines) · ×1
  • Near-duplicate member family (6 members, 20 shared lines) Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:6 — Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:6-46 | Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift:16-89 | Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift:36-120 | Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift:13-64 | Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift:6-52 | Sources/CodexBarCore/Providers/Windsurf/WindsurfProviderDescriptor.swift:6-55 — These 6 members are variants of one another: a block of 20 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 6 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 6 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 12 shared lines) · ×1
  • Near-duplicate member family (3 members, 12 shared lines) Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift:319 — Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift:319-371 | Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift:493-559 | Sources/CodexBarCore/Sync/SyncModels.swift:333-399 — These 3 members are variants of one another: a block of 12 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 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 3 times.
D4 · Code Duplication · Near-duplicate member pair (54 shared lines) · ×1
  • Near-duplicate member pair (54 shared lines) Sources/CodexBar/CreditsHistoryChartMenuView.swift:28 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:28-124 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:45-171 — These two members are variants of one another: 54 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (50 shared lines) · ×1
  • Near-duplicate member pair (50 shared lines) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:230 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:230-327 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:157-250 — These two members are variants of one another: 50 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×1
  • Edited copy of a member (13 corresponding lines) Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:412 — Sources/CodexBarCore/CostUsageModels+QuotaWindows.swift:412-424 | Sources/CodexBarCore/CostUsageModels.swift:344-356 — 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 (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift:71 — Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift:71-113 | Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:403-445 — 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 (17 corresponding lines) · ×1
  • Edited copy of a member (17 corresponding lines) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:756 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:756-772 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageFetcher.swift:1115-1131 — 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 · Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (11 members, 50+ identical tokens) Sources/CodexBarCore/PathEnvironment.swift:59 — Sources/CodexBarCore/PathEnvironment.swift:59-79 | Sources/CodexBarCore/PathEnvironment.swift:81-104 | Sources/CodexBarCore/PathEnvironment.swift:121-149 | Sources/CodexBarCore/PathEnvironment.swift:151-179 | Sources/CodexBarCore/PathEnvironment.swift:198-222 | Sources/CodexBarCore/PathEnvironment.swift:224-244 | Sources/CodexBarCore/PathEnvironment.swift:246-266 | Sources/CodexBarCore/PathEnvironment.swift:289-308 | Sources/CodexBarCore/PathEnvironment.swift:320-338 | Sources/CodexBarCore/PathEnvironment.swift:340-363 | Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift:320-336 — These 11 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 11 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 11 times.
D4 · Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (9 members, 50+ identical tokens) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:184 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:184-199 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:557-582 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:591-598 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:895-906 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1333-1383 | Sources/CodexBarCore/Providers/Factory/FactoryManualCredentials.swift:32-44 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift:1183-1191 | Sources/CodexBarCore/TextParsing.swift:13-21 | Sources/CodexBarCore/TextParsing.swift:74-87 — These 9 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 9 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 9 times.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:445 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:445-469 | Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:1300-1307 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeZenBillingParser.swift:117-126 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoZenBalanceParser.swift:142-151 | Sources/CodexBarCore/Providers/Shared/OpenCodeWebParsing.swift:206-215 | Sources/CodexBarCore/Providers/Shared/OpenCodeWebParsing.swift:217-226 | Sources/CodexBarCore/TextParsing.swift:61-67 — These 7 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 7 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 7 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Sources/CodexBarCore/CopilotUsageModels.swift:165 — Sources/CodexBarCore/CopilotUsageModels.swift:165-179 | Sources/CodexBarCore/CopilotUsageModels.swift:202-216 | Sources/CodexBarCore/Providers/Codex/CodexSpendControlNumber.swift:5-19 | Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:201-223 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxDecoding.swift:21-36 — 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 · Duplicated block (62 lines × 2) · ×1
  • Duplicated block (62 lines × 2) Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:332 — Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:332-393 | Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:440-501 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:394` calls `closeFile` and `Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:502` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:491 — Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift:491-529 | Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift:304-342 — before extracting anything, compare `Sources/CodexBarCore/Providers/Claude/ClaudeCLISession.swift` and `Sources/CodexBarCore/Providers/Codex/CodexCLISession.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 61 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (32–33 lines × 2) · ×1
  • Duplicated block (32–33 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:364 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:364-396 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:429-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:364` 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 (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:31 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:31-61 | Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:73-103 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:31` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (26 lines × 3) · ×1
  • Duplicated block (26 lines × 3) Sources/CodexBar/UsageStore+OpenAIWeb.swift:679 — Sources/CodexBar/UsageStore+OpenAIWeb.swift:679-704 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:730-755 | Sources/CodexBar/UsageStore+OpenAIWeb.swift:793-818 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/UsageStore+OpenAIWeb.swift:679` 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 (23–25 lines × 2) · ×1
  • Duplicated block (23–25 lines × 2) Sources/CodexBar/CreditsHistoryChartMenuView.swift:235 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:235-257 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:363-387 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 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 (20–25 lines × 2) · ×1
  • Duplicated block (20–25 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:725 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:725-744 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:750-774 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (22–24 lines × 2) · ×1
  • Duplicated block (22–24 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:404 — Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:404-427 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:823-844 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:404` 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 (24 lines × 2) · ×1
  • Duplicated block (24 lines × 2) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1290 — Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1290-1313 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1360-1383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1290` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×1
  • Duplicated block (19–20 lines × 2) Sources/CodexBar/CreditsHistoryChartMenuView.swift:203 — Sources/CodexBar/CreditsHistoryChartMenuView.swift:203-221 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:335-354 — before extracting anything, compare `Sources/CodexBar/CreditsHistoryChartMenuView.swift` and `Sources/CodexBar/UsageBreakdownChartMenuView.swift` as WHOLE FILES: this scan already matched 14 separate duplicated blocks between them, totalling at least 169 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 (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) Sources/CodexBar/CostHistoryChartMenuView.swift:216 — Sources/CodexBar/CostHistoryChartMenuView.swift:216-233 | Sources/CodexBar/CreditsHistoryChartMenuView.swift:76-93 | Sources/CodexBar/UsageBreakdownChartMenuView.swift:113-130 — 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 `Sources/CodexBar/CostHistoryChartMenuView.swift:216` 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) · ×1
  • Duplicated block (17–18 lines × 2) Sources/CodexBarCLI/CLIGuardCommand.swift:258 — Sources/CodexBarCLI/CLIGuardCommand.swift:258-274 | Sources/CodexBarCLI/CLIHooksWatchCommand.swift:160-177 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCLI/CLIGuardCommand.swift:258` 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 (17 lines × 3) · ×1
  • Duplicated block (17 lines × 3) Sources/CodexBarCLI/CLIEntry.swift:136 — Sources/CodexBarCLI/CLIEntry.swift:136-152 | Sources/CodexBarCLI/CLIEntry.swift:183-199 | Sources/CodexBarCLI/CLIEntry.swift:233-249 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCLI/CLIEntry.swift:136` 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 (9–17 lines × 3) · ×1
  • Duplicated block (9–17 lines × 3) Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:720 — Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:720-728 | Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:736-752 | Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:760-776 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:720` 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 × 4) · ×1
  • Duplicated block (15–16 lines × 4) Sources/CodexBar/IconRenderer.swift:388 — Sources/CodexBar/IconRenderer.swift:388-402 | Sources/CodexBar/IconRenderer.swift:477-491 | Sources/CodexBar/IconRenderer.swift:527-542 | Sources/CodexBar/IconRenderer.swift:597-611 — 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. 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 (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) Sources/CodexBar/Providers/Codebuff/CodebuffProviderImplementation.swift:14 — Sources/CodexBar/Providers/Codebuff/CodebuffProviderImplementation.swift:14-29 | Sources/CodexBar/Providers/OpenAI/OpenAIAPIProviderImplementation.swift:169-184 | Sources/CodexBar/Providers/Warp/WarpProviderImplementation.swift:14-29 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Codebuff/CodebuffProviderImplementation.swift:14` 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 (15–16 lines × 3) · ×1
  • Duplicated block (15–16 lines × 3) Sources/CodexBarCLI/CLIEntry.swift:131 — Sources/CodexBarCLI/CLIEntry.swift:131-145 | Sources/CodexBarCLI/CLIEntry.swift:203-218 | Sources/CodexBarCLI/CLIEntry.swift:227-242 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCLI/CLIEntry.swift:131` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×1
  • Duplicated block (14–16 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:169 — Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift:169-182 | Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift:179-194 — before extracting anything, compare `Sources/CodexBarCore/Providers/Claude/ClaudeAdminAPIUsageSnapshot.swift` and `Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIUsageSnapshot.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 78 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. 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 (12–15 lines × 2) · ×1
  • Duplicated block (12–15 lines × 2) Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:27 — Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:27-38 | Sources/CodexBar/Providers/Grok/GrokProviderImplementation.swift:45-59 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:27` 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 before the matched lines, `Sources/CodexBar/Providers/Grok/GrokProviderImplementation.swift:43` calls `ProviderSettingsPickerOption` and `Sources/CodexBar/Providers/Amp/AmpProviderImplementation.swift:27` 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 (13–15 lines × 2) · ×1
  • Duplicated block (13–15 lines × 2) Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:150 — Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:150-164 | Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:187-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:150` 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 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:165` calls `storeSnapshot` and `Sources/CodexBarCore/CodexWorkspaceUsageSidecar.swift:200` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–15 lines × 2) · ×1
  • Duplicated block (11–15 lines × 2) Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:615 — Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:615-629 | Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:631-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:615` 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, `Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:630` calls `appendingPathComponent` and `Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:614` 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 (11–14 lines × 6) · ×1
  • Duplicated block (11–14 lines × 6) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:47 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:47-59 | Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:28-39 | Sources/CodexBarCore/Providers/Copilot/CopilotProviderDescriptor.swift:31-44 | Sources/CodexBarCore/Providers/Devin/DevinProviderDescriptor.swift:31-44 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxProviderDescriptor.swift:62-73 | Sources/CodexBarCore/Providers/Zai/ZaiProviderDescriptor.swift:69-79 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 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 6 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:47` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 lines × 4) · ×1
  • Duplicated block (14 lines × 4) Sources/CodexBarCore/Providers/Claude/ClaudeScopedWeeklyLimitMapper.swift:49 — Sources/CodexBarCore/Providers/Claude/ClaudeScopedWeeklyLimitMapper.swift:49-62 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:542-555 | Sources/CodexBarCore/Providers/Codex/CodexAdditionalRateLimitMapper.swift:139-152 | Sources/CodexBarCore/Providers/Copilot/CopilotBudgetWebFetcher.swift:743-756 — 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 (14 lines × 3) · ×1
  • Duplicated block (14 lines × 3) Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:564 — Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:564-577 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:607-620 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:740-753 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:564` 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 (13 lines × 11) · ×1
  • Duplicated block (13 lines × 11) Sources/CodexBarCore/Hooks/HookEvent.swift:68 — Sources/CodexBarCore/Hooks/HookEvent.swift:68-80 | Sources/CodexBarCore/ProviderCostSnapshot.swift:38-50 | Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageSnapshot.swift:27-39 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageSnapshot.swift:31-43 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:203-215 | Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:32-44 | Sources/CodexBarCore/Providers/MiMo/MiMoUsageSnapshot.swift:27-39 | Sources/CodexBarCore/Providers/Ollama/OllamaUsageSnapshot.swift:27-39 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageSnapshot.swift:31-43 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudUsageSnapshot.swift:31-43 | Sources/CodexBarCore/Providers/Wayfinder/WayfinderUsageFetcher.swift:73-85 — before extracting anything, compare `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageSnapshot.swift` and `Sources/CodexBarCore/Providers/QwenCloud/QwenCloudUsageSnapshot.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 50 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Hooks/HookEvent.swift:68` 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 (13 lines × 8) · ×1
  • Duplicated block (13 lines × 8) Sources/CodexBarCore/Providers/Bedrock/BedrockProviderDescriptor.swift:32 — Sources/CodexBarCore/Providers/Bedrock/BedrockProviderDescriptor.swift:32-44 | Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift:24-36 | Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift:60-72 | Sources/CodexBarCore/Providers/Groq/GroqProviderDescriptor.swift:23-35 | Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift:16-28 | Sources/CodexBarCore/Providers/Kiro/KiroProviderDescriptor.swift:12-24 | Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:73-85 | Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift:13-25 — before extracting anything, compare `Sources/CodexBarCore/Providers/Bedrock/BedrockProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (12–13 lines × 7) · ×1
  • Duplicated block (12–13 lines × 7) Sources/CodexBarCore/PathEnvironment.swift:63 — Sources/CodexBarCore/PathEnvironment.swift:63-75 | Sources/CodexBarCore/PathEnvironment.swift:85-96 | Sources/CodexBarCore/PathEnvironment.swift:228-240 | Sources/CodexBarCore/PathEnvironment.swift:250-262 | Sources/CodexBarCore/PathEnvironment.swift:293-304 | Sources/CodexBarCore/PathEnvironment.swift:324-335 | Sources/CodexBarCore/PathEnvironment.swift:344-355 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/PathEnvironment.swift:63` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/PathEnvironment.swift:76` calls `claudeWellKnownPaths` and `Sources/CodexBarCore/PathEnvironment.swift:336` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift:90 — Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift:90-102 | Sources/CodexBarCore/CostUsageModels.swift:495-507 | Sources/CodexBarCore/CostUsageModels.swift:672-684 | Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:422-434 — there are 4 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 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 `Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift:90` 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 (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) Sources/CodexBar/StatusItemController+MenuPresentation.swift:72 — Sources/CodexBar/StatusItemController+MenuPresentation.swift:72-83 | Sources/CodexBar/StatusItemController+MenuTextRows.swift:25-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/StatusItemController+MenuPresentation.swift:72` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBar/StatusItemController+MenuTextRows.swift:24` calls `setContentCompressionResistancePriority` and `Sources/CodexBar/StatusItemController+MenuPresentation.swift:71` 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 (12 lines × 52) · ×1
  • Duplicated block (12 lines × 52) Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift:102 — Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift:102-113 | Sources/AdaptiveReplayKit/ReplayMetrics.swift:91-102 | Sources/CodexBar/MenuBarLayoutRenderer.swift:186-197 | Sources/CodexBar/MenuCardView.swift:83-94 | Sources/CodexBar/Providers/Shared/ProviderSettingsDescriptors.swift:148-159 | Sources/CodexBar/Providers/Shared/ProviderSettingsDescriptors.swift:332-343 | Sources/CodexBar/SpendDashboardController.swift:35-46 | Sources/CodexBar/SpendDashboardModel.swift:338-349 | Sources/CodexBarCLI/CLICardsRenderer.swift:65-76 | Sources/CodexBarCLI/CLICostCommand.swift:1043-1054 | Sources/CodexBarCLI/DashboardPayloads.swift:85-96 | Sources/CodexBarCore/AgentSession.swift:58-69 | Sources/CodexBarCore/CodexLocalProjectUsageModels.swift:79-90 | Sources/CodexBarCore/CodexLocalProjectUsageModels.swift:286-297 | Sources/CodexBarCore/CodexModelsAnalyticsModels.swift:265-276 | Sources/CodexBarCore/CodexModelsAnalyticsModels.swift:504-515 | Sources/CodexBarCore/CostUsageModels.swift:236-247 | Sources/CodexBarCore/CostUsageModels.swift:501-512 | Sources/CodexBarCore/CostUsageModels.swift:679-690 | Sources/CodexBarCore/CostUsageSessionBreakdown.swift:59-70 | Sources/CodexBarCore/Hooks/HookEvent.swift:73-84 | Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:330-341 | Sources/CodexBarCore/OpenAIDashboardModels.swift:64-75 | Sources/CodexBarCore/Plugins/ScriptFetchStrategy.swift:96-107 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanUsageSnapshot.swift:35-46 | Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapAccountList.swift:70-81 | Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:67-78 | Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:250-261 | Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:226-237 | Sources/CodexBarCore/Providers/Codebuff/CodebuffUsageSnapshot.swift:36-47 | Sources/CodexBarCore/Providers/CommandCode/CommandCodeUsageSnapshot.swift:45-56 | Sources/CodexBarCore/Providers/Cursor/CursorStatusProbe.swift:434-445 | Sources/CodexBarCore/Providers/Cursor/CursorUsageEventsFetcher.swift:119-130 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekUsageCostParser.swift:208-219 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:400-411 | Sources/CodexBarCore/Providers/Grok/GrokAuth.swift:40-51 | Sources/CodexBarCore/Providers/Kilo/KiloUsageFetcher.swift:35-46 | Sources/CodexBarCore/Providers/Kiro/KiroStatusProbe.swift:65-76 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageSnapshot.swift:84-95 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoUsageSnapshot.swift:35-46 | Sources/CodexBarCore/Providers/ProviderCredentialAdapter.swift:138-149 | Sources/CodexBarCore/Providers/ProviderDescriptor.swift:68-79 | Sources/CodexBarCore/Providers/ProviderDiagnosticExport.swift:71-82 | Sources/CodexBarCore/Providers/ProviderFetchPlan.swift:179-190 | Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift:360-371 | Sources/CodexBarCore/Providers/ProviderUsagePresentation.swift:548-559 | Sources/CodexBarCore/Providers/Providers.swift:259-270 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudUsageSnapshot.swift:35-46 | Sources/CodexBarCore/Providers/Wayfinder/WayfinderUsageFetcher.swift:79-90 | Sources/CodexBarCore/Sync/SyncModels.swift:388-399 | Sources/CodexBarCore/UsageFetcher.swift:287-298 | Sources/CodexBarCore/WidgetSnapshot.swift:53-64 — there are 52 copies across 45 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 52 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift:102` 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, `Sources/CodexBarCore/OpenAIDashboardModels.swift:62` calls `removingSkillUsageServices` and `Sources/AdaptiveReplayKit/AdaptiveRefreshTrace.swift:100` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 20) · ×1
  • Duplicated block (12 lines × 20) Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:27 — Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:27-38 | Sources/CodexBarCore/Providers/AzureOpenAI/AzureOpenAIProviderDescriptor.swift:26-37 | Sources/CodexBarCore/Providers/Bedrock/BedrockProviderDescriptor.swift:32-43 | Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:13-24 | Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift:24-35 | Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift:60-71 | Sources/CodexBarCore/Providers/Groq/GroqProviderDescriptor.swift:23-34 | Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift:16-27 | Sources/CodexBarCore/Providers/Kiro/KiroProviderDescriptor.swift:12-23 | Sources/CodexBarCore/Providers/LongCat/LongCatProviderDescriptor.swift:17-28 | Sources/CodexBarCore/Providers/Moonshot/MoonshotProviderDescriptor.swift:44-55 | Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift:31-43 | Sources/CodexBarCore/Providers/Ollama/OllamaProviderDescriptor.swift:27-38 | Sources/CodexBarCore/Providers/OpenAI/OpenAIAPIProviderDescriptor.swift:31-42 | Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift:22-33 | Sources/CodexBarCore/Providers/StepFun/StepFunProviderDescriptor.swift:73-84 | Sources/CodexBarCore/Providers/TypeSafe/TypeSafeProviderDescriptor.swift:26-37 | Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift:13-24 | Sources/CodexBarCore/Providers/Warp/WarpProviderDescriptor.swift:16-27 | Sources/CodexBarCore/Providers/Windsurf/WindsurfProviderDescriptor.swift:17-28 — before extracting anything, compare `Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/Ollama/OllamaProviderDescriptor.swift:39` calls `ProviderDebugPaneCapabilities` and `Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift:34` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (12 lines × 9) · ×1
  • Duplicated block (12 lines × 9) Sources/CodexBarCore/Providers/Copilot/CopilotProviderDescriptor.swift:30 — Sources/CodexBarCore/Providers/Copilot/CopilotProviderDescriptor.swift:30-41 | Sources/CodexBarCore/Providers/Devin/DevinProviderDescriptor.swift:30-41 | Sources/CodexBarCore/Providers/Kilo/KiloProviderDescriptor.swift:35-46 | Sources/CodexBarCore/Providers/Kimi/KimiProviderDescriptor.swift:71-82 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxProviderDescriptor.swift:61-72 | Sources/CodexBarCore/Providers/Mistral/MistralProviderDescriptor.swift:21-32 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeProviderDescriptor.swift:34-45 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:16-27 | Sources/CodexBarCore/Providers/Zai/ZaiProviderDescriptor.swift:68-79 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 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 9 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/Providers/Copilot/CopilotProviderDescriptor.swift:27` calls `ProviderConfigCapabilities` and `Sources/CodexBarCore/Providers/Kilo/KiloProviderDescriptor.swift:32` 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 (12 lines × 6) · ×1
  • Duplicated block (12 lines × 6) Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:25 — Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:25-36 | Sources/CodexBarCore/Providers/Bedrock/BedrockProviderDescriptor.swift:30-41 | Sources/CodexBarCore/Providers/IBMBob/IBMBobProviderDescriptor.swift:23-34 | Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift:14-25 | Sources/CodexBarCore/Providers/Moonshot/MoonshotProviderDescriptor.swift:42-53 | Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift:11-22 — before extracting anything, compare `Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11–12 lines × 5) · ×1
  • Duplicated block (11–12 lines × 5) Sources/CodexBar/Providers/Codebuff/CodebuffProviderImplementation.swift:12 — Sources/CodexBar/Providers/Codebuff/CodebuffProviderImplementation.swift:12-23 | Sources/CodexBar/Providers/Groq/GroqProviderImplementation.swift:21-31 | Sources/CodexBar/Providers/OpenAI/OpenAIAPIProviderImplementation.swift:167-178 | Sources/CodexBar/Providers/OpenRouter/OpenRouterProviderImplementation.swift:33-43 | Sources/CodexBar/Providers/Warp/WarpProviderImplementation.swift:12-23 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/Providers/Codebuff/CodebuffProviderImplementation.swift:12` 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 `context` to `ProviderSettingsContext` in one and `ProviderAvailabilityContext` 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.
D4 · Code Duplication · Duplicated block (12 lines × 5) · ×1
  • Duplicated block (12 lines × 5) Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:17 — Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:17-28 | Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:21-32 | Sources/CodexBarCore/Providers/Codebuff/CodebuffProviderDescriptor.swift:32-43 | Sources/CodexBarCore/Providers/MiMo/MiMoProviderDescriptor.swift:14-25 | Sources/CodexBarCore/Providers/ZoomMate/ZoomMateProviderDescriptor.swift:13-24 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times.
D4 · Code Duplication · Duplicated block (9–12 lines × 5) · ×1
  • Duplicated block (9–12 lines × 5) Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:36 — Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:36-44 | Sources/CodexBarCore/Providers/Copilot/CopilotProviderDescriptor.swift:56-65 | Sources/CodexBarCore/Providers/Kimi/KimiProviderDescriptor.swift:90-99 | Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift:54-65 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeProviderDescriptor.swift:53-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:36` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×1
  • Duplicated block (11–12 lines × 3) Sources/CodexBar/CostHistoryChartMenuView.swift:1024 — Sources/CodexBar/CostHistoryChartMenuView.swift:1024-1035 | Sources/CodexBarCore/CostUsageModels.swift:1232-1243 | Sources/CodexBarCore/Providers/Cursor/CursorUsageEventsFetcher.swift:830-840 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/CostHistoryChartMenuView.swift:1024` 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 (11–12 lines × 2) · ×1
  • Duplicated block (11–12 lines × 2) Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:657 — Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:657-667 | Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:763-774 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:657` 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–11 lines × 10) · ×1
  • Duplicated block (10–11 lines × 10) Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:47 — Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:47-57 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekProviderDescriptor.swift:97-107 | Sources/CodexBarCore/Providers/Devin/DevinProviderDescriptor.swift:55-65 | Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift:33-42 | Sources/CodexBarCore/Providers/Kilo/KiloProviderDescriptor.swift:54-64 | Sources/CodexBarCore/Providers/LongCat/LongCatProviderDescriptor.swift:35-45 | Sources/CodexBarCore/Providers/Moonshot/MoonshotProviderDescriptor.swift:63-73 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:35-45 | Sources/CodexBarCore/Providers/TypeSafe/TypeSafeProviderDescriptor.swift:43-53 | Sources/CodexBarCore/Providers/Warp/WarpProviderDescriptor.swift:34-44 — before extracting anything, compare `Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:47` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–11 lines × 9) · ×1
  • Duplicated block (7–11 lines × 9) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:40 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:40-47 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:51-60 | Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:32-40 | Sources/CodexBarCore/Providers/Copilot/CopilotProviderDescriptor.swift:35-45 | Sources/CodexBarCore/Providers/Cursor/CursorProviderDescriptor.swift:44-52 | Sources/CodexBarCore/Providers/Devin/DevinProviderDescriptor.swift:35-45 | Sources/CodexBarCore/Providers/Gemini/GeminiProviderDescriptor.swift:19-26 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxProviderDescriptor.swift:66-73 | Sources/CodexBarCore/Providers/Zai/ZaiProviderDescriptor.swift:73-79 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 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 9 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanProviderDescriptor.swift:40` 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 (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) Sources/CodexBarCore/CostUsageFetcher.swift:206 — Sources/CodexBarCore/CostUsageFetcher.swift:206-216 | Sources/CodexBarCore/CostUsageFetcher.swift:244-254 | Sources/CodexBarCore/CostUsageFetcher.swift:423-433 | Sources/CodexBarCore/CostUsageFetcher.swift:468-478 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–11 lines × 3) · ×1
  • Duplicated block (7–11 lines × 3) Sources/CodexBar/CodexLoginAlertPresentation.swift:37 — Sources/CodexBar/CodexLoginAlertPresentation.swift:37-43 | Sources/CodexBar/Providers/Kiro/KiroLoginAlertPresentation.swift:26-36 | Sources/CodexBar/StatusItemController+Actions.swift:904-914 — 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.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1064 — Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1064-1074 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1104-1113 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1169-1178 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1114` calls `setValue` and `Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1075` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:955 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:955-962 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:1010-1020 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardFetcher.swift:955` 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 (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:287 — Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:287-297 | Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:307-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageFetcher.swift:287` 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.
D4 · Code Duplication · Duplicated block (10 lines × 18) · ×1
  • Duplicated block (10 lines × 18) Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:47 — Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:47-56 | Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:35-44 | Sources/CodexBarCore/Providers/Augment/AugmentProviderDescriptor.swift:43-52 | Sources/CodexBarCore/Providers/Codebuff/CodebuffProviderDescriptor.swift:50-59 | Sources/CodexBarCore/Providers/Copilot/CopilotProviderDescriptor.swift:55-64 | Sources/CodexBarCore/Providers/DeepSeek/DeepSeekProviderDescriptor.swift:97-106 | Sources/CodexBarCore/Providers/Devin/DevinProviderDescriptor.swift:55-64 | Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift:33-42 | Sources/CodexBarCore/Providers/Kilo/KiloProviderDescriptor.swift:54-63 | Sources/CodexBarCore/Providers/Kimi/KimiProviderDescriptor.swift:89-98 | Sources/CodexBarCore/Providers/Kiro/KiroProviderDescriptor.swift:30-39 | Sources/CodexBarCore/Providers/LongCat/LongCatProviderDescriptor.swift:35-44 | Sources/CodexBarCore/Providers/Moonshot/MoonshotProviderDescriptor.swift:63-72 | Sources/CodexBarCore/Providers/Notion/NotionProviderDescriptor.swift:51-62 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeProviderDescriptor.swift:52-61 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:35-44 | Sources/CodexBarCore/Providers/TypeSafe/TypeSafeProviderDescriptor.swift:43-52 | Sources/CodexBarCore/Providers/Warp/WarpProviderDescriptor.swift:34-43 — before extracting anything, compare `Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/JetBrains/JetBrainsProviderDescriptor.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 48 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Abacus/AbacusProviderDescriptor.swift:47` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/Amp/AmpProviderDescriptor.swift:45` calls `ProviderPaceCapability`, `hasPrefix` and `Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:45` 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 (1–10 lines × 5) · ×1
  • Duplicated block (1–10 lines × 5) Sources/CodexBarCore/Config/SettingsValue.swift:10 — Sources/CodexBarCore/Config/SettingsValue.swift:10-19 | Sources/CodexBarCore/Providers/HuggingFace/HuggingFaceSettingsReader.swift:66-75 | Sources/CodexBarCore/Providers/IBMBob/IBMBobSettingsReader.swift:13-22 | Sources/CodexBarCore/Providers/Nous/NousSettingsReader.swift:278-279 | Sources/CodexBarCore/Providers/Nous/NousSettingsReader.swift:280-280 — there are 5 copies across 4 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 `Sources/CodexBarCore/Config/SettingsValue.swift:10` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (6–10 lines × 2) · ×1
  • Duplicated block (6–10 lines × 2) Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:1155 — Sources/CodexBarCore/CodexLocalProjectUsageIndexer.swift:1155-1164 | Sources/CodexBarCore/CodexLocalProjectUsageProjection.swift:36-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9 lines × 9) · ×1
  • Duplicated block (9 lines × 9) Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:31 — Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:31-39 | Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift:44-52 | Sources/CodexBarCore/Providers/IBMBob/IBMBobProviderDescriptor.swift:43-51 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxProviderDescriptor.swift:86-94 | Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift:40-48 | Sources/CodexBarCore/Providers/Wayfinder/WayfinderProviderDescriptor.swift:35-43 | Sources/CodexBarCore/Providers/Windsurf/WindsurfProviderDescriptor.swift:38-46 | Sources/CodexBarCore/Providers/Zai/ZaiProviderDescriptor.swift:86-94 | Sources/CodexBarCore/Providers/ZoomMate/ZoomMateProviderDescriptor.swift:46-54 — before extracting anything, compare `Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 33 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:31` 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 (8–9 lines × 5) · ×1
  • Duplicated block (8–9 lines × 5) Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:52 — Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:52-59 | Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift:81-89 | Sources/CodexBarCore/Providers/Muse/MuseProviderDescriptor.swift:57-64 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift:70-78 | Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift:32-39 — before extracting anything, compare `Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:52` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–9 lines × 4) · ×1
  • Duplicated block (8–9 lines × 4) Sources/CodexBarCore/Providers/AzureOpenAI/AzureOpenAIProviderDescriptor.swift:47 — Sources/CodexBarCore/Providers/AzureOpenAI/AzureOpenAIProviderDescriptor.swift:47-54 | Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift:45-53 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxProviderDescriptor.swift:87-95 | Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift:41-49 — before extracting anything, compare `Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift` and `Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/AzureOpenAI/AzureOpenAIProviderDescriptor.swift:47` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×1
  • Duplicated block (8–9 lines × 2) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:123 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:123-131 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:286-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardBrowserCookieImporter.swift:123` 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 (6–9 lines × 2) · ×1
  • Duplicated block (6–9 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1141 — Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1141-1149 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1163-1168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:579 — Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:579-587 | Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:625-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:579` 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 before the matched lines, `Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:578` calls `setValue` and `Sources/CodexBarCore/Providers/StepFun/StepFunUsageFetcher.swift:623` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 14) · ×1
  • Duplicated block (8 lines × 14) Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:51 — Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:51-58 | Sources/CodexBarCore/Providers/CodeRabbit/CodeRabbitProviderDescriptor.swift:30-37 | Sources/CodexBarCore/Providers/Factory/FactoryProviderDescriptor.swift:43-50 | Sources/CodexBarCore/Providers/Grok/GrokProviderDescriptor.swift:80-87 | Sources/CodexBarCore/Providers/IBMBob/IBMBobProviderDescriptor.swift:42-49 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxProviderDescriptor.swift:85-92 | Sources/CodexBarCore/Providers/Muse/MuseProviderDescriptor.swift:56-63 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoProviderDescriptor.swift:69-76 | Sources/CodexBarCore/Providers/Replicate/ReplicateProviderDescriptor.swift:39-46 | Sources/CodexBarCore/Providers/VertexAI/VertexAIProviderDescriptor.swift:31-38 | Sources/CodexBarCore/Providers/Wayfinder/WayfinderProviderDescriptor.swift:34-41 | Sources/CodexBarCore/Providers/Windsurf/WindsurfProviderDescriptor.swift:37-44 | Sources/CodexBarCore/Providers/Zai/ZaiProviderDescriptor.swift:85-92 | Sources/CodexBarCore/Providers/ZoomMate/ZoomMateProviderDescriptor.swift:42-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 14 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 14 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Antigravity/AntigravityProviderDescriptor.swift:51` 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 (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) Sources/CodexBar/PreferencesDebugPane.swift:159 — Sources/CodexBar/PreferencesDebugPane.swift:159-166 | Sources/CodexBar/PreferencesDebugPane.swift:191-198 | Sources/CodexBar/PreferencesDebugPane.swift:220-227 | Sources/CodexBar/PreferencesDebugPane.swift:393-400 | Sources/CodexBar/PreferencesDebugPane.swift:409-416 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/PreferencesDebugPane.swift:159` 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 first that the copies are not typed on the same thing: the declarations holding them bind `alignment` to `.topLeading` in one and `.leading` 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.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) Sources/CodexBarCore/PiFamilySessionScanner.swift:969 — Sources/CodexBarCore/PiFamilySessionScanner.swift:969-976 | Sources/CodexBarCore/PiFamilySessionScanner.swift:979-986 | Sources/CodexBarCore/PiFamilySessionScanner.swift:987-993 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/PiFamilySessionScanner.swift:969` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/PiFamilySessionScanner.swift:978` calls `pathURL`, `SessionRootResolution` and `Sources/CodexBarCore/PiFamilySessionScanner.swift:987` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×1
  • Duplicated block (7–8 lines × 2) Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:720 — Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:720-726 | Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:2214-2221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeOAuth/ClaudeOAuthCredentials.swift:720` 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 (4–8 lines × 3) · ×1
  • Duplicated block (4–8 lines × 3) Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:143 — Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:143-149 | Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift:53-60 | Sources/CodexBarCore/Providers/Cursor/CursorProviderDescriptor.swift:56-59 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Claude/ClaudeProviderDescriptor.swift:143` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/CodexBarCore/Providers/Cursor/CursorProviderDescriptor.swift:60` calls `ProviderDebugPaneCapabilities` and `Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift:60` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×1
  • Duplicated block (6–8 lines × 2) Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift:38 — Sources/CodexBarCore/Providers/Grok/GrokRPCClient.swift:38-43 | Sources/CodexBarCore/UsageFetcher.swift:988-995 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/UsageFetcher.swift:988` 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 (3–7 lines × 3) · ×1
  • Duplicated block (3–7 lines × 3) Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1130 — Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1130-1132 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1138-1144 | Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1196-1202 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe.swift:1138` 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 (3–6 lines × 11) · ×1
  • Duplicated block (3–6 lines × 11) Sources/CodexBarCore/PathEnvironment.swift:62 — Sources/CodexBarCore/PathEnvironment.swift:62-67 | Sources/CodexBarCore/PathEnvironment.swift:84-89 | Sources/CodexBarCore/PathEnvironment.swift:124-129 | Sources/CodexBarCore/PathEnvironment.swift:152-154 | Sources/CodexBarCore/PathEnvironment.swift:201-206 | Sources/CodexBarCore/PathEnvironment.swift:227-232 | Sources/CodexBarCore/PathEnvironment.swift:249-254 | Sources/CodexBarCore/PathEnvironment.swift:292-297 | Sources/CodexBarCore/PathEnvironment.swift:323-328 | Sources/CodexBarCore/PathEnvironment.swift:343-348 | Sources/CodexBarCore/Providers/Codex/CodexProviderDescriptor.swift:323-328 — there are 11 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 11 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/PathEnvironment.swift:62` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–6 lines × 3) · ×1
  • Duplicated block (3–6 lines × 3) Sources/CodexBar/StatusItemController+Animation.swift:389 — Sources/CodexBar/StatusItemController+Animation.swift:389-391 | Sources/CodexBar/StatusItemController+Animation.swift:459-464 | Sources/CodexBar/StatusItemController+Animation.swift:491-496 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBar/StatusItemController+Animation.swift:389` 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. 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 (4–6 lines × 3) · ×1
  • Duplicated block (4–6 lines × 3) Sources/CodexBarCore/CookieHeaderNormalizer.swift:68 — Sources/CodexBarCore/CookieHeaderNormalizer.swift:68-73 | Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:67-70 | Sources/CodexBarCore/Providers/Kimi/KimiCookieHeader.swift:54-59 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:246 — Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:246-250 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:259-263 | Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:275-279 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:172-176 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:185-189 | Sources/CodexBarCore/Providers/QwenCloud/QwenCloudProviderDescriptor.swift:201-205 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Alibaba/AlibabaTokenPlanProviderDescriptor.swift:246` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (3–5 lines × 9) · ×1
  • Duplicated block (3–5 lines × 9) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:188 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:188-193 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:565-567 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:593-595 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:898-902 | Sources/CodexBarCore/Providers/Claude/ClaudeStatusProbe.swift:1336-1340 | Sources/CodexBarCore/Providers/Factory/FactoryManualCredentials.swift:35-37 | Sources/CodexBarCore/Providers/MiniMax/MiniMaxUsageFetcher.swift:1185-1187 | Sources/CodexBarCore/TextParsing.swift:15-17 | Sources/CodexBarCore/TextParsing.swift:76-80 — there are 9 copies across 5 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:188` 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 (3–5 lines × 4) · ×1
  • Duplicated block (3–5 lines × 4) Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift:45 — Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift:45-49 | Sources/CodexBarCore/Providers/Mistral/MistralCookieImporter.swift:52-54 | Sources/CodexBarCore/Providers/Replicate/ReplicateCookieImporter.swift:26-30 | Sources/CodexBarCore/Providers/Venice/VeniceCookieImporter.swift:22-24 — 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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/Grok/GrokCookieImporter.swift:45` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (2–5 lines × 7) · ×1
  • Duplicated block (2–5 lines × 7) Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:453 — Sources/CodexBarCore/OpenAIWeb/OpenAIDashboardParser.swift:453-455 | Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe.swift:1303-1304 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeZenBillingParser.swift:119-122 | Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoZenBalanceParser.swift:145-149 | Sources/CodexBarCore/Providers/Shared/OpenCodeWebParsing.swift:209-213 | Sources/CodexBarCore/Providers/Shared/OpenCodeWebParsing.swift:219-222 | Sources/CodexBarCore/TextParsing.swift:63-64 — there are 7 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 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CodexBarCore/Providers/OpenCode/OpenCodeZenBillingParser.swift:119` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/Providers/OpenCodeGo/OpenCodeGoZenBalanceParser.swift:145` calls `firstMatch` and `Sources/CodexBarCore/Providers/OpenCode/OpenCodeZenBillingParser.swift:119` 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 (6 lines × 10) · ×1
  • Duplicated block (6 lines × 10) Sources/CodexBar/Providers/Alibaba/AlibabaCodingPlanProviderImplementation.swift:7 — Sources/CodexBar/Providers/Alibaba/AlibabaCodingPlanProviderImplementation.swift:7-12 | Sources/CodexBar/Providers/Alibaba/AlibabaTokenPlanProviderImplementation.swift:8-13 | Sources/CodexBar/Providers/DeepSeek/DeepSeekProviderImplementation.swift:8-13 | Sources/CodexBar/Providers/Devin/DevinProviderImplementation.swift:9-14 | Sources/CodexBar/Providers/Kimi/KimiProviderImplementation.swift:7-12 | Sources/CodexBar/Providers/LongCat/LongCatProviderImplementation.swift:7-12 | Sources/CodexBar/Providers/MiniMax/MiniMaxProviderImplementation.swift:7-12 | Sources/CodexBar/Providers/OpenCodeGo/OpenCodeGoProviderImplementation.swift:7-12 | Sources/CodexBar/Providers/QwenCloud/QwenCloudProviderImplementation.swift:7-12 | Sources/CodexBar/Providers/Venice/VeniceProviderImplementation.swift:8-13 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 10 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 10 times.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) Sources/CodexBarCore/Providers/Chutes/ChutesSettingsReader.swift:13 — Sources/CodexBarCore/Providers/Chutes/ChutesSettingsReader.swift:13-20 | Sources/CodexBarCore/Providers/Codebuff/CodebuffSettingsReader.swift:15-20 | Sources/CodexBarCore/Providers/ElevenLabs/ElevenLabsSettingsReader.swift:19-24 | Sources/CodexBarCore/Providers/Groq/GroqSettingsReader.swift:13-20 | Sources/CodexBarCore/Providers/NeuralWatt/NeuralWattSettingsReader.swift:18-23 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) Sources/CodexBarCore/Providers/Devin/DevinProviderSettings.swift:8 — Sources/CodexBarCore/Providers/Devin/DevinProviderSettings.swift:8-12 | Sources/CodexBarCore/Providers/Muse/MuseProviderSettings.swift:13-17 | Sources/CodexBarCore/Providers/Notion/NotionProviderSettings.swift:10-14 | Sources/CodexBarCore/Providers/OpenCode/OpenCodeProviderSettings.swift:8-12 | Sources/CodexBarCore/Providers/Shared/ProviderCookieSettings.swift:32-36 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/CodexBarCore/Providers/Muse/MuseProviderSettings.swift:9` calls `init` and `Sources/CodexBarCore/Providers/Devin/DevinProviderSettings.swift:6` 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 (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) Sources/CodexBar/CodexHistoryOwnership.swift:135 — Sources/CodexBar/CodexHistoryOwnership.swift:135-140 | Sources/CodexBar/CursorLoginAccountSelector.swift:98-103 | Sources/CodexBarCore/Providers/Antigravity/AntigravityLocalSnapshotSelection.swift:31-36 | Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift:114-119 | Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift:305-310 | Sources/CodexBarCore/UsageFetcher.swift:1493-1498 — there are 6 copies across 5 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 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (6 lines × 9) · ×1
  • Duplicated block (6 lines × 9) Sources/CodexBar/Providers/Abacus/AbacusProviderImplementation.swift:7 — Sources/CodexBar/Providers/Abacus/AbacusProviderImplementation.swift:7-12 | Sources/CodexBar/Providers/Augment/AugmentProviderImplementation.swift:7-12 | Sources/CodexBar/Providers/Claude/ClaudeProviderImplementation.swift:42-47 | Sources/CodexBar/Providers/Cursor/CursorProviderImplementation.swift:13-18 | Sources/CodexBar/Providers/Factory/FactoryProviderImplementation.swift:30-35 | Sources/CodexBar/Providers/Mistral/MistralProviderImplementation.swift:12-17 | Sources/CodexBar/Providers/Ollama/OllamaProviderImplementation.swift:31-36 | Sources/CodexBar/Providers/OpenCode/OpenCodeProviderImplementation.swift:24-31 | Sources/CodexBar/Providers/StepFun/StepFunProviderImplementation.swift:48-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 9 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 9 times. Note first that the copies are not typed on the same thing: the declarations holding them bind `context` to `ProviderSettingsSnapshotContext` in one and `ProviderSourceModeContext` 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.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) Sources/CodexBarCore/CookieHeaderCache+TestingOverrides.swift:14 — Sources/CodexBarCore/CookieHeaderCache+TestingOverrides.swift:14-22 | Sources/CodexBarCore/CookieHeaderCache+TestingOverrides.swift:33-41 | Sources/CodexBarCore/CookieHeaderCache.swift:832-840 | Sources/CodexBarCore/KeychainAccessGate.swift:130-138 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×1
  • Duplicated block (12–16 lines × 2) TestsLinux/CostUsageJsonlParitySupport.swift:68 — TestsLinux/CostUsageJsonlParitySupport.swift:68-79 | TestsLinux/CostUsageJsonlParitySupport.swift:83-98 — both copies are in the same file, so extract the 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 `TestsLinux/CostUsageJsonlParitySupport.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.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×1
  • Sync-over-async blocking Sources/CodexBarCore/Providers/ProviderFetchPlan.swift:511 — `sleep` is async and calls sleep — 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.
R1 · Type Safety · Type Safety · ×1
  • Type Safety — 43 typed · 95 plain JS — the untyped files are Integrations/Linux/Shared/Notifications.js, Integrations/Linux/Shared/Usage.js, Integrations/Omarchy/notifications.test.mjs, Integrations/Omarchy/test.mjs, REDACTED, REDACTED (+89 more).
R10 · Code Duplication · Duplicated block with local edits (276 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (276 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/chutes.js:90 — Sources/CodexBarCore/Resources/Plugins/chutes.js:90 · Sources/CodexBarCore/Resources/Plugins/chutes.ts:63 — the two spans are one implementation copied and then locally edited — 2370 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 (219 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (219 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/muse.js:39 — Sources/CodexBarCore/Resources/Plugins/muse.js:39 · Sources/CodexBarCore/Resources/Plugins/muse.ts:11 — the two spans are one implementation copied and then locally edited — 2198 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 (214 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (214 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/huggingface.js:37 — Sources/CodexBarCore/Resources/Plugins/huggingface.js:37 · Sources/CodexBarCore/Resources/Plugins/huggingface.ts:16 — the two spans are one implementation copied and then locally edited — 1862 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 (186 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (186 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/litellm.js:40 — Sources/CodexBarCore/Resources/Plugins/litellm.js:40 · Sources/CodexBarCore/Resources/Plugins/litellm.ts:12 — the two spans are one implementation copied and then locally edited — 1932 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (166 identical lines × 2 files) · ×1
  • Wholesale file copy (166 identical lines × 2 files) Sources/CodexBarCore/Resources/Plugins/aixy.js:22 — Sources/CodexBarCore/Resources/Plugins/aixy.js:22 · Sources/CodexBarCore/Resources/Plugins/aixy.ts:1 — these 2 files are line-for-line copies of one another — 166 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (154 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (154 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/workbuddy.js:24 — Sources/CodexBarCore/Resources/Plugins/workbuddy.js:24 · Sources/CodexBarCore/Resources/Plugins/workbuddy.ts:17 — the two spans are one implementation copied and then locally edited — 1313 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 (152 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (152 matched lines × 2 locations) REDACTED:40 — REDACTED:40 · REDACTED:12 — the two spans are one implementation copied and then locally edited — 1301 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 (139 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (139 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/munito.js:15 — Sources/CodexBarCore/Resources/Plugins/munito.js:15 · Sources/CodexBarCore/Resources/Plugins/munito.ts:8 — the two spans are one implementation copied and then locally edited — 1200 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (138 identical lines × 2 files) · ×1
  • Wholesale file copy (138 identical lines × 2 files) Sources/CodexBarCore/Resources/Plugins/claudeplatform.js:8 — Sources/CodexBarCore/Resources/Plugins/claudeplatform.js:8 · Sources/CodexBarCore/Resources/Plugins/claudeplatform.ts:1 — these 2 files are line-for-line copies of one another — 138 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (131 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (131 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/qwencloud-team.js:37 — Sources/CodexBarCore/Resources/Plugins/qwencloud-team.js:37 · Sources/CodexBarCore/Resources/Plugins/qwencloud-team.ts:9 — the two spans are one implementation copied and then locally edited — 1160 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 (127 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (127 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/v0.js:52 — Sources/CodexBarCore/Resources/Plugins/v0.js:52 · Sources/CodexBarCore/Resources/Plugins/v0.ts:24 — the two spans are one implementation copied and then locally edited — 1111 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 (123 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (123 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/helmcode.js:58 — Sources/CodexBarCore/Resources/Plugins/helmcode.js:58 · Sources/CodexBarCore/Resources/Plugins/helmcode.ts:32 — the two spans are one implementation copied and then locally edited — 1176 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (104 identical lines × 2 files) · ×1
  • Wholesale file copy (104 identical lines × 2 files) Sources/CodexBarCore/Resources/Plugins/raycast.js:8 — Sources/CodexBarCore/Resources/Plugins/raycast.js:8 · Sources/CodexBarCore/Resources/Plugins/raycast.ts:1 — these 2 files are line-for-line copies of one another — 104 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (98 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (98 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/clinepass.js:33 — Sources/CodexBarCore/Resources/Plugins/clinepass.js:33 · Sources/CodexBarCore/Resources/Plugins/clinepass.ts:22 — the two spans are one implementation copied and then locally edited — 624 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (93 identical lines × 2 files) · ×1
  • Wholesale file copy (93 identical lines × 2 files) Sources/CodexBarCore/Resources/Plugins/llmproxy.js:8 — Sources/CodexBarCore/Resources/Plugins/llmproxy.js:8 · Sources/CodexBarCore/Resources/Plugins/llmproxy.ts:1 — these 2 files are line-for-line copies of one another — 93 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (93 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (93 matched lines × 2 locations) REDACTED:18 — REDACTED:18 · REDACTED:11 — the two spans are one implementation copied and then locally edited — 945 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 (91 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (91 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/gitkraken.js:41 — Sources/CodexBarCore/Resources/Plugins/gitkraken.js:41 · Sources/CodexBarCore/Resources/Plugins/gitkraken.ts:14 — the two spans are one implementation copied and then locally edited — 809 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (89 identical lines × 2 files) · ×1
  • Wholesale file copy (89 identical lines × 2 files) Sources/CodexBarCore/Resources/Plugins/abacus.js:8 — Sources/CodexBarCore/Resources/Plugins/abacus.js:8 · Sources/CodexBarCore/Resources/Plugins/abacus.ts:1 — these 2 files are line-for-line copies of one another — 89 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (85 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (85 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/futureagi.js:39 — Sources/CodexBarCore/Resources/Plugins/futureagi.js:39 · Sources/CodexBarCore/Resources/Plugins/futureagi.ts:11 — the two spans are one implementation copied and then locally edited — 675 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (85 identical lines × 2 files) · ×1
  • Wholesale file copy (85 identical lines × 2 files) Sources/CodexBarCore/Resources/Plugins/lithosai.js:8 — Sources/CodexBarCore/Resources/Plugins/lithosai.js:8 · Sources/CodexBarCore/Resources/Plugins/lithosai.ts:1 — these 2 files are line-for-line copies of one another — 85 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (82 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (82 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/llmman.js:31 — Sources/CodexBarCore/Resources/Plugins/llmman.js:31 · Sources/CodexBarCore/Resources/Plugins/llmman.ts:10 — the two spans are one implementation copied and then locally edited — 863 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 (76 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (76 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/gemini-web.js:47 — Sources/CodexBarCore/Resources/Plugins/gemini-web.js:47 · Sources/CodexBarCore/Resources/Plugins/gemini-web.ts:28 — the two spans are one implementation copied and then locally edited — 643 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (73 identical lines × 2 files) · ×1
  • Wholesale file copy (73 identical lines × 2 files) REDACTED:1 — REDACTED:1 · REDACTED:1 — these 2 files are line-for-line copies of one another — 73 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Wholesale file copy (69 identical lines × 2 files) · ×1
  • Wholesale file copy (69 identical lines × 2 files) Sources/CodexBarCore/Resources/Plugins/langdock.js:1 — Sources/CodexBarCore/Resources/Plugins/langdock.js:1 · Sources/CodexBarCore/Resources/Plugins/langdock.ts:1 — these 2 files are line-for-line copies of one another — 69 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (62 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (62 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/parallel.js:15 — Sources/CodexBarCore/Resources/Plugins/parallel.js:15 · Sources/CodexBarCore/Resources/Plugins/parallel.ts:8 — the two spans are one implementation copied and then locally edited — 522 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Wholesale file copy (58 identical lines × 2 files) · ×1
  • Wholesale file copy (58 identical lines × 2 files) Sources/CodexBarCore/Resources/Plugins/sofya.js:8 — Sources/CodexBarCore/Resources/Plugins/sofya.js:8 · Sources/CodexBarCore/Resources/Plugins/sofya.ts:1 — these 2 files are line-for-line copies of one another — 58 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Wholesale file copy (57 identical lines × 2 files) · ×1
  • Wholesale file copy (57 identical lines × 2 files) REDACTED:1 — REDACTED:1 · REDACTED:1 — these 2 files are line-for-line copies of one another — 57 lines are identical, in the same order, in every one of them — so this is one fact about the file set, not a block to extract. An edit made to one file and not the others changes behaviour silently, which is the failure a wholesale copy guarantees. Pick one file as the single source and derive the others from it (re-export it, spread it into the local overrides each variant genuinely needs, or generate the copies at build time) — the few lines that differ between the files are exactly the part each variant should still own. Check first whether the copies are deliberately standalone deliverables (a translation file seeded from its sibling and waiting to be translated); where they are, the duplication is the design, and the honest move is to mark the seeded file as untranslated rather than to let it pass as done.
R10 · Code Duplication · Duplicated block with local edits (51 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (51 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/xkiro.js:36 — Sources/CodexBarCore/Resources/Plugins/xkiro.js:36 · Sources/CodexBarCore/Resources/Plugins/xkiro.ts:8 — the two spans are one implementation copied and then locally edited — 549 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
R10 · Code Duplication · Duplicated block with local edits (49 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (49 matched lines × 2 locations) REDACTED:11 — REDACTED:11 · REDACTED:11 — the two spans are one implementation copied and then locally edited — 438 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 (48 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (48 matched lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/ollama-api.js:37 — Sources/CodexBarCore/Resources/Plugins/ollama-api.js:37 · Sources/CodexBarCore/Resources/Plugins/ollama-api.ts:16 — the two spans are one implementation copied and then locally edited — 464 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 (43 lines × 2 locations) · ×1
  • Duplicated block (43 lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/hyper.js:46 — Sources/CodexBarCore/Resources/Plugins/hyper.js:46 · Sources/CodexBarCore/Resources/Plugins/hyper.ts:25 — 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 (42 lines × 2 locations) · ×1
  • Duplicated block (42 lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/zoommate.js:261 — Sources/CodexBarCore/Resources/Plugins/zoommate.js:261 · Sources/CodexBarCore/Resources/Plugins/zoommate.ts:204 — 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 (36 lines × 2 locations) · ×1
  • Duplicated block (36 lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/aiand.js:67 — Sources/CodexBarCore/Resources/Plugins/aiand.js:67 · Sources/CodexBarCore/Resources/Plugins/aiand.ts:27 — 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 (36 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (36 matched lines × 2 locations) REDACTED:24 — REDACTED:24 · Sources/CodexBarCore/Resources/Plugins/raycast.ts:74 — the two spans are one implementation copied and then locally edited — 340 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 (33 lines × 2 locations) · ×1
  • Duplicated block (33 lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/sailresearch.js:65 — Sources/CodexBarCore/Resources/Plugins/sailresearch.js:65 · Sources/CodexBarCore/Resources/Plugins/sailresearch.ts:33 — 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 (31 lines × 2 locations) · ×1
  • Duplicated block (31 lines × 2 locations) Sources/CodexBarCore/Resources/Plugins/bifrost.js:234 — Sources/CodexBarCore/Resources/Plugins/bifrost.js:234 · Sources/CodexBarCore/Resources/Plugins/bifrost.ts:195 — 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.
R2 · Cyclomatic Complexity · Complex function fetchUsage (cyclomatic 116, cognitive 202) · ×1
  • Complex function fetchUsage (cyclomatic 116, cognitive 202) Sources/CodexBarCore/Resources/Plugins/openrouter.js:24 — fetchUsage has cyclomatic complexity 116 and cognitive complexity 202; 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 fetchUsage (cyclomatic 66, cognitive 89) · ×1
  • Complex function fetchUsage (cyclomatic 66, cognitive 89) Sources/CodexBarCore/Resources/Plugins/zai.js:24 — fetchUsage has cyclomatic complexity 66 and cognitive complexity 89; 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 fetchUsage (cyclomatic 62, cognitive 87) · ×1
  • Complex function fetchUsage (cyclomatic 62, cognitive 87) Sources/CodexBarCore/Resources/Plugins/openai.js:14 — fetchUsage has cyclomatic complexity 62 and cognitive complexity 87; 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 fetchUsage (cyclomatic 60, cognitive 114) · ×1
  • Complex function fetchUsage (cyclomatic 60, cognitive 114) Sources/CodexBarCore/Resources/Plugins/zoommate.ts:18 — fetchUsage has cyclomatic complexity 60 and cognitive complexity 114; 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 fetchUsage (cyclomatic 59, cognitive 64) · ×1
  • Complex function fetchUsage (cyclomatic 59, cognitive 64) REDACTED:11 — fetchUsage has cyclomatic complexity 59 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 fetchUsage (cyclomatic 58, cognitive 87) · ×1
  • Complex function fetchUsage (cyclomatic 58, cognitive 87) Sources/CodexBarCore/Resources/Plugins/huggingface.ts:16 — fetchUsage has cyclomatic complexity 58 and cognitive complexity 87; 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 fetchUsage (cyclomatic 57, cognitive 74) · ×1
  • Complex function fetchUsage (cyclomatic 57, cognitive 74) Sources/CodexBarCore/Resources/Plugins/poe.js:15 — fetchUsage has cyclomatic complexity 57 and cognitive complexity 74; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function fetchUsage (cyclomatic 55, cognitive 60) · ×1
  • Complex function fetchUsage (cyclomatic 55, cognitive 60) REDACTED:39 — fetchUsage has cyclomatic complexity 55 and cognitive complexity 60; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function fetchUsage (cyclomatic 54, cognitive 108) · ×1
  • Complex function fetchUsage (cyclomatic 54, cognitive 108) Sources/CodexBarCore/Resources/Plugins/zoommate.js:53 — fetchUsage has cyclomatic complexity 54 and cognitive complexity 108; 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 fetchUsage (cyclomatic 54, cognitive 84) · ×1
  • Complex function fetchUsage (cyclomatic 54, cognitive 84) Sources/CodexBarCore/Resources/Plugins/huggingface.js:37 — fetchUsage has cyclomatic complexity 54 and cognitive complexity 84; 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 fetchUsage (cyclomatic 52, cognitive 55) · ×1
  • Complex function fetchUsage (cyclomatic 52, cognitive 55) Sources/CodexBarCore/Resources/Plugins/sub2api.js:10 — fetchUsage has cyclomatic complexity 52 and cognitive complexity 55; 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 fetchUsage (cyclomatic 50, cognitive 58) · ×1
  • Complex function fetchUsage (cyclomatic 50, cognitive 58) Sources/CodexBarCore/Resources/Plugins/munito.ts:8 — fetchUsage has cyclomatic complexity 50 and cognitive complexity 58; 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 fetchUsage (cyclomatic 45, cognitive 54) · ×1
  • Complex function fetchUsage (cyclomatic 45, cognitive 54) Sources/CodexBarCore/Resources/Plugins/munito.js:15 — fetchUsage has cyclomatic complexity 45 and cognitive complexity 54; 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 fetchUsage (cyclomatic 44, cognitive 51) · ×1
  • Complex function fetchUsage (cyclomatic 44, cognitive 51) REDACTED:10 — fetchUsage has cyclomatic complexity 44 and cognitive complexity 51; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function fetchUsage (cyclomatic 43, cognitive 38) · ×1
  • Complex function fetchUsage (cyclomatic 43, cognitive 38) REDACTED:11 — fetchUsage has cyclomatic complexity 43 and cognitive complexity 38; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R2 · Cyclomatic Complexity · Complex function fetchUsage (cyclomatic 41, cognitive 50) · ×1
  • Complex function fetchUsage (cyclomatic 41, cognitive 50) Sources/CodexBarCore/Resources/Plugins/t3chat.js:12 — fetchUsage has cyclomatic complexity 41 and cognitive complexity 50; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files · Integrations/Omarchy/test.mjs · ×1
  • Integrations/Omarchy/test.mjs: 771 lines of code Integrations/Omarchy/test.mjs:1 — Integrations/Omarchy/test.mjs has 771 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 · Sources/CodexBarCore/Resources/Plugins/openrouter.js · ×1
  • Sources/CodexBarCore/Resources/Plugins/openrouter.js: 431 lines of code Sources/CodexBarCore/Resources/Plugins/openrouter.js:1 — Sources/CodexBarCore/Resources/Plugins/openrouter.js has 431 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 · Sources/CodexBarCore/Resources/Plugins/openai.js · ×1
  • Sources/CodexBarCore/Resources/Plugins/openai.js: 409 lines of code Sources/CodexBarCore/Resources/Plugins/openai.js:1 — Sources/CodexBarCore/Resources/Plugins/openai.js has 409 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R7 · Dead Code · Dead file (~453 LoC) · ×1
  • Dead file (~453 LoC) Sources/CodexBarCore/Resources/Plugins/chutes.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~443 LoC) · ×1
  • Dead file (~443 LoC) Sources/CodexBarCore/Resources/Plugins/openrouter.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~413 LoC) · ×1
  • Dead file (~413 LoC) Sources/CodexBarCore/Resources/Plugins/openai.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~386 LoC) · ×1
  • Dead file (~386 LoC) Sources/CodexBarCore/Resources/Plugins/chutes.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~359 LoC) · ×1
  • Dead file (~359 LoC) Sources/CodexBarCore/Resources/Plugins/bifrost.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~356 LoC) · ×1
  • Dead file (~356 LoC) REDACTED — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~335 LoC) · ×1
  • Dead file (~335 LoC) Sources/CodexBarCore/Resources/Plugins/zai.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~316 LoC) · ×1
  • Dead file (~316 LoC) Sources/CodexBarCore/Resources/Plugins/bifrost.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~314 LoC) · ×1
  • Dead file (~314 LoC) Sources/CodexBarCore/Resources/Plugins/zoommate.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~310 LoC) · ×1
  • Dead file (~310 LoC) REDACTED — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~291 LoC) · ×1
  • Dead file (~291 LoC) Sources/CodexBarCore/Resources/Plugins/huggingface.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~281 LoC) · ×1
  • Dead file (~281 LoC) Sources/CodexBarCore/Resources/Plugins/muse.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~279 LoC) · ×1
  • Dead file (~279 LoC) Sources/CodexBarCore/Resources/Plugins/notion.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~245 LoC) · ×1
  • Dead file (~245 LoC) Sources/CodexBarCore/Resources/Plugins/huggingface.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~240 LoC) · ×1
  • Dead file (~240 LoC) Sources/CodexBarCore/Resources/Plugins/litellm.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~238 LoC) · ×1
  • Dead file (~238 LoC) Sources/CodexBarCore/Resources/Plugins/aixy.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~227 LoC) · ×1
  • Dead file (~227 LoC) Sources/CodexBarCore/Resources/Plugins/workbuddy.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~226 LoC) · ×1
  • Dead file (~226 LoC) Sources/CodexBarCore/Resources/Plugins/longcat.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~225 LoC) · ×1
  • Dead file (~225 LoC) Sources/CodexBarCore/Resources/Plugins/workbuddy.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~223 LoC) · ×1
  • Dead file (~223 LoC) Sources/CodexBarCore/Resources/Plugins/typesafe.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~222 LoC) · ×1
  • Dead file (~222 LoC) Sources/CodexBarCore/Resources/Plugins/sub2api.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~212 LoC) · ×1
  • Dead file (~212 LoC) Sources/CodexBarCore/Resources/Plugins/v0.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~207 LoC) · ×1
  • Dead file (~207 LoC) Sources/CodexBarCore/Resources/Plugins/litellm.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~201 LoC) · ×1
  • Dead file (~201 LoC) REDACTED — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~189 LoC) · ×1
  • Dead file (~189 LoC) Sources/CodexBarCore/Resources/Plugins/helmcode.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~183 LoC) · ×1
  • Dead file (~183 LoC) Sources/CodexBarCore/Resources/Plugins/notion.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~181 LoC) · ×1
  • Dead file (~181 LoC) Sources/CodexBarCore/Resources/Plugins/qwencloud-team.js — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~174 LoC) · ×1
  • Dead file (~174 LoC) Sources/CodexBarCore/Resources/Plugins/longcat.ts — no import path from any entry point (11 application, 14 tooling, 6 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
R7 · Dead Code · Dead file (~171 LoC) · ×1
  • Dead file (~171 LoC) REDACTED — no import path from any entry point (11 application, 14 tooling, 6 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 — 73 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×25
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/replicate.js:74 — `!/\bid\s*=\s*(["'])react-component-props[^"']*\1/i.test(match[1]) || !/\btype\s*=\s*(["'])application\/json\1/i.test(match[1])` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/replicate.js, Sources/CodexBarCore/Resources/Plugins/replicate.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:134 — `!Array.isArray(details) || details.length > 100` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/litellm.js:190 — `!Array.isArray(root.results) || root.results.length > 31` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/litellm.js, Sources/CodexBarCore/Resources/Plugins/litellm.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:16 — `!Number.isFinite(amount) || (!signed && amount < 0)` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/zoommate.js:252 — `!Number.isFinite(date.getTime()) || date < since` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/zoommate.js, Sources/CodexBarCore/Resources/Plugins/zoommate.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/ollama-api.js:77 — `!Number.isFinite(date.getTime()) || day > new Date(Date.UTC(year, month, 0)).getUTCDate()` appears character-identically in 4 files — Sources/CodexBarCore/Resources/Plugins/ollama-api.js, Sources/CodexBarCore/Resources/Plugins/ollama-api.ts, Sources/CodexBarCore/Resources/Plugins/sofya.js, Sources/CodexBarCore/Resources/Plugins/sofya.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/huggingface.js:63 — `!Number.isFinite(value) || value <= 0 || value > 64092211200` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/huggingface.js, Sources/CodexBarCore/Resources/Plugins/huggingface.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/huggingface.js:226 — `!Number.isInteger(scalar) || scalar > 0x10ffff || (scalar >= 0xd800 && scalar <= 0xdfff)` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/huggingface.js, Sources/CodexBarCore/Resources/Plugins/huggingface.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/aiand.js:51 — `!Number.isInteger(scale) || exponent < -128 || exponent > 127 || scale > 128` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/aiand.js, Sources/CodexBarCore/Resources/Plugins/aiand.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate REDACTED:153 — `!Number.isSafeInteger(detailRewards.used) || !Number.isSafeInteger(detailRewards.limit)` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/qwencloud-team.js:166 — `!Number.isSafeInteger(millis) || millis <= 0` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/qwencloud-team.js, Sources/CodexBarCore/Resources/Plugins/qwencloud-team.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/muse.js:269 — `!Number.isSafeInteger(minutes) || minutes <= 0` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/muse.js, Sources/CodexBarCore/Resources/Plugins/muse.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/qwencloud-team.js:127 — `!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start <= 0 || end <= start` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/qwencloud-team.js, Sources/CodexBarCore/Resources/Plugins/qwencloud-team.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/aixy.js:119 — `!["organization", "project", "team", "user", "api_key"].includes(scope) || !["daily", "weekly", "monthly", "lifetime"].includes(interval)` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/aixy.js, Sources/CodexBarCore/Resources/Plugins/aixy.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/typesafe.js:107 — `!actionID || !/^[0-9a-f]{40,}$/i.test(actionID)` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/typesafe.js, Sources/CodexBarCore/Resources/Plugins/typesafe.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/chutes.js:386 — `!chutesObject(value) && !Array.isArray(value)` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/chutes.js, Sources/CodexBarCore/Resources/Plugins/chutes.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/fal.js:37 — `!credits || typeof credits !== "object" || Array.isArray(credits)` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/fal.js, Sources/CodexBarCore/Resources/Plugins/openrouter.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 Sources/CodexBarCore/Resources/Plugins/aiand.js:95 — `!data || !Array.isArray(data.data) || (data.has_more != null && typeof data.has_more !== "boolean")` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/aiand.js, Sources/CodexBarCore/Resources/Plugins/aiand.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/devpass.js:59 — `!data || !["none", "lite", "pro", "max"].includes(data.devPlan)` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/devpass.js, Sources/CodexBarCore/Resources/Plugins/devpass.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/parallel.js:79 — `!data || typeof data !== "object" || !finite(data.balance)` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/parallel.js, Sources/CodexBarCore/Resources/Plugins/parallel.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/clinepass.js:76 — `!data || typeof data !== "object" || Array.isArray(data)` appears character-identically in 13 files — Sources/CodexBarCore/Resources/Plugins/clinepass.js, Sources/CodexBarCore/Resources/Plugins/clinepass.ts, REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/litellm.js:194 — `!day || !/^\d{4}-\d{2}-\d{2}$/u.test(day) || day < start || day > end` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/litellm.js, Sources/CodexBarCore/Resources/Plugins/litellm.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/huggingface.js:145 — `!identity || now.getTime() - identity.fetchedAt < 0 || now.getTime() - identity.fetchedAt >= 43200000` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/huggingface.js, Sources/CodexBarCore/Resources/Plugins/huggingface.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/replicate.js:126 — `!invoice || invoice.type !== "monthly-usage"` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/replicate.js, Sources/CodexBarCore/Resources/Plugins/replicate.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate Sources/CodexBarCore/Resources/Plugins/muse.js:178 — `!membership || !Array.isArray(membership.members)` appears character-identically in 2 files — Sources/CodexBarCore/Resources/Plugins/muse.js, Sources/CodexBarCore/Resources/Plugins/muse.ts. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
X7 · Silent fallback defaults · Silent fallback default in catch · ×22
  • Silent fallback default in catch Sources/CodexBar/UsageStore+ProviderStorage.swift:279 — `loadManagedCodexAccountsForStorage` 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 Sources/CodexBarCLI/ToonFormatter.swift:13 — `encode` 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 Sources/CodexBarCore/ChromiumLocalStorageDiscovery.swift:70 — `profileCandidates` 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 Sources/CodexBarCore/CodexWorkspaceUsageFingerprint.swift:47 — `make` turns every thrown error into `"unavailable"` — 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 Sources/CodexBarCore/Plugins/QuickJSProviderPluginEngine.swift:164 — `stringValue` 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 Sources/CodexBarCore/Host/PTY/TTYCommandRunner.swift:165 — `currentChildPIDs` 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 Sources/CodexBarCore/Host/Process/SpawnedProcessGroup.swift:249 — `allProcessIDs` 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 Sources/CodexBarCore/Providers/Amp/AmpUsageParser.swift:284 — `allCaptures` 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 Sources/CodexBarCore/Providers/Antigravity/AntigravityOfflineStore.swift:89 — `countDBFiles` turns every thrown error into `0` — 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 Sources/CodexBarCore/Providers/Antigravity/AntigravityOfflineStore.swift:97 — `countJSONLFiles` turns every thrown error into `0` — 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 Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe+PortDetection.swift:131 — `parseListeningPorts` 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 Sources/CodexBarCore/Providers/Antigravity/AntigravityStatusProbe+PortDetection.swift:160 — `socketInodes` 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 Sources/CodexBarCore/Providers/Claude/ClaudeCLIScreen.swift:23 — `render` 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 Sources/CodexBarCore/Providers/Cursor/CursorLocalCSVReader.swift:15 — `cachedCSVPaths` 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 Sources/CodexBarCore/Providers/Gemini/GeminiStatusProbe.swift:1055 — `parseModelUsageTable` 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 Sources/CodexBarCore/Providers/Shared/OpenCodeWebParsing.swift:166 — `parseWorkspaceIDs` 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 Sources/CodexBarCore/Vendored/CostUsage/CostUsageScanner.swift:3381 — `listCodexSessionFilesFlat` 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 Sources/CodexBarCore/Providers/Claude/ClaudeSwap/ClaudeSwapRetainedUsageStore.swift:23 — `decode` 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 Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:975 — `extractEmails` 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 Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:990 — `extractPlanHints` 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 Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebAPIFetcher.swift:1005 — `extractNotableFields` 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 Scripts/StoreStress/main.swift:392 — `descriptorCount` turns every thrown error into `-1` — 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.
D34 · Knowledge Freshness · Orphaned file · ×11
  • Orphaned file Sources/CodexBarCore/Providers/Shared/CurlCaptureParser.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.
  • Orphaned file Sources/CodexBarCore/Providers/Abacus/AbacusCookieImporter.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.
  • Orphaned file Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieHeader.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.
  • Orphaned file Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageSnapshot.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.
  • Orphaned file Sources/CodexBar/CursorLoginAccountSelector.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.
  • Orphaned file Sources/CodexBar/GeminiLoginRunner.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.
  • Orphaned file Sources/CodexBarCore/Providers/Bedrock/BedrockCredentialResolver.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.
  • Orphaned file Sources/CodexBarCore/Providers/Codex/CodexCLIDashboardAuthorityContext.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.
  • Orphaned file Sources/CodexBar/CodexResetCreditExpiryNotifier.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.
  • Orphaned file Sources/CodexBarCore/Providers/Factory/FactorySettingsReader.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.
  • Orphaned file Sources/CodexBarCore/Providers/Factory/FactoryStatusProbe+APIKey.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.
D16 · Bus Factor · Off-boarding risk · ×2
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 61 significant file(s) lose their only recent owner: Sources/CodexBarCore/Plugins/QuickJSProviderPluginEngine.swift, Sources/CodexBarCore/Plugins/ProviderPluginRuntime.swift, Sources/CodexBarCore/Plugins/ProviderPluginHTTPResponse.swift, Sources/CodexBar/OpenAICreditsPurchaseWindowController.swift, Sources/CodexBar/PreferencesPluginsPane.swift, Sources/CodexBar/MenuSwitchFlickerProbe.swift, Sources/CodexBarCore/Resources/Plugins/chutes.ts, Sources/CodexBarCore/Providers/Codex/CodexVisibleAccountProjection.swift (+53 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 5 significant file(s) lose their only recent owner: Sources/CodexBarCore/Providers/QwenCloud/QwenCloudUsageFetcher.swift, Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleSECTokenResolver.swift, Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/AliyunOneConsoleCookieImporter.swift, Sources/CodexBarCore/Providers/Shared/AliyunOneConsole/OneConsoleCookieRouting.swift, Sources/CodexBarCore/Providers/QwenCloud/QwenCloudCookieImporter.swift. Pair on, review, or document these before any departure.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 18 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (86 single-owned of 975 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 975 of the 1436 production source files in this repository met that bar). They are anonymized user #3 (2 file(s)), anonymized user #4 (2 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)), anonymized user #8 (1 file(s)) (+12 more) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: Sources/CodexBarCore/CodexLocalProjectUsageModels.swift, Sources/CodexBarCore/CodexThreadCatalogReader.swift, Sources/CodexBar/SpendDashboardSummary.swift, Sources/CodexBar/CostHistoryMenuScrollView.swift, Sources/CodexBar/CodexAccountSwitcherView.swift, Sources/CodexBar/UsageStore+ClaudeActiveAccountIdentity.swift, Scripts/cost_jsonl_shape_survey.swift, Sources/CodexBarCore/OpenAIWeb/OpenAISubscriptionMetadata.swift (+12 more).
D20 · ADR Quality · ADR has no Context section · ×1
  • ADR has no Context section docs/predictive-refresh-policy.md:9 — docs/predictive-refresh-policy.md has no Context section (a heading such as `## Context`, or the MADR equivalent). A decision record states the context that forced it, the decision and its consequences, so a reader can tell later whether it still holds.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 2 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `(repository root)` (305472 LoC, 3568 module-visible types across 215 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 11 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: Sources/CodexBarCore/Providers/Shared/CurlCaptureParser.swift, Sources/CodexBarCore/Providers/Abacus/AbacusCookieImporter.swift, Sources/CodexBarCore/Providers/Perplexity/PerplexityCookieHeader.swift, Sources/CodexBarCore/Providers/Alibaba/AlibabaCodingPlanUsageSnapshot.swift, Sources/CodexBar/CursorLoginAccountSelector.swift, Sources/CodexBar/GeminiLoginRunner.swift, Sources/CodexBarCore/Providers/Bedrock/BedrockCredentialResolver.swift, Sources/CodexBarCore/Providers/Codex/CodexCLIDashboardAuthorityContext.swift (and 3 more) (12 orphaned of 976 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 976 of the 1436 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · ADRs not easily discoverable · ×1
  • ADRs not easily discoverable — 1 ADR-shaped document(s) detected by content — `docs/predictive-refresh-policy.md`. They are not under a conventional ADR folder (docs/adr/) and are not named NNNN-title.md, and this check found them by their decision signature rather than by where they live — so a reader who does not already know these paths has no route to them. Detected by content signature only: records kept outside the repository, or written without a Status/Decision/Consequences shape, are not visible to this check and are not counted here.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST — No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 65256 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.
X5 · Nullable reference types · Null assertions (`!`) reduce the strict null checking score · ×1
  • Null assertions (`!`) reduce the strict null checking score — ~2.4 `!` null assertions per 1k TypeScript source lines — 15 assertion(s) across the 6315 source line(s) of the 43 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: Sources/CodexBarCore/Resources/Plugins/aixy.ts (7), Sources/CodexBarCore/Resources/Plugins/litellm.ts (3), Sources/CodexBarCore/Resources/Plugins/bifrost.ts (2). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce.
X6 · Hand-rolled structured-format parsing · Hand-rolled JSON/XML parsing via regex · ×1
  • Hand-rolled JSON/XML parsing via regex Sources/CodexBarCore/Providers/Shared/OpenCodeWebParsing.swift:83 — A regex whose pattern encodes JSON/XML syntax is parsing a structured format by hand — malformed or differently-typed content (e.g. `"amount": "5"` as a string) silently mis-parses instead of failing validation. This Swift code already uses a real parser in the same package; use it here too.
Minor — 11 finding(s)
D10 · Test Quality · Skipped (documented) · ×7
  • Skipped (documented): Tests/CodexBarTests/CodexDayAttributionTests.swift:6 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): Tests/CodexBarTests/CostReportingPeriodProofTests.swift:7 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): Tests/CodexBarTests/KeychainAccessGateConcurrencyTests.swift:20 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): Tests/CodexBarTests/LiveAccountTests.swift:8 — Skipped with a documented reason — a deferral, not lazy debt: Set LIVE_TEST=1 to run live Codex account checks.
  • Skipped (documented): Tests/CodexBarTests/QwenCloudProviderTests.swift:818 — Skipped with a documented reason — a deferral, not lazy debt: Set QWEN_CLOUD_LIVE_TEST=1 and QWEN_CLOUD_COOKIE to run live Qwen Cloud checks.
  • Skipped (documented): Tests/CodexBarTests/StubURLProtocolHandlerConcurrencyTests.swift:15 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
  • Skipped (documented): Tests/CodexBarTests/WidgetHeadlineLocalizationTests.swift:10 — Skipped with a documented reason — a deferral, not lazy debt: conditionally enabled — runs only when its .enabled(if:) condition holds
D12 · Dependency Hygiene · Outdated · ×4
  • Outdated: commander — `commander` is resolved at 0.2.4, but 0.3.0 is the newest release tagged on https://github.com/steipete/Commander within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update commander` reaches this one with no change to Package.swift.
  • Outdated: sparkle — `sparkle` is resolved at 2.9.6, but 2.10.1 is the newest release tagged on https://github.com/sparkle-project/Sparkle within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update sparkle` reaches this one with no change to Package.swift.
  • Outdated: sweetcookiekit — `sweetcookiekit` is resolved at 0.5.9, but 0.5.10 is the newest release tagged on https://github.com/steipete/SweetCookieKit within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update sweetcookiekit` reaches this one with no change to Package.swift.
  • Outdated: swift-log — `swift-log` is resolved at 1.15.1, but 1.16.2 is the newest release tagged on https://github.com/apple/swift-log within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-log` reaches this one with no change to Package.swift.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-6fba1064152042a0b2afcbdb99329154/history.json --exit-code 0 --source .1artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-6fba1064152042a0b2afcbdb99329154/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt --exclude Sources/CodexBarCore/Generated .12artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.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 366 file(s) — `Package.swift`, `Scripts/cost_jsonl_shape_survey.swift`, `Sources/AdaptiveRefreshCore/AdaptiveRefreshPolicyCore.swift`, `Sources/CodexBar/AgentSessionsStore.swift`, `Sources/CodexBar/ChartBarHoverSelection.swift`, … (+361 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 Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a1777a-92eb-75d5-8052-d8aedb8284b3 · 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